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

Duncan Sands baldrick at free.fr
Wed May 28 10:22:06 PDT 2008


Hi Evan,

> I was looking at c-opts.c:

notice the "c" in c-opts? :)

>    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.

This is how the C front-end does it.

> That is, if flag_inline_trees == 1,   
> the frontend does trivial inlining for functions that are marked  
> DECL_INLINE.

I don't think that's right: the gcc inliner only looks at
flag_inline_trees != 0 and DECL_INLINE.

> We want to run llvm inliner pass only when   
> flag_inline_trees > 1.

To get the same effect as gcc in a way that works for all languages,
I think we need to run the inliner if flag_inline_trees != 0 and add
all functions with !DECL_INLINE to llvm.noinline.  Or would that be
too expensive?
 
> Perhaps it would be simpler to check for flag_inline_functions instead  
> in llvm-backend.cpp?

It would be simpler, but it would only work the same way as gcc for
the C like languages, and not for Ada or Fortran.

Ciao,

Duncan.



More information about the llvm-commits mailing list