harpoon.Analysis.Instr
Class GraphColoringRegAlloc

java.lang.Object
  extended by harpoon.Analysis.Instr.RegAlloc
      extended by harpoon.Analysis.Instr.GraphColoringRegAlloc

public class GraphColoringRegAlloc
extends RegAlloc

GraphColoringRegAlloc uses graph coloring heuristics to find a register assignment for a Code.

Version:
$Id: GraphColoringRegAlloc.java,v 1.6 2004/02/08 03:19:37 cananian Exp $
Author:
Felix S. Klock II <pnkfelix@mit.edu>

Nested Class Summary
 
Nested classes/interfaces inherited from class harpoon.Analysis.Instr.RegAlloc
RegAlloc.Factory, RegAlloc.IntermediateCode, RegAlloc.IntermediateCodeFactory, RegAlloc.RestoreProxy, RegAlloc.SpillLoad, RegAlloc.SpillProxy, RegAlloc.SpillStore
 
Field Summary
static RegAlloc.Factory FACTORY
           
 
Fields inherited from class harpoon.Analysis.Instr.RegAlloc
bbFact, checked, code, DEBUG, frame, GLOBAL, LOCAL
 
Constructor Summary
GraphColoringRegAlloc(Code code, GraphColorer gc)
          Creates a GraphColoringRegAlloc, assigning `gc' as its graph coloring strategy and using a overly conservative move coalescing strategy.
GraphColoringRegAlloc(Code code, GraphColorer gc, boolean aggressiveCoalesce)
          Creates a GraphColoringRegAlloc, assigning `gc' as its graph coloring strategy.
 
Method Summary
protected  void generateRegAssignment()
          Assigns registers in the code for this.
protected  Derivation getDerivation()
          returns a Derivation for analyses to use on the register-allocated code.
static Map printGraph(ColorableGraph graph, boolean PRINT)
          returns nodeToNum.
protected  void replace(Instr orig, Instr repl)
          replaces 'orig' with 'repl', and modifies internal data structures to reflect that replacement as necessary.
 
Methods inherited from class harpoon.Analysis.Instr.RegAlloc
abstractSpillFactory, abstractSpillFactory, allRegs, back, codeFactory, codeFactory, computeBasicBlocks, concreteSpillFactory, expand, fixupSpillCode, getBack, getGrapherFor, getUseDeferFor, hasRegister, isRegister, lastUse, reachableInstrs, resolveOutstandingTemps, rfi
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FACTORY

public static RegAlloc.Factory FACTORY
Constructor Detail

GraphColoringRegAlloc

public GraphColoringRegAlloc(Code code,
                             GraphColorer gc)
Creates a GraphColoringRegAlloc, assigning `gc' as its graph coloring strategy and using a overly conservative move coalescing strategy.


GraphColoringRegAlloc

public GraphColoringRegAlloc(Code code,
                             GraphColorer gc,
                             boolean aggressiveCoalesce)
Creates a GraphColoringRegAlloc, assigning `gc' as its graph coloring strategy. If aggressiveCoalesce is true, will choose to coalesce moves in the face of increased memory traffic.

Method Detail

replace

protected void replace(Instr orig,
                       Instr repl)
Description copied from class: RegAlloc
replaces 'orig' with 'repl', and modifies internal data structures to reflect that replacement as necessary.

Overrides:
replace in class RegAlloc

getDerivation

protected Derivation getDerivation()
Description copied from class: RegAlloc
returns a Derivation for analyses to use on the register-allocated code. This allows for register allocation routines to make transformations on the code and still allow Derivation information to propagate to later analyses.
requires: this.generateRegAssignment() has been called.

Specified by:
getDerivation in class RegAlloc

generateRegAssignment

protected void generateRegAssignment()
Description copied from class: RegAlloc
Assigns registers in the code for this.
effects: Partially or completely allocates registers for the values defined and used in the code for this. Values will be preserved in the code; any live value will be stored before its assigned register is overwritten.
Loads and Stores in general are added in the form of SpillLoads and SpillStores; the main RegAlloc class will use resolveOutstandingTemps() to replace these "fake" loads and stores with frame specified Memory instructions.

Specified by:
generateRegAssignment in class RegAlloc
See Also:
RegAlloc.resolveOutstandingTemps()

printGraph

public static Map printGraph(ColorableGraph graph,
                             boolean PRINT)
returns nodeToNum.