Package jminusminus

Class NRegisterAllocator

java.lang.Object
jminusminus.NRegisterAllocator
Direct Known Subclasses:
NGraphRegisterAllocator, NLinearRegisterAllocator, NNaiveRegisterAllocator

public abstract class NRegisterAllocator extends Object
The abstract base class for a register allocator that maps virtual registers (from LIR code) to physical registers on the target (MIPS) machine.
  • Field Details

  • Constructor Details

    • NRegisterAllocator

      protected NRegisterAllocator(NControlFlowGraph cfg)
      Constructs an NRegisterAllocator object.
      Parameters:
      cfg - control flow graph for a method.
  • Method Details

    • buildIntervals

      protected void buildIntervals()
      Builds the intervals for a control flow graph.
    • preprocess

      protected void preprocess()
      Preprocesses information needed for naive, linear, and graph register allocation schemes.
    • allocation

      public abstract void allocation()
      The work horse that does the allocation, implemented in the sub-classes of this class.
    • writeLivenessInfoToStdOut

      public void writeLivenessInfoToStdOut(PrettyPrinter p)
      Prints the local and global live sets to standard output.
      Parameters:
      p - for pretty printing with indentation.