Newsgroups: comp.arch
Path: utzoo!henry
From: henry@zoo.toronto.edu (Henry Spencer)
Subject: Re: register save
Message-ID: <1991Mar13.200326.29116@zoo.toronto.edu>
Date: Wed, 13 Mar 1991 20:03:26 GMT
References: <1991Mar11.192116.1974@dgbt.doc.ca> <912@spim.mips.COM> <3255@crdos1.crd.ge.COM> <10896@dog.ee.lbl.gov>
Organization: U of Toronto Zoology

In article <10896@dog.ee.lbl.gov> torek@elf.ee.lbl.gov (Chris Torek) writes:
>>... in systems which use register windows, does someone have a good
>>handle on the cost of doing all the register to register I see just
>>before a call?
>
>In many (yeah sure :-/ ) cases you can put the values in the windowed
>registers in the first place...

In fact, it is tempting to generalize this and say "register-to-register
moves are the sign of a defective compiler".  This isn't quite always true,
of course.  In particular, if you are passing the value of a register
variable, it often needs to be copied because the call/return sequence
will generally destroy the passed copy.  Still, r-t-r moves should be
viewed with suspicion.

Turn the question around:  if those moves weren't being done register
to register, how *would* they be done?  Register to memory?  That costs
more, not less.

>... Applications which have a lot of `up-down' motion over a
>small call stack range, and which thus fit perfectly in the windows,
>will get either large gains, or (if your register allocation is good
>enough) none at all, on machines with register windows (SPARC) vs
>machines with `just a lot of registers' (AM29000).

AHEM.  Chris, the Am29k has *both*.  You can use 128 of those registers
as a register-window bank if you want, with the added bonus that the
size of the windows is completely up to you and can be different for
each function.
-- 
"But this *is* the simplified version   | Henry Spencer @ U of Toronto Zoology
for the general public."     -S. Harris |  henry@zoo.toronto.edu  utzoo!henry
