teja tamboli
2013-Mar-13 00:16 UTC
[LLVMdev] Generating IR bytecode files of httpd source code
Hi, I want to compile apache httpd using LLVM compiler. However, I am interested in generating llvm bytecode files [.s or .ll] files along with its executables. I followed steps mentioned in link : http://stackoverflow.com/questions/13851661/compiling-apache-httpd-into-llvm-bytecode-using-clang However after following all instructions when I compile httpd with following options I get directly executable files. CC="clang" CFLAGS="-emit-llvm" ./configure --prefix=/home/varun/work/httpd/build --with-included-apr make I want to generate intermediate byte code files. My aim is to run some optimizers on these bytecode files and then generate executables. How should I change this command or what approach I should take to do this. Thanks in advance ! -- Regards, Teja -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130312/bcebb082/attachment.html>
John Criswell
2013-Mar-13 00:31 UTC
[LLVMdev] Generating IR bytecode files of httpd source code
On 3/12/13 7:16 PM, teja tamboli wrote:> Hi, > > I want to compile apache httpd using LLVM compiler. However, I am > interested in generating llvm bytecode files [.s or .ll] files along > with its executables. I followed steps mentioned in link : > http://stackoverflow.com/questions/13851661/compiling-apache-httpd-into-llvm-bytecode-using-clang > > However after following all instructions when I compile httpd with > following options I get directly executable files. > > CC="clang" CFLAGS="-emit-llvm" ./configure > --prefix=/home/varun/work/httpd/build --with-included-apr > makeThe first problem may be that the -emit-llvm option may not be used to compile the code. Double-check your logs of the builds to make sure that it is. If it is not, then you may need to modify the build Makefiles in the build directory to get it to do this. The second problem is that while your object files will be LLVM bitcode, your final executable will still be native code because that is what libLTO does when it is told to generate a final executable. There are two ways to handle this: 1) Modify libLTO to run your LLVM passes for you. In many cases, this is the best way to do things, and it's how we do whole-program analysis in SAFECode. 2) Modify libLTO to dump the bitcode file it generates to a separate file just before it does code generation. I think the SAFECode libLTO code does this if the HAVE_POOLALLOC symbol is defined, so you can use it as a guide. 3) Modify the Apache build system to link all the files together into a single .o file instead of trying to create a final executable. With -emit-llvm, that file .o files will be an LLVM bitcode file.> > I want to generate intermediate byte code files. My aim is to run some > optimizers on these bytecode files and then generate executables.If you're doing optimizations, then option 1 is by far your best bet, IMHO. You can look at SAFECode's libLTO for an example. -- John T.> How should I change this command or what approach I should take to do > this. > > Thanks in advance ! > > -- > Regards, > Teja > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130312/4d025b70/attachment.html>
teja tamboli
2013-Mar-13 02:21 UTC
[LLVMdev] Generating IR bytecode files of httpd source code
Thanks John for quick reply. I used -O4 instead of "-emit-llvm" in CFLAGS option. I was just trying different options in CFLAGS to get IR byte code and pasted here with that option. Sorry ! I will look at this libLTO and will let you know. Thanks, Teja On Tue, Mar 12, 2013 at 5:31 PM, John Criswell <criswell at illinois.edu>wrote:> On 3/12/13 7:16 PM, teja tamboli wrote: > > Hi, > > I want to compile apache httpd using LLVM compiler. However, I am > interested in generating llvm bytecode files [.s or .ll] files along with > its executables. I followed steps mentioned in link : > > http://stackoverflow.com/questions/13851661/compiling-apache-httpd-into-llvm-bytecode-using-clang > > However after following all instructions when I compile httpd with > following options I get directly executable files. > > CC="clang" CFLAGS="-emit-llvm" ./configure > --prefix=/home/varun/work/httpd/build --with-included-apr > make > > > The first problem may be that the -emit-llvm option may not be used to > compile the code. Double-check your logs of the builds to make sure that > it is. If it is not, then you may need to modify the build Makefiles in > the build directory to get it to do this. > > The second problem is that while your object files will be LLVM bitcode, > your final executable will still be native code because that is what libLTO > does when it is told to generate a final executable. There are two ways to > handle this: > > 1) Modify libLTO to run your LLVM passes for you. In many cases, this is > the best way to do things, and it's how we do whole-program analysis in > SAFECode. > > 2) Modify libLTO to dump the bitcode file it generates to a separate file > just before it does code generation. I think the SAFECode libLTO code does > this if the HAVE_POOLALLOC symbol is defined, so you can use it as a guide. > > 3) Modify the Apache build system to link all the files together into a > single .o file instead of trying to create a final executable. With > -emit-llvm, that file .o files will be an LLVM bitcode file. > > > > I want to generate intermediate byte code files. My aim is to run some > optimizers on these bytecode files and then generate executables. > > > If you're doing optimizations, then option 1 is by far your best bet, > IMHO. You can look at SAFECode's libLTO for an example. > > -- John T. > > How should I change this command or what approach I should take to do > this. > > Thanks in advance ! > > -- > Regards, > Teja > > > _______________________________________________ > LLVM Developers mailing listLLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.eduhttp://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > >-- Regards, Teja -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130312/3db064f1/attachment.html>
Maybe Matching Threads
- [LLVMdev] Generating IR bytecode files of httpd source code
- [LLVMdev] Tool to convert to backend assembly instruction file "llc"
- [LLVMdev] Function permutation at IR bytecode level
- [LLVMdev] Tool to convert to backend assembly instruction file
- [LLVMdev] Inserting dead code in IR byte code