[llvm-dev] Get instance of CallGraph of a module in the pass

Riyad Parvez via llvm-dev llvm-dev at lists.llvm.org
Fri Oct 9 07:26:42 PDT 2015


Hello,

I want an instance of CallGraph in my pass. By looking at -dot-callgraph
source, I've tried something like this:

CallGraphWrapperPass *CGWP = new CallGraphWrapperPass();
PM.add(CGWP);
CallGraph *CG = &CGWP->getCallGraph();
PM.add(new MyPass(CG));


I get the following error:

/home/riyad/installs/llvm-3.7.0/include/llvm/PassSupport.h:95:38: error: no
matching constructor for initialization of
      'MyPass'
Pass *callDefaultCtor() { return new PassName(); }


My guess is pass manager needs pass with default constructor. Is there any
easy way to get instance of call graph in my pass?

Thanks in Advance,
Riyad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151009/2a1d278f/attachment.html>


More information about the llvm-dev mailing list