geneseo.cs.miniml
Class SparcRegisterTable

java.lang.Object
  |
  +--geneseo.cs.miniml.SparcRegisterTable
All Implemented Interfaces:
RegisterTable

public class SparcRegisterTable
extends java.lang.Object
implements RegisterTable

Represents tables that track the availability of "in" and "local" registers for a SPARC compiler.


Constructor Summary
SparcRegisterTable()
          Initializes a SPARC register table so that all registers are free.
 
Method Summary
 void clear()
          Marks all registers as unused.
 java.lang.String findFree()
          Find a free register.
 boolean isFree(java.lang.String regName)
          Inquire whether a register is free.
 void markFree(java.lang.String regName)
          Marks a register as free.
 void markUsed(java.lang.String regName)
          Marks a register as used.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SparcRegisterTable

public SparcRegisterTable()
Initializes a SPARC register table so that all registers are free.
Method Detail

clear

public void clear()
Description copied from interface: RegisterTable
Marks all registers as unused.
Specified by:
clear in interface RegisterTable

markUsed

public void markUsed(java.lang.String regName)
Description copied from interface: RegisterTable
Marks a register as used.
Specified by:
markUsed in interface RegisterTable
Following copied from interface: geneseo.cs.compiler.RegisterTable
Parameters:
regName - the name of the register to mark used.

markFree

public void markFree(java.lang.String regName)
Description copied from interface: RegisterTable
Marks a register as free.
Specified by:
markFree in interface RegisterTable
Following copied from interface: geneseo.cs.compiler.RegisterTable
Parameters:
regName - the name of the register to make free.

isFree

public boolean isFree(java.lang.String regName)
Description copied from interface: RegisterTable
Inquire whether a register is free.
Specified by:
isFree in interface RegisterTable
Following copied from interface: geneseo.cs.compiler.RegisterTable
Parameters:
regName - the name of the register.
Returns:
True if the register is free, false if it isn't or if no such register exists.

findFree

public java.lang.String findFree()
                          throws CompilerException
Description copied from interface: RegisterTable
Find a free register.
Specified by:
findFree in interface RegisterTable
Following copied from interface: geneseo.cs.compiler.RegisterTable
Returns:
a string naming a free register.
Throws:
CompilerException - if no registers are free.