[LLVMdev] How to differentiate standard libc calls from intrinsics
mrjamesstark at gmail.com
Mon Jan 13 05:21:51 PST 2014
correction: Actually, I won't even be able to take advantage of the
following fact because all memcpy calls (either libc or intrinsics)
will appear as intrinsic calls anyway.
http://llvm.org/docs/LangRef.html#llvm-memcpy-intrinsic: "Note that,
unlike the standard libc function, the llvm.memcpy.* intrinsics do not
return a value...
On Mon, Jan 13, 2014 at 4:18 AM, James Stark <mrjamesstark at gmail.com> wrote:
> My pass scans call instructions for standard C library calls. For some
> libc functions, however, LLVM uses intrinsics instead. For example, I
> see that my memcpy calls are replaced by the llvm.memcpy.* intrinsics.
> This is not a problem because I can simply look for llvm.memcpy calls
> when scanning for memcpy calls.
> The problem arises when LLVM implicitly inserts llvm.memcpy intrinsics
> into my bitcode files when it thinks they are needed. In this case, I
> do not see a single memcpy call in my source file but its IR does have
> them. How do I make a distinction between a real C library call and an
> Btw, for this memcpy case, I should be able to take advantage of this fact:
> http://llvm.org/docs/LangRef.html#llvm-memcpy-intrinsic: "Note that,
> unlike the standard libc function, the llvm.memcpy.* intrinsics do not
> return a value..."
> However, I'm looking for a general solution for all libc intrinsics
> listed at http://llvm.org/docs/LangRef.html#standard-c-library-intrinsics.
More information about the llvm-dev