[llvm-dev] Inserting an external call in FunctionPass

Evgenii Stepanov via llvm-dev llvm-dev at lists.llvm.org
Thu Mar 23 17:19:30 PDT 2017


Hi,

how do I insert a call to an external function in a FunctionPass?
My problem is with creation of the declaration for the external function.

According to http://llvm.org/docs/WritingAnLLVMPass.html#the-functionpass-class,
a FunctionPass is not supposed to add or remove functions. I assume
it's also true for function declarations.

A declaration inserted in doInitialization is cleaned up in
GlobalOptLegacyPass::runOnModule, which happens to run before my pass'
runOnFunction().

Do I need a ModulePass for this?


More information about the llvm-dev mailing list