[LLVMdev] How to differentiate standard libc calls from intrinsics

Hal Finkel hfinkel at anl.gov
Wed Jan 15 21:18:50 PST 2014


James,

Can you explain in more detail what you're trying to do?

 -Hal

----- Original Message -----
> From: "James Stark" <mrjamesstark at gmail.com>
> To: llvmdev at cs.uiuc.edu
> Sent: Monday, January 13, 2014 6:18:01 AM
> Subject: [LLVMdev] How to differentiate standard libc calls from intrinsics
> 
> Hi,
> 
> 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
> intrinsic?
> 
> 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.
> 
> Thanks!
> -JS
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> 

-- 
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory



More information about the llvm-dev mailing list