Related articles |
---|
managing register spills? gclind01@starbase.spd.louisville.edu (1997-06-10) |
Re: managing register spills? cliffc@risc.sps.mot.com (Cliff Click) (1997-06-13) |
Re: managing register spills? preston@cs.rice.edu (1997-06-13) |
Re: managing register spills? dlmoore@ix.netcom.com (David L Moore) (1997-06-13) |
From: | Cliff Click <cliffc@risc.sps.mot.com> |
Newsgroups: | comp.compilers |
Date: | 13 Jun 1997 21:59:41 -0400 |
Organization: | RISC Software, Motorola |
References: | 97-06-030 |
Keywords: | registers, optimize |
George C. Lindauer wrote:
>
> It seems easy enough, but suppose I have two register banks, register
> bank A and register bank B. All the registers in both banks are
> overused and have spilled. Now I want to move a value from bank A to
> bank B, allocating a new register in bank B and freeing the old one
> from bank A. Clearly, the free will cause an unspill, and the
> allocate will cause a spill. But if I free the bank a register BEFORE
> the move I've lost the value I want to move. And if I free it AFTER
> the move this is invalid because I've spilled from bank B and since I
> am using a stack to manage the spills the bank A unspill value is no
> longer available. An exchange instruction would be nice about
> now... unfortunately I don't have one.
>
> What do I do?
I can only guess what 'unspill' means, it's not a common term
in the register-allocation community that I've heard of before.
I've written about 4 full-blown Chaitin-style register allocators
before (at a few not-so-full-blown ones). The way I deal with this
problem is:
1) I'm moving a value from A to B, this is a write to B and B
is full, so...
2) I spill something from B to the stack. Bank A is not affected.
The spill happens just prior to the move. The spill is nothing
more than a store to the stack (and a stack-slot allocation).
I also insert the reloads before uses of the spilled value.
3) I then issue the move from A to B.
4) The register in A is now free. I do not "unspill" anything
into at this time.
5) A later round of Chaitin coloring will pick up on the now-free
register in bank A and assign it some useful work.
Cliff
--
Cliff Click, Ph.D. Compiler Researcher & Designer
RISC Software, Motorola PowerPC Compilers
cliffc@risc.sps.mot.com (512) 891-7240
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.