On 2/19/2013 1:50 PM, Chris Lattner wrote:>
> How is this not handled by handling fno-builtin by putting an attribute on
the code being compiled?
Regardless of which solution you consider, it is always "putting an
attribute on the code being compiled", the question is where exactly and
what we do with it. I'm opposed to putting the attribute on the
definitions of the callers of functions indicated with
-fno-builtin-<something>.
If the user says -fno-builtin-printf, then all callers of printf would
need to be marked as "nobuiltin". As your example demonstrates, we
don't always know the exact set of callers of printf, since there can be
indirect calls that may only later be resolved to direct calls.
Putting attributes on caller's bodies will pose difficulties during
link-time inlining, which was also illustrated by your example from
earlier in this branch of this thread.
If we implement it this way now, we may not be able to change it later,
especially if we want to have backward compatibility of bitcode (i.e.
future LLVMs compiling past bitcodes).
-Krzysztof
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation