[ECOS] inlining question

Andrew Lunn andrew@lunn.ch
Fri Mar 2 18:00:00 GMT 2007


On Fri, Mar 02, 2007 at 05:12:21PM +0000, Will Wagner wrote:
> Hi All,
> 
> When doing a build with inlining switched on I get a number of warnings 
> saying that inlining failed.

Yes, this is a problem with more modern versions of gcc. It also
becomes much worse when asserts are enabled.
 
> I vaguely remember from the distant past that I saw something in the gcc 
> docs on this. It suggested that gcc will only inline functions to a 
> certain depth. Is this a correct interpretation of this warning?

Correct. I think it is a bit more complex than that. I think it also
depends on the size of code to be inlined etc.
 
> I also vaguely remember that there was a gcc option to change the 
> inlining depth, but reading the docs now I can't find any option. Anyone 
> know if there is an option for changing this?

       -finline-limit=n
           By default, GCC limits the size of functions that can be inlined.
           This flag allows the control of this limit for functions that are
           explicitly marked as inline (i.e., marked with the inline keyword
           or defined within the class definition in c++).  n is the size of
           functions that can be inlined in number of pseudo instructions (not
           counting parameter handling).  The default value of n is 600.
           Increasing this value can result in more inlined code at the cost
           of compilation time and memory consumption.  Decreasing usually
           makes the compilation faster and less code will be inlined (which
           presumably means slower programs).  This option is particularly
           useful for programs that use inlining heavily such as those based
           on recursive templates with C++.

           Inlining is actually controlled by a number of parameters, which
           may be specified individually by using --param name=value.  The
           -finline-limit=n option sets some of these parameters as follows:

            @item max-inline-insns-single
             is set to I<n>/2.
            @item max-inline-insns-auto
             is set to I<n>/2.
            @item min-inline-insns
             is set to 130 or I<n>/4, whichever is smaller.
            @item max-inline-insns-rtl
             is set to I<n>.

           See below for a documentation of the individual parameters control-
           ling inlining.

           Note: pseudo instruction represents, in this particular context, an
           abstract measurement of function's size.  In no way, it represents
           a count of assembly instructions and as such its exact meaning
           might change from one release to an another.

However, check the documentation for the version of gcc you are using.

         Andrew

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



More information about the Ecos-discuss mailing list