Job Noorman
2011-Oct-10 19:03 UTC
[LLVMdev] Using analysis results from a CallGraphSCCPass in a ModulePass
Hi, I'm trying to use analysis results from a CallGraphSCCPass in a ModulePass. Here is the relevant code: struct MyCallGraphSCCPass : CallGraphSCCPass { ... bool runOnSCC(CallGraphSCC& scc){...} }; char MyCallGraphSCCPass::ID = 0; static RegisterPass<MyCallGraphSCCPass> X("cgscc", "Dummy CG SCC pass"); struct MyModulePass : public ModulePass { ... bool runOnModule(Module& m){...} void getAnalysisUsage(AnalysisUsage& au) const { au.addRequired<MyCallGraphSCCPass>(); } }; char MyModulePass::ID = 0; static RegisterPass<MyModulePass> Y("mod", "Dummy module pass"); When running MyCallGraphSCCPass through opt, I get the following output: $ opt -load ./MyPass.so -mod test.bc > /dev/null opt: /home/job/sources/llvm-trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp:535: virtual void llvm::CallGraphSCCPass::assignPassManager(llvm::PMStack&, llvm::PassManagerType): Assertion `!PMS.empty() && "Unable to handle Call Graph Pass"' failed. Stack dump: 0. Program arguments: opt -load ./MyPass.so -mod ../test.bc Aborted Is it impossible to do what I want or am I doing something wrong? If it's impossible, could somebody explain why? Thanks in advance for any help! Job