<div dir="ltr">Thanks so much John! That works :)<div><br></div><div>Previously I wrote a pass that inherited from CallGraphWrapperPass and used its getCallGraph() function within runOnModule() which resulted in segmentation faults for me. Not sure why that happened, perhaps callgraph wasn't setup by the time runOnModule() was called internally. If you know why, kindly enlighten me and perhaps document the behavior for the benefit of others.</div><div><br></div><div>Your email was the best thing to happen to me all day. I really appreciate you taking out the time to help.</div><div><br></div><div>Sincerely,</div><div>Zubin</div><div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Nov 30, 2017 at 11:33 AM, 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 class="m_5893471828267157583moz-cite-prefix">Dear Zubin,<br>
<br>
If I were you, I would write a ModulePass that uses the CallGraph
analysis to get a call graph. I would then iterate over the nodes
in the call graph and propagate information from callees to
callers.<br>
<br>
Regards,<br>
<br>
John Criswell<div><div class="h5"><br>
<br>
On 11/29/17 4:02 PM, Zubin Pahuja via llvm-dev wrote:<br>
</div></div></div>
<blockquote type="cite"><div><div class="h5">
<div dir="ltr">Hello,
<div><br>
</div>
<div>I am trying to count IR instructions in a function for
static analysis using llvm pass. In contrast with existing
examples, I am trying to include instruction counts of all the
callees of the function.</div>
<div><br>
</div>
<div>Counting the instructions of a function is easy using
passes, but iterating through the module's CallGraph is
proving to be confusing. I believe I have to use
CallGraphWrapperPass to get both module pass and its
CallGraph. How do I iterate through the CallGraph in
runOnModule()? A simple print callee names example would be
highly appreciated.</div>
<div><br>
</div>
<div>Thanks,</div>
<div>Zubin</div>
</div>
<br>
<fieldset class="m_5893471828267157583mimeAttachmentHeader"></fieldset>
<br>
</div></div><pre>______________________________<wbr>_________________
LLVM Developers mailing list
<a class="m_5893471828267157583moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>
<a class="m_5893471828267157583moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><span class="HOEnZb"><font color="#888888">
</font></span></pre><span class="HOEnZb"><font color="#888888">
</font></span></blockquote><span class="HOEnZb"><font color="#888888">
<br>
<p><br>
</p>
<pre class="m_5893471828267157583moz-signature" cols="72">--
John Criswell
Assistant Professor
Department of Computer Science, University of Rochester
<a class="m_5893471828267157583moz-txt-link-freetext" href="http://www.cs.rochester.edu/u/criswell" target="_blank">http://www.cs.rochester.edu/u/<wbr>criswell</a></pre>
</font></span></div>
</blockquote></div><br></div></div></div>