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

Chris Lattner sabre at nondot.org
Wed May 5 10:24:02 PDT 2004


On Wed, 5 May 2004, John Criswell wrote:

> 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

Alternatively, if you'd like to get native code with the C backend, you
should replace the llc line with:

llc -o ackerman.cbe.c ackerman.bc -march=c
gcc -O3 ackerman.cbe.c -o ackerman.s -S


Oh, and if you're playing with the LLVM native code generators, consider
adding the -regalloc=linearscan option.  Not doing so will make the code
really horrible.  :)

-Chris

-- 
http://llvm.cs.uiuc.edu/
http://www.nondot.org/~sabre/Projects/




More information about the llvm-dev mailing list