A note for those not consumed by efficiency worries (was: function calls)

Jim Giles jlg at lambda.UUCP
Fri Mar 23 11:25:05 AEST 1990


>From article <5940024 at hpcupt1.HP.COM>, by jamiller at hpcupt1.HP.COM (Jim Miller):
> [...]
> The dividing up the registers into mine and yours is not necessarily
> as bad as you think, there are lots of registers that get set for
> temporary values which do not need to be preserved across procedure
> calls.  If the compiler is clever, guess which registers get used for
> the temporary values?  

Well, the first N temporary values anyway.  Meanwhile, the caller had
to save all the values that _it_ had stored in those registers before
it could call the procedure.  I have yet to come across a high-level
language which made good use of the registers AND had a fast procedure
call mechanism.

By the way, in general, it's better for a compiler to make good use
of the registers and then pay high procedure-call overhead: the user then
has some degree of control (he CAN 'inline' any critical procedures).
If the compiler makes bad use of the register set, there is nothing the
user can do about it.

But, one way or another, you pay for procedure calls in implementations
which don't have extensive interprocedural analysis built-in.

J. Giles



More information about the Comp.lang.c mailing list