|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectharpoon.Analysis.Instr.RegAlloc
harpoon.Analysis.Instr.AppelRegAlloc
public abstract class AppelRegAlloc
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 boolean |
CHECK_INV
|
protected HashSet |
dontSpillTheseDefs
|
static boolean |
PRINT_CLEANING_INFO
|
static boolean |
PRINT_DEPTH_TO_SPILL_INFO
|
static boolean |
PRINT_HEURISTIC_INFO
|
Fields inherited from class harpoon.Analysis.Instr.RegAlloc |
---|
bbFact, checked, code, DEBUG, frame, GLOBAL, LOCAL, TIME |
Constructor Summary | |
---|---|
protected |
AppelRegAlloc(Code code)
|
Method Summary | |
---|---|
protected abstract void |
addEdge(harpoon.Analysis.Instr.AppelRegAllocClasses.Node u,
harpoon.Analysis.Instr.AppelRegAllocClasses.Node v)
Introduces an edge between u and v in both the interference graph and in the neighbor lists for u and v. |
protected Iterator |
allNodes()
|
void |
appelLoopBody(SpillHeuristics.SpillHeuristic sh)
|
protected abstract void |
assignColors()
Gives the nodes a legal color assignment. |
protected abstract void |
buildInterferenceGraph()
Builds the interference graph for the code. |
protected abstract void |
checkDegreeInv()
Checks degree invariant documented in Tiger book; abstract because a variant of the algorithm breaks it on purpose. |
void |
checkDisjointInv()
|
void |
checkFreezeWorklistInv()
|
void |
checkInv()
|
protected void |
checkpointState()
Saves the current state of this for later
retrieval using resetState() . |
void |
checkPrecolored()
|
void |
checkSimplifyWorklistInv()
|
void |
checkSpillWorklistInv()
|
void |
coalesce()
|
void |
coalesce(harpoon.Analysis.Instr.AppelRegAllocClasses.Move m,
harpoon.Analysis.Instr.AppelRegAllocClasses.Node x,
harpoon.Analysis.Instr.AppelRegAllocClasses.Node y)
|
protected Temp[] |
colorToReg()
|
protected abstract boolean |
conservative(harpoon.Analysis.Instr.AppelRegAllocClasses.Node u,
harpoon.Analysis.Instr.AppelRegAllocClasses.Node v)
conservative coalescing heuristic due to Preston Briggs. |
protected abstract void |
decrementDegree(harpoon.Analysis.Instr.AppelRegAllocClasses.Node m,
harpoon.Analysis.Instr.AppelRegAllocClasses.Node n)
Updates m to account for n being removed from the interference graph. |
protected harpoon.Analysis.Instr.AppelRegAllocClasses.NodeIter |
def(Instr i)
|
protected Collection |
defCN(Instr i)
|
protected Collection<Temp> |
defCT(Instr i)
|
protected void |
enableMoves(harpoon.Analysis.Instr.AppelRegAllocClasses.Node node)
|
protected void |
enableMoves(harpoon.Analysis.Instr.AppelRegAllocClasses.NodeIter nodes)
|
protected Instr |
firstStm(BasicBlock b)
|
void |
freeze()
|
void |
generateRegAssignment()
Assigns registers in the code for this . |
protected harpoon.Analysis.Instr.AppelRegAllocClasses.Node |
getAlias(harpoon.Analysis.Instr.AppelRegAllocClasses.Node n)
|
Derivation |
getDerivation()
returns a Derivation for analyses to use on the
register-allocated code. |
protected harpoon.Analysis.Instr.AppelRegAllocClasses.Node |
getNode(int i)
|
protected void |
initializeSets()
|
protected Instr |
lastStm(BasicBlock b)
|
protected Set |
liveOut(BasicBlock b)
|
protected abstract void |
makeInitial(Temp t)
Creates node(s) for t in the interference graph. |
protected harpoon.Analysis.Instr.AppelRegAllocClasses.Node |
makePrecolored(Temp reg)
|
void |
makeWorklist()
Moves Nodes from initial to appropriate set in { spill, freeze, simplify }_worklist. |
protected SpillHeuristics.SpillHeuristic |
minimum(SpillHeuristics.SpillHeuristic[] h)
Finds the minimum cost heuristic in h . |
boolean |
moveRelated(harpoon.Analysis.Instr.AppelRegAllocClasses.Node n)
|
protected abstract List |
nodesFor(harpoon.Analysis.Instr.AppelRegAllocClasses.Web w)
Returns a List of Node mapped to by w . |
protected harpoon.Analysis.Instr.AppelRegAllocClasses.NodeIter |
nodesIter(Iterator i)
|
protected abstract void |
performFinalAssignment(Temp[] regs)
Gives each Instr in the code a register assignment. |
protected Instr |
pred(Instr i)
|
protected void |
resetState()
Restores the state of this to the state it was in
on the last call to checkpointState() . |
void |
rewriteProgram()
|
void |
simplify()
|
protected String |
spillStats(int[] stats)
|
protected String |
stateString()
|
protected Set |
tempCtoNodes(Collection temps,
Instr i)
|
protected Collection |
useCN(Instr i)
|
protected Collection<Temp> |
useCT(Instr i)
|
protected harpoon.Analysis.Instr.AppelRegAllocClasses.NodeIter |
usedef(Instr i)
|
protected harpoon.Analysis.Instr.AppelRegAllocClasses.Web |
webFor(Temp t,
Instr i)
|
protected List |
webToRegAssignment(harpoon.Analysis.Instr.AppelRegAllocClasses.Web w)
|
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, replace, resolveOutstandingTemps, rfi |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final boolean PRINT_DEPTH_TO_SPILL_INFO
public static final boolean PRINT_HEURISTIC_INFO
public static final boolean PRINT_CLEANING_INFO
public static final boolean CHECK_INV
protected HashSet dontSpillTheseDefs
Constructor Detail |
---|
protected AppelRegAlloc(Code code)
Method Detail |
---|
protected String spillStats(int[] stats)
public Derivation getDerivation()
RegAlloc
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.
this.generateRegAssignment()
has been
called.
getDerivation
in class RegAlloc
public void checkInv()
public void checkPrecolored()
public void checkDisjointInv()
protected abstract void checkDegreeInv()
u isIn (simplifyWorklist \/ freezeWorklist \/ spillWorklist ) ==> degree(u) = | adjList(u) /\ ( precolored \/ simplifyWorklist \/ freezeWorklist \/ spillWorklist ) |
public void checkSimplifyWorklistInv()
public void checkFreezeWorklistInv()
public void checkSpillWorklistInv()
public void appelLoopBody(SpillHeuristics.SpillHeuristic sh) throws harpoon.Analysis.Instr.AppelRegAlloc.CouldntFindSpillExn
harpoon.Analysis.Instr.AppelRegAlloc.CouldntFindSpillExn
protected SpillHeuristics.SpillHeuristic minimum(SpillHeuristics.SpillHeuristic[] h)
h
.
public void generateRegAssignment()
RegAlloc
this
.
this
. Values will be preserved in the code;
any live value will be stored before its assigned
register is overwritten.
SpillLoad
s and
SpillStore
s; the main RegAlloc
class will use resolveOutstandingTemps()
to replace these "fake" loads and stores with frame
specified Memory instructions.
generateRegAssignment
in class RegAlloc
RegAlloc.resolveOutstandingTemps()
protected Temp[] colorToReg()
protected List webToRegAssignment(harpoon.Analysis.Instr.AppelRegAllocClasses.Web w)
protected abstract void performFinalAssignment(Temp[] regs)
regs
- (regs[i] == n.web.temp) ==> (n in precolored && n.color = i).protected abstract void buildInterferenceGraph()
forall b : blocks in program let live = liveOut(b) forall I : instructions(b) in reverse order if isMoveInstruction(I) then live <- live \ use(I) forall n : def(I) \/ use(I) moveList[n] <- moveList[n] \/ I worklistMoves <- worklistMoves \/ { I } live <- live \/ def(I) forall d : def(I) forall l : live AddEdge(l, d) live <- use(I) \/ ( live \ def(I) )
protected Instr lastStm(BasicBlock b)
protected Instr firstStm(BasicBlock b)
protected Instr pred(Instr i)
protected Collection<Temp> useCT(Instr i)
protected Collection<Temp> defCT(Instr i)
protected harpoon.Analysis.Instr.AppelRegAllocClasses.NodeIter nodesIter(Iterator i)
protected abstract void addEdge(harpoon.Analysis.Instr.AppelRegAllocClasses.Node u, harpoon.Analysis.Instr.AppelRegAllocClasses.Node v)
public void makeWorklist()
public boolean moveRelated(harpoon.Analysis.Instr.AppelRegAllocClasses.Node n)
public void simplify()
protected abstract void decrementDegree(harpoon.Analysis.Instr.AppelRegAllocClasses.Node m, harpoon.Analysis.Instr.AppelRegAllocClasses.Node n)
protected void enableMoves(harpoon.Analysis.Instr.AppelRegAllocClasses.NodeIter nodes)
protected void enableMoves(harpoon.Analysis.Instr.AppelRegAllocClasses.Node node)
public void coalesce()
public void coalesce(harpoon.Analysis.Instr.AppelRegAllocClasses.Move m, harpoon.Analysis.Instr.AppelRegAllocClasses.Node x, harpoon.Analysis.Instr.AppelRegAllocClasses.Node y)
protected abstract boolean conservative(harpoon.Analysis.Instr.AppelRegAllocClasses.Node u, harpoon.Analysis.Instr.AppelRegAllocClasses.Node v)
protected harpoon.Analysis.Instr.AppelRegAllocClasses.Node getAlias(harpoon.Analysis.Instr.AppelRegAllocClasses.Node n)
public void freeze()
protected abstract void assignColors()
public void rewriteProgram()
protected harpoon.Analysis.Instr.AppelRegAllocClasses.Node makePrecolored(Temp reg)
protected abstract void makeInitial(Temp t)
t
in the interference graph.
Abstract because variants of the algorithm map Temps
to nodes differently.
protected void initializeSets()
protected harpoon.Analysis.Instr.AppelRegAllocClasses.NodeIter def(Instr i)
protected harpoon.Analysis.Instr.AppelRegAllocClasses.NodeIter usedef(Instr i)
protected Collection useCN(Instr i)
protected Collection defCN(Instr i)
protected Set tempCtoNodes(Collection temps, Instr i)
protected Set liveOut(BasicBlock b)
protected abstract List nodesFor(harpoon.Analysis.Instr.AppelRegAllocClasses.Web w)
w
.
Abstract because variants of the algorithm map Webs to Nodes
in different ways.
protected harpoon.Analysis.Instr.AppelRegAllocClasses.Web webFor(Temp t, Instr i)
protected void checkpointState()
this
for later
retrieval using resetState()
.
Note that this
only carries Node
and
Move
state; additional state added by subclasses
will not be checkpointed unless this method and reset state
are overridden.
protected void resetState()
this
to the state it was in
on the last call to checkpointState()
.
protected String stateString()
protected harpoon.Analysis.Instr.AppelRegAllocClasses.Node getNode(int i)
protected Iterator allNodes()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |