Can I specify passes that I want run directly to llvm-gcc? I don't want all of -O3, for example. I tried llvm-gcc -raiseallocs ..., but that didn't work. I also tried running cc1 directly and it didn't take -raiseallocs as a parameter either. Duncan Sands wrote:> On Tuesday 28 April 2009 04:02:47 am Ryan M. Lefever wrote: >> I assume that when -O3 (or O2 or O1) is passed to llvm-gcc, then it >> utilizes opt. How do I determine what passes opt runs? How do I >> determine what external tools (and arguments) llvm-gcc is invoking? > > It doesn't invoke opt, it runs the passes directly. You can see > what passes it is running by passing -fdebug-pass-arguments to > llvm-gcc. > > Ciao, > > Duncan. > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Hi Ryan- You could run llvm-gcc with -O0 -emit-llvm and pipe to opt. On 28/04/2009, Ryan M. Lefever <lefever at crhc.illinois.edu> wrote:> Can I specify passes that I want run directly to llvm-gcc? I don't want > all of -O3, for example. I tried llvm-gcc -raiseallocs ..., but that > didn't work. I also tried running cc1 directly and it didn't take > -raiseallocs as a parameter either. > > Duncan Sands wrote: > > On Tuesday 28 April 2009 04:02:47 am Ryan M. Lefever wrote: > >> I assume that when -O3 (or O2 or O1) is passed to llvm-gcc, then it > >> utilizes opt. How do I determine what passes opt runs? How do I > >> determine what external tools (and arguments) llvm-gcc is invoking? > > > > It doesn't invoke opt, it runs the passes directly. You can see > > what passes it is running by passing -fdebug-pass-arguments to > > llvm-gcc. > > > > Ciao, > > > > Duncan. > > _______________________________________________ > > LLVM Developers mailing list > > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
On Tuesday 28 April 2009 09:19:19 am Ryan M. Lefever wrote:> Can I specify passes that I want run directly to llvm-gcc? I don't want > all of -O3, for example. I tried llvm-gcc -raiseallocs ..., but that > didn't work. I also tried running cc1 directly and it didn't take > -raiseallocs as a parameter either.You are better off run passes explicitly using opt. Try this: llvm-gcc -c -o - -O1 my_proc.c -emit-llvm -mllvm --disable-llvm-optzns | opt list_of_passes Passing -O1 to llvm-gcc means that gcc will perform constant folding and some other small optimizations. Passing -emit-llvm means that LLVM bitcode is produced, suitable for piping to opt. -mllvm --disable-llvm-optzns means that the LLVM optimizers will not be run. Ciao, Duncan.
Thanks for the help. When I run the following (where $llvm is the path to my llvm installation): $llvm/bin/llvm-gcc -c -o - -O1 tmp.c -emit-llvm -mllvm --disable-llvm-optzns | $llvm/bin/opt -raiseallocs I get the following error: cc1: error: unrecognized command line option "-fdisable-llvm-optzns" I am running llvm 2.5. I performed a $llvm/libexec/gcc/i686-pc-linux-gnu/4.2.1/cc1 --help and didn't see -fdisable-llvm-optzns or anything similar. Do you know what might be going on? Thanks, Ryan Duncan Sands wrote:> On Tuesday 28 April 2009 09:19:19 am Ryan M. Lefever wrote: >> Can I specify passes that I want run directly to llvm-gcc? I don't want >> all of -O3, for example. I tried llvm-gcc -raiseallocs ..., but that >> didn't work. I also tried running cc1 directly and it didn't take >> -raiseallocs as a parameter either. > > You are better off run passes explicitly using opt. Try this: > llvm-gcc -c -o - -O1 my_proc.c -emit-llvm -mllvm --disable-llvm-optzns | opt list_of_passes > Passing -O1 to llvm-gcc means that gcc will perform constant folding and > some other small optimizations. Passing -emit-llvm means that LLVM bitcode > is produced, suitable for piping to opt. -mllvm --disable-llvm-optzns means > that the LLVM optimizers will not be run. > > Ciao, > > Duncan.