如何在LoopPass中获取Module?我需要它来做Module - getOrInsertFunction

时间:2014-10-08 04:40:36

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

如何在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'的前向声明 课程模块;

0 个答案:

没有答案