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 ! <div><br></div><div>I will look at this libLTO and will let you know.<div>
<br></div><div>Thanks,</div><div>Teja<br><br><div class="gmail_quote">On Tue, Mar 12, 2013 at 5:31 PM, John Criswell <span dir="ltr"><<a href="mailto:criswell@illinois.edu" target="_blank">criswell@illinois.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000"><div class="im">
    <div>On 3/12/13 7:16 PM, teja tamboli wrote:<br>
    </div>
    <blockquote type="cite">
      
      Hi,
      <div><br>
      </div>
      <div>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 : </div>
      <div>
        <div><a href="http://stackoverflow.com/questions/13851661/compiling-apache-httpd-into-llvm-bytecode-using-clang" target="_blank">http://stackoverflow.com/questions/13851661/compiling-apache-httpd-into-llvm-bytecode-using-clang</a></div>

        <div><br>
        </div>
        <div>However after following all instructions when I compile
          httpd with following options I get directly executable files.</div>
        <div><br>
        </div>
        <div>CC="clang" CFLAGS="-emit-llvm" ./configure
          --prefix=/home/varun/work/httpd/build --with-included-apr</div>
        <div>
          <div>make</div>
        </div>
      </div>
    </blockquote>
    <br></div>
    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.<br>
    <br>
    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:<br>
    <br>
    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.<br>
    <br>
    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.<br>
    <br>
    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.<div class="im"><br>
    <br>
    <blockquote type="cite">
      <div>
        <div>
          <div><br>
          </div>
          <div>I want to generate intermediate byte code files. My aim
            is to run some optimizers on these bytecode files and then
            generate executables. <br>
          </div>
        </div>
      </div>
    </blockquote>
    <br></div>
    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.<br>
    <br>
    -- John T.<br>
    <br>
    <blockquote type="cite"><div class="im">
      <div>
        <div>
          <div>How should I change this command or what approach I
            should take to do this. </div>
          <div><br>
          </div>
          <div>Thanks in advance !</div>
          <div><br>
          </div>
        </div>
        <div>-- </div>
        Regards,<br>
        Teja
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      </div><pre>_______________________________________________
LLVM Developers mailing list
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
</pre>
    </blockquote>
    <br>
  </div>

</blockquote></div><br><br clear="all"><div><br></div>-- <br>Regards,<br>Teja
</div></div>