SandMark version 2.1


sandmark.watermark.potkonjak
Class RegisterAllocator

java.lang.Object
  |
  +--sandmark.watermark.potkonjak.RegisterAllocator

public class RegisterAllocator
extends java.lang.Object

RegisterAllocator performs analysis on a control flow graph and determines the minimum amount of local variables needed in a method.

See Also:
LocalVariable

Nested Class Summary
(package private)  class RegisterAllocator.IGNode
          IGNode is a node in the interference graph.
 
Field Summary
(package private)  EDU.purdue.cs.bloat.cfg.FlowGraph cfg
           
(package private)  java.util.Vector coloring
           
(package private)  java.util.Map colors
           
(package private)  int colorsUsed
           
(package private)  EDU.purdue.cs.bloat.util.Graph ig
           
(package private)  livenessAnalysis liveness
           
(package private) static float LOOP_FACTOR
           
(package private) static int MAX_DEPTH
           
(package private) static float MAX_WEIGHT
           
 
Constructor Summary
RegisterAllocator(EDU.purdue.cs.bloat.cfg.FlowGraph cfg, livenessAnalysis liveness)
          Constructor.
RegisterAllocator(EDU.purdue.cs.bloat.cfg.FlowGraph cfg, livenessAnalysis liveness, java.util.Vector coloring, livenessAnalysis.IGNode[] sortedNodes)
          This constructor was added so that a specific coloring could be passed.
 
Method Summary
 EDU.purdue.cs.bloat.util.Graph getRegIG()
           
 int maxLocals()
          Returns the maximum number of local variables used by the cfg after its "registers" (local variables) have been allocated.
 EDU.purdue.cs.bloat.editor.LocalVariable newLocal(EDU.purdue.cs.bloat.editor.Type type)
          Creates a new local variable in this method (as modeled by the cfg).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cfg

EDU.purdue.cs.bloat.cfg.FlowGraph cfg

liveness

livenessAnalysis liveness

coloring

java.util.Vector coloring

colors

java.util.Map colors

colorsUsed

int colorsUsed

MAX_WEIGHT

static final float MAX_WEIGHT
See Also:
Constant Field Values

LOOP_FACTOR

static final float LOOP_FACTOR
See Also:
Constant Field Values

MAX_DEPTH

static final int MAX_DEPTH

ig

final EDU.purdue.cs.bloat.util.Graph ig
Constructor Detail

RegisterAllocator

public RegisterAllocator(EDU.purdue.cs.bloat.cfg.FlowGraph cfg,
                         livenessAnalysis liveness)
Constructor. Builds an interference graph based on the expression nodes found in liveness. Traverses the graph and determines which nodes needs to be precolored and which nodes can be coalesced (move statements). Nodes are coalesced and local variables are assigned to expressions.

See Also:
FlowGraph, LocalVariable

RegisterAllocator

public RegisterAllocator(EDU.purdue.cs.bloat.cfg.FlowGraph cfg,
                         livenessAnalysis liveness,
                         java.util.Vector coloring,
                         livenessAnalysis.IGNode[] sortedNodes)
This constructor was added so that a specific coloring could be passed. The vector coloring along with an array of sorted nodes are passed to the constructor so that the specific coloring can be assigned to the local variables.

Method Detail

getRegIG

public EDU.purdue.cs.bloat.util.Graph getRegIG()

maxLocals

public int maxLocals()
Returns the maximum number of local variables used by the cfg after its "registers" (local variables) have been allocated.


newLocal

public EDU.purdue.cs.bloat.editor.LocalVariable newLocal(EDU.purdue.cs.bloat.editor.Type type)
Creates a new local variable in this method (as modeled by the cfg). Updates the number of local variables appropriately.


SandMark version 2.1

Wed Jul 3 17:27:43 MST 2002