如何在LoopPass中获取模块?我需要它来做模块 - getOrInsertFunction?
使用循环'L'
void Mypass::fillPrintfunctions(Loop *L)
{
Module *M = L->getPreheader()->getParent()->getParent() ;
Constant *PrintFunc;
PrintFunc = M->getOrInsertFunction("Print", Type::getVoidTy(M->getContext()), (Type*)0);
FPrint= cast<Function>(PrintFunc);//Fprint is Function *Fprint defined in Mypass;
}
bool Mypass:: runOnLoop(Loop *L, LPPassManager &LPM)
{
if(!filled){
fillPrintfunctions(L);
}
return true;
}
导致错误:'class llvm :: Module'的前向声明 课程模块;