Package jminusminus

Class NNaiveRegisterAllocator

java.lang.Object
jminusminus.NRegisterAllocator
jminusminus.NNaiveRegisterAllocator

public class NNaiveRegisterAllocator extends NRegisterAllocator
Implements a naive register allocation method. Each interval is considered live for the entire cfg. Intervals are assigned physical registers on a first come basis. When we run out of registers, we reuse the ones already assigned and spill.
  • Constructor Details

    • NNaiveRegisterAllocator

      public NNaiveRegisterAllocator(NControlFlowGraph cfg)
      Constructs an NNaiveRegisterAllocator object.
      Parameters:
      cfg - an instance of a control flow graph.
  • Method Details

    • allocation

      public void allocation()
      The work horse that does the allocation, implemented in the sub-classes of this class.
      Specified by:
      allocation in class NRegisterAllocator