[llvm-dev] Inserting an external call in FunctionPass
Reid Kleckner via llvm-dev
llvm-dev at lists.llvm.org
Wed Mar 29 11:54:47 PDT 2017
I think the documentation is wrong. Existing function passes frequently
insert new intrinsic function declarations, and we expect that to work. The
loop vectorizer also inserts calls to non-intrinsic library functions.
The intention is that function passes don't introduce new function
definitions, because then an outer pass manager would need to discover them
and add them to its worklist.
On Thu, Mar 23, 2017 at 5:19 PM, Evgenii Stepanov via llvm-dev <
llvm-dev at lists.llvm.org> wrote:
> 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?
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170329/1d517881/attachment.html>
More information about the llvm-dev
mailing list