[LLVMdev] opt, llcc, ll++, -O1, -O2, -O3

John Criswell criswell at cs.uiuc.edu
Wed May 5 09:05:01 PDT 2004


Valery A.Khamenya wrote:
>>For example: 
>>$ llvmgcc ackerman.c -o ackerman -Wl,-native-cbe 
> 
>  
> BTW, Chris, what should be then an analogy 
> of "gcc -O3 -S foo.c" in LLVM framework?  
>  
> The invocation of 
>  
>  $ llvmgcc -S ackerman.c -o ackerman -Wl,-native-cbe  
>  
> does not produce native assebler output as one might expect. 
>  

If you're wanting native assembler code, one way to do it would be:

llvmgcc -o ackerman ackerman.c # Produces ackerman.bc, a linked LLVM
                                # bytecode file
llc -o ackerman.s ackerman.bc  # Generates native assembly from linked
                                # LLVM bytecode


Note that this will statically link all of the library functions in libc 
that are currently available as LLVM bytecode, so this file may be a 
little large.

If you want the native code for only the code in ackerman.c, just 
replace the first line with:

llvmgcc -c -o ackerman.bc ackerman.c # Compiles but doesn't link

-- John T.

-- 
*********************************************************************
* John T. Criswell                         Email: criswell at uiuc.edu *
* Research Programmer                                               *
* University of Illinois at Urbana-Champaign                        *
*                                                                   *
* "It's today!" said Piglet. "My favorite day," said Pooh.          *
*********************************************************************





More information about the llvm-dev mailing list