This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: INTEGRATE_THRESHOLD ever changed?


> 
> The macro INTEGRATE_THRESHOLD is defined and documented as a possibly
> target-specific heuristic to help decide when to inline functions.
> However, I don't see that any target actually uses anything but the
> default formula, which is 8 * (8 + num_arguments) instructions.

Actually, a different formula is used if -Os is supplied, giving a smaller
threshold (inlining can still make sense when optimizing for space where
the function is very small, something that is common for C++ member
functions), but I guess you know about that one.  (see the definition in
integrate.c).

I see a comment saying "This is overridden on RISC machines" -- if that's
a lie, the comment should be changed.

> The reason I ask is that Apple's code has a version that calculates
> the actual number of call-used registers at the point where the
> compiler is thinking about whether to inline, and multiplies by
> that instead of by 8 always.  While this seems clever, I'm wondering
> if it's really necessary to go that far.  There are no references to
> results of testing or anything like that, so I don't know where and
> when this was supposed to be a win.  The fact that no standard GCC
> target ever changes the macro suggests that it's not really worth
> tinkering with.

> Does anybody think this is worth investigating further, or does it
> sound like an oddball hack that I should remove from Apple's sources?

I think that the value used for -Os might be worth tinkering with, if the
tinkering is cheap, as this option might be used by the embedded
programmer trying to wedge a function into an under-specified ROM, and
this poor sap may need all the help he can get.  But I'm not sure it
really matters all that much.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]