<div dir="ltr"><div>Hi,</div><div><br></div><div>you could require the Call Graph pass:</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">void MyPass::getAnalysisUsage(AnalysisUsage &AU) const {<br> ...<br> AU.addRequired<CallGraphWrapperPass>();<br>}</blockquote><div><div><br></div><div>and then get the result at some point in your pass:</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">CallGraph &CG = getAnalysis<CallGraphWrapperPass>().getCallGraph();</blockquote><div><br></div><div>I believe this works for you.</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-10-09 11:26 GMT-03:00 Riyad Parvez via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello,<div><br></div><div>I want an instance of CallGraph in my pass. By looking at -dot-callgraph source, I've tried something like this:</div><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div>CallGraphWrapperPass *CGWP = new CallGraphWrapperPass(); </div></div><div><div>PM.add(CGWP);</div></div><div><div>CallGraph *CG = &CGWP->getCallGraph();</div></div><div><div>PM.add(new MyPass(CG));</div></div></blockquote><div><br></div><div>I get the following error:</div><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div>/home/riyad/installs/llvm-3.7.0/include/llvm/PassSupport.h:95:38: error: no matching constructor for initialization of</div></div><div><div> 'MyPass'</div></div><div><div>Pass *callDefaultCtor() { return new PassName(); }</div></div></blockquote><div><br></div><div>My guess is pass manager needs pass with default constructor. Is there any easy way to get instance of call graph in my pass?</div><div><br></div><div>Thanks in Advance,</div><div>Riyad</div></div>
<br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div><br></div>