🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.arch
Article #12883

Re: subroutine frequency

#12883
From: gwu
Date: Mon, 26 Jan 1987 03:05
28 lines
2085 bytes
> am i missing something or does the frequency of calls not matter?
> if it is slower to save the registers over many calls, is it not
> slower to save the registers for just one call?  isn't it just an
> issue of memory references within the routine?  if the register
> saves result in a greater number of references than without the
> register saves (i.e. register variables), then it is not worth it
> no matter how many times the routine is called.

     It IS a matter of references to memory. Picture a routine which has
several accesses to its variables, which are all declared as register
variables. If in the middle, there is one call to a routine which requires
the registers to be saved, it is probably of advantage to keep the variables
in registers. The total number of memory references is pretty much the
procedure call mechanism.

     If on the other hand, the calling routine rarely accesses its variables,
which are not in registers, but calls another routine very often, the number
of memory references is merely those of the calling routine's variables.

     Whether the program saves only those registers to be used also makes a
difference. I suspect that this is compiler implementation dependent. If all
registers are automatically saved with every procedure invocation, there's
obviously going to be some waste. Even if the compiler is intelligent about
saving registers, the above example still shows that the number of calls to
other routines can vary the effectiveness of declaring register variables.

						George J Wu
Technical Details
Message-ID: <1025@vlsi.cs.cmu.edu>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!rutgers!lll-lcc!seismo!rochester!pt.cs.cmu.edu!vlsi.cs.cmu.edu!gwu
References: <1881@homxc.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!rutgers!lll-lcc!seismo!rochester!pt.cs.cmu.edu!vlsi.cs.cmu.edu!gwu
From: gwu@vlsi.cs.cmu.edu.UUCP
Newsgroups: comp.arch
Subject: Re: subroutine frequency
Message-ID: <1025@vlsi.cs.cmu.edu>
Date: Sun, 25-Jan-87 22:05:12 EST
Article-I.D.: vlsi.1025
Posted: Sun Jan 25 22:05:12 1987
Date-Received: Tue, 27-Jan-87 02:12:22 EST
References: <1881@homxc.UUCP>
Organization: Carnegie-Mellon University, CS/RI
Lines: 28