> For example: > $ llvmgcc ackerman.c -o ackerman -Wl,-native-cbeBTW, 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. -- Valery
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. * *********************************************************************
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 bytecodeAlternatively, 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/