|When to do inline expansion jhall@whale.WPI.EDU (1993-09-14)|
|Re: When to do inline expansion email@example.com (1993-09-20)|
|Re: When to do inline expansion firstname.lastname@example.org (1993-09-20)|
|Re: When to do inline expansion email@example.com (1993-09-20)|
|Re: When to do inline expansion firstname.lastname@example.org (1993-09-21)|
|Re: When to do inline expansion email@example.com (1993-09-21)|
|Re: When to do inline expansion firstname.lastname@example.org (1993-09-21)|
|Re: When to do inline expansion email@example.com (1993-09-22)|
|Re: When to do inline expansion firstname.lastname@example.org (1993-09-22)|
|Re: When to do inline expansion email@example.com (1993-09-22)|
|Re: When to do inline expansion firstname.lastname@example.org (1993-09-25)|
|Re: When to do inline expansion email@example.com (1993-09-27)|
|From:||firstname.lastname@example.org (Daniel J. Salomon)|
|Organization:||Computer Science, University of Manitoba, Winnipeg, Canada|
|Date:||Wed, 22 Sep 1993 17:07:58 GMT|
email@example.com (Zalman Stern) writes:
>If it is called precisely once in the program, the function should be
>inlined no matter what.
firstname.lastname@example.org (David Moore) writes:
> On certain Risc machines (eg Sparc, AM29000), when you call a routine, you
> get a new set of registers by performing a register window push. This push
> is often almost free [2-3 instruction slots] since a limited number of
> pushes will be done entirely in hardware registers.
I am not familiar with the AM29000, but on the SPARC a program can rotate
the register window independently from performing a function call.
Therefore the compiler can free a new set of registers for inline code
with the same cost that they can be freed for a function call.
It is true, however, that if a function is called conditionally special
interactions can occur with virtual memory page boundaries and cache
boundaries that can slow down inline code relative to function calls. A
compiler, however, cannot predict in the general case how frequently a
function will be called, especially if it depends on input data not
supplied with the source code. So the compiler is better off letting the
programmer decide what should be inlined.
Daniel J. Salomon -- salomon@cs.UManitoba.CA
Dept. of Computer Science / University of Manitoba
Winnipeg, Manitoba, Canada R3T 2N2 / (204) 474-8687
Return to the
Search the comp.compilers archives again.