[llvm-commits] [llvm-gcc-4.2] r51608 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp

Evan Cheng evan.cheng at apple.com
Wed May 28 09:55:47 PDT 2008


I was looking at c-opts.c:

   flag_inline_trees = 1;

   /* Use tree inlining.  */
   if (!flag_no_inline)
     flag_no_inline = 1;
   if (flag_inline_functions)
     flag_inline_trees = 2;

flag_no_inline corresponds to -fno-inline, flag_inline_functions  
corresponds to -finline-functions. That is, if flag_inline_trees == 1,  
the frontend does trivial inlining for functions that are marked  
DECL_INLINE. We want to run llvm inliner pass only when  
flag_inline_trees > 1.

Perhaps it would be simpler to check for flag_inline_functions instead  
in llvm-backend.cpp?

Evan

On May 28, 2008, at 12:24 AM, Duncan Sands wrote:

> Hi Evan,
>
>> Really honor -fno-inline-functions.
>
>> -    if (flag_inline_trees)                      // respect -fno- 
>> inline-functions
>> +    if (flag_inline_trees > 1)                  // respect -fno- 
>> inline-functions
>
> the gcc middle- and back-ends do not make this distinction.
> All the places that use flag_inline_trees only check whether
> it is non-zero or not!
>
> However language front-ends do play with it in order to set
> DECL_INLINE, for example in c-decl.c there is:
>
>        else if (flag_inline_trees == 2 && initialized)
>          DECL_INLINE (decl) = 1;
>
> While the Ada front-end does:
>
>  DECL_INLINE (fndecl)
>    = DECL_DECLARED_INLINE_P (fndecl) || flag_inline_trees == 2;
>
> On the other hand the Fortran front-end doesn't do anything.
>
> I think the right thing to look at is DECL_INLINE, and only
> inline functions with the DECL_INLINE flag set.  What do you
> think?
>
> Ciao,
>
> Duncan.




More information about the llvm-commits mailing list