<div dir="ltr">Thanks Markus.<div><br></div><div>Having llvm-as to turn the extracted function.bc file to .ll caused an error saying:</div><div><br></div><div>
<p><b>llvm-as-3.4: function_bc:1:1: <span>error: </span>expected top-level entity</b></p><p><b>BC! #AI29bEBB2I (some more binary)</b></p><p>This error is just the same error that I received while using llvm-extract on a .c file (not .bc or .ll).</p><p><br></p><p>Do I have to include other things in the command ? I mean generating a function.ll without anything as header, Module ID, etc might be wrong. right ?</p><p><br></p><p>-Amir</p></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 21, 2014 at 7:51 PM, Markus Timpl <span dir="ltr"><<a href="mailto:tima0900@googlemail.com" target="_blank">tima0900@googlemail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">You can use llvm-dis to turn .bc files into .ll files.</p>
<div class="gmail_quote">Am 22.10.2014 01:44 schrieb "Amir H. Ashouri" <<a href="mailto:amirhossein.ashouri@gmail.com" target="_blank">amirhossein.ashouri@gmail.com</a>>:<div><div class="h5"><br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks for the answer John.<div><br></div><div>I checked the llvm-extract and it works, but my concern is if the output of the extract could be saved as .ll instead of .bc. Sort of human-readable format so that I can parse it. Otherwise, it is better to parse the foo.ll file right away instead of using the extract tool. </div><div><br></div><div>Please correct me if I am wrong.</div><div><br></div><div>Thanks,</div><div><br></div><div>-Amir</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 21, 2014 at 7:02 PM, John Criswell <span dir="ltr"><<a href="mailto:jtcriswel@gmail.com" target="_blank">jtcriswel@gmail.com</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><div>
<div>On 10/21/14, 5:27 PM, Amir H. Ashouri
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Hello Everyone,
<div><br>
</div>
<div>Just subscribed to the mailing list.</div>
<div><br>
</div>
<div>I was wondering how I am going to fetch each functions of a
specific source code file (c/c++) using the LLVM framework.
For instance, I would like to apply certain passes using
llvm-opt on certain functions not the whole file. </div>
<div><br>
</div>
<div>I would appreciate any hints or idea leading me about the
starting point.</div>
</div>
</blockquote>
<br></div></div>
You might be able to use the llvm-extract tool to pull out the
functions you want into a separate bitcode file and then use opt to
optimize them. You'd then need to create a second bitcode file that
contains the remaining functions (using llvm-extract again).
Finally, you'd take the optimized bitcode file and the bitcode file
containing the other functions and link them together using clang
and libLTO or the llvm-link tool.<br>
<br>
Regards,<br>
<br>
John Criswell<br>
<br>
<blockquote type="cite">
<div dir="ltr">
<div><br>
</div>
<div>Regards,</div>
<div><br>
</div>
<div>-Amir </div>
</div>
<br>
<fieldset></fieldset>
<br>
<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><span><font color="#888888">
</font></span></pre><span><font color="#888888">
</font></span></blockquote><span><font color="#888888">
<br>
<br>
<pre cols="72">--
John Criswell
Assistant Professor
Department of Computer Science, University of Rochester
<a href="http://www.cs.rochester.edu/u/criswell" target="_blank">http://www.cs.rochester.edu/u/criswell</a></pre>
</font></span></div>
</blockquote></div><br></div>
<br>_______________________________________________<br>
LLVM Developers mailing list<br>
<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><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div></div></div>
</blockquote></div><br></div>