[LLVMdev] [RFC] NoBuiltin Attribute

Duncan Sands baldrick at free.fr
Tue Feb 19 00:48:08 PST 2013


Hi Chris,

On 19/02/13 03:08, Chris Lattner wrote:
> On Feb 18, 2013, at 5:01 PM, Chandler Carruth <chandlerc at google.com
> <mailto:chandlerc at google.com>> wrote:
>>
>>     > In the context of LTO, it makes sense for the attribute to be on
>>     function bodies, not on prototypes.
>>     >
>>     Yeah, I noticed that after sending this patch. I modified it to check the
>>     function CI is in for that attribute. Once we have support for the
>>     `-fno-builtin-FUNCTION' flag, I expect the attribute to look something
>>     like this:
>>
>>             "no-builtin-functions" = "puts,foo,bar"
>>
>>
>> I wonder... why not attach the no-builtin attribute to the call instruction?
>> It seems like that would avoid the need of a string attribute altogether,
>> having the frontend match up calls to specific functions which should not be
>> considered calls to builtin functions?
>
> How does this work?  If I build with -fno-builtin-fputs, why would an attribute
> be added to a call to printf?

there are two parts to libcall simplification:

   (1) recognizing that a call is to a function we understand (eg: printf);
   (2) generating a new call to a library function (eg: synthesizing memcpy).

Plunking an attribute on a call to say "this isn't the printf function you know"
seems kind of useful to me, even if it only takes care of (1).

Ciao, Duncan.



More information about the llvm-dev mailing list