comp
Class RegBank

java.lang.Object
  |
  +--comp.RegBank

public class RegBank
extends java.lang.Object

Manages a set of registers for use during code generation.

Version:
$Id: RegBank.java,v 1.4 2002/05/10 22:49:25 dugan Exp $

Field Summary
(package private)  int liveCount
           
(package private)  boolean[] regs
           
 
Constructor Summary
RegBank(int numRegs)
           
 
Method Summary
 void free(java.lang.String reg)
          Return this register to the bank.
 void freeAll()
          Free all registers currenly in use.
 java.lang.String newReg()
          Answer a new register name as a String.
 void restoreRegs(Assembler asm, java.util.List saved)
          Restore all the registers in the given list.
 java.util.List saveRegs(Assembler asm)
          Save all registers currently on use.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

regs

boolean[] regs

liveCount

int liveCount
Constructor Detail

RegBank

public RegBank(int numRegs)
Method Detail

free

public void free(java.lang.String reg)
Return this register to the bank.


newReg

public java.lang.String newReg()
Answer a new register name as a String.


freeAll

public void freeAll()
Free all registers currenly in use.


saveRegs

public java.util.List saveRegs(Assembler asm)
Save all registers currently on use. The stack is grown by the correct number of bytes, and the registers are stored onto it.

Returns:
a List of saved registers.

restoreRegs

public void restoreRegs(Assembler asm,
                        java.util.List saved)
Restore all the registers in the given list. The stack is shrunk by the correct amount, and each register in the list is restored.