LLVM插入传递到PassManager

时间:2014-12-11 19:04:38

标签: c++ llvm llvm-clang llvm-c++-api

我正在写一个模块级别的传递,在runOnModule函数中我有以下代码:

for (Module::iterator F = M.begin(), FEND = M.end(); F != FEND; ++F){
if (!(*F).isDeclaration()){
  LoopInfo* LI = new LoopInfo();
  LI->runOnFunction(*F);
  lis.push_back(LI);
  for(LoopInfo::iterator L = LI->begin(), LEND = LI->end(); L != LEND; ++L){
    // add all functions
    loops.push_back(*L);
  }
}

}

这一切都编译但是当我运行它时,我收到以下错误:

opt: /include/llvm/PassAnalysisSupport.h:200: AnalysisType 
&llvm::Pass::getAnalysis() const [AnalysisType = llvm::DominatorTreeWrapperPass]:
Assertion `Resolver && "Pass has not been inserted into a PassManager object!"' failed.

我尝试将下面的代码放在``lib / Transforms / IPO / PassManagerBuilder.cpp in the populateModulePassManager`方法中,但没有任何反应。

if (EnableMergeFunctions) {
MPM.add(createMergeFunctionsPass());
MPM.add(createJumpThreadingPass()); // Merge consecutive conditionals
MPM.add(createInstructionCombiningPass());
MPM.add(createCFGSimplificationPass());

}

任何帮助都会非常感谢。

0 个答案:

没有答案