Re: When to do inline expansion

salomon@silver.cs.umanitoba.ca (Daniel J. Salomon)
Wed, 22 Sep 1993 17:07:58 GMT

          From comp.compilers

Related articles
When to do inline expansion jhall@whale.WPI.EDU (1993-09-14)
Re: When to do inline expansion zstern@adobe.com (1993-09-20)
Re: When to do inline expansion salomon@silver.cs.umanitoba.ca (1993-09-20)
Re: When to do inline expansion davidm@questor.rational.com (1993-09-20)
Re: When to do inline expansion jfc@athena.mit.edu (1993-09-21)
Re: When to do inline expansion jgmorris+@cs.cmu.edu (1993-09-21)
Re: When to do inline expansion jdean@bergen.cs.washington.edu (1993-09-21)
Re: When to do inline expansion salomon@silver.cs.umanitoba.ca (1993-09-22)
Re: When to do inline expansion preston@dawn.cs.rice.edu (1993-09-22)
Re: When to do inline expansion cliffc@rice.edu (1993-09-22)
Re: When to do inline expansion rfg@netcom.com (1993-09-25)
Re: When to do inline expansion ssimmons@convex.com (1993-09-27)
| List of all articles for this month |

Newsgroups: comp.compilers
From: salomon@silver.cs.umanitoba.ca (Daniel J. Salomon)
Keywords: optimize, registers
Organization: Computer Science, University of Manitoba, Winnipeg, Canada
References: 93-09-063 93-09-071
Date: Wed, 22 Sep 1993 17:07:58 GMT

zstern@adobe.com (Zalman Stern) writes:
>If it is called precisely once in the program, the function should be
>inlined no matter what.


davidm@questor.rational.com (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
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.