[LLVMdev] Controlling the order of a FunctionPass

Trevor Harmon trevor.w.harmon at nasa.gov
Thu Jul 29 15:20:02 PDT 2010


On Jul 23, 2010, at 7:36 AM, John Criswell wrote:

> 2) For prerequisite *analysis* passes (like LoopInfo), your ModulePass
> can declare them as prerequisites and get access to them using the
> getAnalysis<PassName>(Function *) method.

Yes, I remember trying this before but was unsuccessful. I made a  
second attempt just now and am again running into the same issue:

bool MyModulePass::runOnModule(Module &M) {
     for (Module::iterator i = M.begin(), e = M.end(); i != e; ++i) {
         Function *function = i;
         LoopInfo &loopInfo = getAnalysis<LoopInfo>(function);
         ...
     }
     ...
}

MyModulePass.cpp: In member function ‘virtual bool  
MyModulePass::runOnModule(llvm::Module&)’:
MyModulePass.cpp:70: error: no matching function for call to  
‘MyModulePass::getAnalysis(llvm::Function*&)’

I believe I'm calling getAnalysis the same way as shown in "Writing an  
LLVM Pass", so I don't know what I'm doing wrong. (I thought perhaps I  
needed to call getAnalysis on the module reference, but it has no such  
member function.)

Any ideas? Thanks,

Trevor





More information about the llvm-dev mailing list