[LLVMdev] [RFC] NoBuiltin Attribute

Krzysztof Parzyszek kparzysz at codeaurora.org
Wed Feb 20 07:56:38 PST 2013


On 2/19/2013 11:11 PM, Chris Lattner wrote:
>
> I still really have no idea what problem you think you are solving.

Dealing with different attributes on different functions.

--- a.c ---
void func_a() {
   printf(...);
}

--- b.c ---
void func_b() {
   printf(...);
   func_a();
}

a.c is compiled with no-builtin-printf, b.c has no such options.

The prototype approach (no-builtin on the prototype of printf) won't 
work in case like this, when the no-builtin attributes are not identical 
across all the compilation units.

Putting this attribute on all calls to printf (and all indirect calls) 
in a.c should work fine.

Putting the attribute on the caller of printf, i.e. "func_a" is what I 
object to.  If it's in the form of "define @func_a() no-builtin-printf 
{...body...}", then the attribute may be lost during inlining of func_a. 
  If this is solved by transferring the attribute to the calls, then 
there is no need for any specific association of the attribute with 
func_a, since it can be placed on the calls from the beginning.

-Krzysztof

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
hosted by The Linux Foundation



More information about the llvm-dev mailing list