[LLVMdev] Selectively Disable Inlining for Functions
Chris Lattner
sabre at nondot.org
Tue Mar 7 11:15:30 PST 2006
On Tue, 7 Mar 2006, Chris Lattner wrote:
> As a specific proposal to provide "never inline" in a way that is low-impact
> on LLVM and solves #3, I suggest that we add a new llvm.neverinline global
> array variable (like the llvm.used global). This global would point to all
> neverinline functions, and would have appending linkage (like llvm.used).
To be more explicit, here's an example of what attribute(used) does.
Given:
int X __attribute__((used));
int Y;
void foo() __attribute__((used));
void foo() {}
void bar() {}
The C front-end emits this global:
; Attribute used list
%llvm.used = appending global [2 x sbyte*] [
sbyte* cast (int* %X to sbyte*),
sbyte* cast (void ()* %foo to sbyte*)
]
"llvm.used" is never internalized, so it never goes away. Its presense
automatically disables IPO and prevents the functions from being removed
as described earlier.
-Chris
--
http://nondot.org/sabre/
http://llvm.org/
More information about the llvm-dev
mailing list