Displaying 1 result from an estimated 1 matches for "dofoocall".
2015 Aug 19
5
creating a callinst to an external function
...y, false);
PointerType* PtrToFuncTy = PointerType::get(FuncTy, 0);
Constant *fun = M->getOrInsertFunction("foo", Type::getVoidTy(C), PtrToFuncTy, Type::getLabelTy(C), nullptr);
Function *dofoo = cast<Function>(fun);
Instruction* dofooCall = CallInst::Create(fun, Args2, "", bb);
Note: Args2 is an arraylist containing 2 value pointers to a function and a basicblock, bb is the basicblock to insert the call in.
When I run the pass using op on a given IR, it produces a declaration and a call correctly like this:
declarati...