<div>Hi Ananth,</div><div><br></div>I'm not sure about a tool that already does it, but there is code to construct a callgraph that you could use to write a pass to do this.<br><br><div class="gmail_quote">On Tue, Aug 9, 2011 at 11:38 PM, Ananth Durbha <span dir="ltr"><<a href="mailto:avdurbha@yahoo.com">avdurbha@yahoo.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div style="color:#000;background-color:#fff;font-family:times new roman, new york, times, serif;font-size:12pt">

<div>Hi,</div><div>     I am interested in getting llvm IR only for a subset of the input source code - basically starting from a specified top level function, including all its callee functions (recursively).</div><div>
<br>
</div><div>     For example, in the following code, I am interested in a command like "extract -top_function blah()" that will create an llvm IR with just blah() and foo().<br></div><div><br></div><div>      int foo() {</div>

<div>          ...<br></div><div>      }</div><div><br></div><div>       int blah() {</div><div>             foo()</div><div>      
 }</div><div><br></div><div>        int junk() {</div><div>             blah();</div><div>        }</div><div><br></div><div>        int main() {</div><div>             junk();</div><div>        }</div><div><br></div><div>

    I can imagine writing some kind of FunctionPass that filters for specified function etc. But is there already some pass/command/tool that already does something similar?</div><div><br></div><div>    Thanks in advance for helping a newbie!</div>

<div><br></div><font color="#888888"><div>-Ananth</div></font></div></div><br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">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><br><br clear="all"><br>-- <br>gregory malecha<br><div><a href="http://www.people.fas.harvard.edu/~gmalecha/" target="_blank">http://www.people.fas.harvard.edu/~gmalecha/</a></div><br>