[LLVMdev] llvm-gcc and -emit-llvm

Dale Johannesen dalej at apple.com
Mon Jun 9 12:52:29 PDT 2008


On Jun 9, 2008, at 11:32 AM, Jonathan Turner wrote:
> Just thought I'd mention this to keep other people from stubbing  
> their toes on it...
>
> Using llvm-gcc/llvm-g++ and -emit-llvm, you need to make sure to  
> pass -S as well, like so:
>
> ./llvm-g++ -S -emit-llvm hello.cpp
>
> not: /llvm-g++ -emit-llvm hello.cpp
>
> I'm sure that's old news to most of the people on the list, but I  
> thought it couldn't hurt to mention it in case other people happen  
> upon it.
>
> A question might be, can the -emit-llvm emit the llvm first before  
> it goes into the linking phase?  That way the users can at least get  
> something on the screen of what they're looking for, or maybe a  
> warning saying "to emit llvm, you need to pass the -S flag"?

The flag usage follows standard Unix practice:  without -S or -c, the  
end result is an executable; with one of those flags, compilation  
stops earlier.  -c -emit-llvm will produce llvm IR in its binary  
format (suitable for feeding into llc).

It seems clear the current interface can be confusing; you are not the  
first.  Perhaps -emit-llvm should be renamed to indicate it does not  
necessarily result in emitting llvm IR?
-output-format-llvm?  Seems pretty ugly, maybe someone can do better.





More information about the llvm-dev mailing list