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]
Other format: [Raw text]

Re: std::pow implementation


Joe Buck wrote:
The analogy between the keywords "inline" and "register" is often made,
but I think that it is inappropriate.

I don't.


> The reason is that we can do very
good register allocation based only on local information,

This is only true because GCC always strictly adheres to the ABIs calling convention w.r.t. register assignments.

Were it to put any of its function arguments in any register
it bloody well pleases, it wouldn't be able to do good
register allocation anymore, with only local information.
Still might be a win, though, esp. for calls to small
functions.

> where the same
is not true of many inlining decisions, which involve a more complicated
set of tradeoffs (other than for very small functions; for such cases the
compiler can reliably determine that an inlined call will be better by
every measure than a non-inlined call).

Inlining breaks the calling conventions (duh!). It's hard to do it well with only local information. It often is a win though, esp. for calls to small functions.

In any case, at this stage in the state of the art of compiler
development, we are not even close to the day where it's a good idea
to just ignore the inline keyword.

Definately. And that's true for the register keyword, too.



Segher




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