Llvm 如何在循环过程中获取模块?我需要它来做模块-getOrInsertFunction

Llvm 如何在循环过程中获取模块?我需要它来做模块-getOrInsertFunction,llvm,llvm-ir,llvm-c++-api,Llvm,Llvm Ir,Llvm C++ Api,如何在循环过程中获取模块?我需要它来做模块-getOrInsertFunction 使用循环'L' void Mypass::fillPrintfunctions(Loop *L) { Module *M = L->getPreheader()->getParent()->getParent() ; Constant *PrintFunc; PrintFunc = M->getOrInsertFunction("Print", Type::getV

如何在循环过程中获取模块?我需要它来做模块-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;
 }
导致错误:“类llvm::模块”的转发声明
类模块

请给我们看更多的代码。对不起,我犯了错误,我已经包含了llvm/IR/Module.h,但是编译了一个旧文件。它现在可以正常工作了。