Passing arguments to opt via clang

Hi all,

In the good old llvmc, the -Wo flag could be used to pass arguments to the optimizer. Is there a similar mechanism anywhere for clang? Is there also a similar mechanism to -Wllc?

Thanks!

Harel Cain

In the good old llvmc, the -Wo flag could be used to pass arguments to the
optimizer. Is there a similar mechanism anywhere for clang? Is there also a
similar mechanism to -Wllc?

-mlvm will handle all of them

Thanks, but I’m not sure I understand. I see no such flag in clang 2.9 nor couldn’t I find any mention of it. What does it do?

Harel Cain

Thanks, but I'm not sure I understand. I see no such flag in clang 2.9 nor
couldn't I find any mention of it. What does it do?

I think he meant -mllvm not -mlvm. The next thing that follows is passed to
LLVM, for example -mllvm -disable-llvm-optzns

Ciao, Duncan.

It's called -mllvm.

You can use it like this.

clang -mllvm -vectorize ...

Cheers
Tobi

I have tried to invoke a transformation/optimization pass using -mllvm, without success. I might be missing something.

For example I have a shared/dynamic library which contains LLVM passes. I used to invoke them with llvmc like this:

llvmc mycode.c -o mycode.o -c -opt -Wo,=-load,libFoo.dylib,-Foo

Can this style of optimization be executed using -mllvm argument?

Thx,
PMon

Hello

For example I have a shared/dynamic library which contains LLVM passes. I
used to invoke them with llvmc like this:

llvmc mycode.c -o mycode.o -c -opt -Wo,=-load,libFoo.dylib,-Foo

Can this style of optimization be executed using -mllvm argument?

No. You cannot add additional passes this way, only pass 'ordinary' arguments.

what is the solution to pass opt arguments , non ordinary passes like :
*-std-link-opts* by clang ?
Dose clang invoke opt in normal compilation procedure even?

No, clang doesn't invoke opt. Instead both clang and opt use the same LLVM
infrastructure to schedule passes (opt is basically a thin wrapper around
this core functionality).

Ciao, Duncan.