[LLVMdev] How to differentiate standard libc calls from intrinsics

James Stark mrjamesstark at gmail.com
Sat Jan 18 11:18:21 PST 2014


Hi Hal,

I'm trying to find how many libc calls exist in a bitcode file. Since
some libc calls appear as LLVM intrinsics, I can't find those. I've
found from other source that -fno-builtin works like a charm. Hope
this will help other people looking for a solution.

Thanks,
James.

On Wed, Jan 15, 2014 at 9:18 PM, Hal Finkel <hfinkel at anl.gov> wrote:
> 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