[LLVMdev] Using analysis results from a CallGraphSCCPass in a ModulePass

Job Noorman jobnoorman at gmail.com
Mon Oct 10 12:03:38 PDT 2011


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



More information about the llvm-dev mailing list