[cfe-dev] always_inline and noinline attributes
Devang Patel
dpatel at apple.com
Fri Jul 18 14:23:23 PDT 2008
Hi Matthijs,
On Jul 18, 2008, at 2:09 PM, Matthijs Kooijman wrote:
> Hi Devang,
>
>> The correct approach is to encode these function properties in LLVM
>> IR.
>> Stay tuned, I'll send out proposal on LLVM dev list in next few days.
> Any chance of this proposal getting finished? :-)
I got side tracked on other things. I'll try to get this finished soon.
>> Once the information is encoded in the IR, the remaining issue is
>> how to
>> invoke the LLVM inlining pass when at least one function is marked as
>> always_inline. There are two possible approaches:
>>
>> 1) Teach FE tools (e.g. clang, llvm-gcc) to insert inlining pass in
>> the
>> PassManager while requesting (opt + code generation) when it least
>> one
>> function with attribute always_inline is seen.
> Perhaps there could be a specific inliner that does only this? This
> prevents
> surprises when people didn't expect inlining?
>
>> 2) Teach the LLVM PassManager to sniff always_inline property
>> encoded in
>> the LLVM IR and do the right thing.
> This sounds like it might also surprise people, if they only add a
> single pass
> and still things are inlined. Might not be a big problem, though.
It makes to sense have a inliner mode (or a separate pass) that only
handles always_inline.
> Another reason why I think encoding in the IR is necessary: If I
> have an
> always inline function defined in one module and referenced in
> another, I
> think it should still be inlined after I link the two modules
> together, right?
That is also my understanding. I hope, that will not surprise users.
-
Devang
More information about the cfe-dev
mailing list