[LLVMdev] Controlling the order of a FunctionPass

Trevor Harmon trevor.w.harmon at nasa.gov
Thu Jul 22 15:46:28 PDT 2010


On Jul 22, 2010, at 2:05 PM, John Criswell wrote:

> If you write your pass as a ModulePass, then you can iterate over the
> functions in any order that you want.

I had considered that, but my FunctionPass depends on other passes  
processing the functions first:

void MyPass::getAnalysisUsage(AnalysisUsage &AU) const {
     AU.addRequired<UnifyFunctionExitNodes>();
     AU.addRequired<LoopInfo>();
     AU.addPreserved<LoopInfo>();
}

bool MyPass::runOnFunction(Function &function) {
     LoopInfo &loopInfo = getAnalysis<LoopInfo>();
     ...
}

I don't know how to convert the above code into its equivalent form  
for a ModulePass.

Trevor




More information about the llvm-dev mailing list