|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object scale.common.Root scale.backend.Node scale.backend.trips2.Hyperblock
public class Hyperblock
This class represents a hyperblock which represents a predicate flow graph.
$Id: Hyperblock.java,v 1.117 2007-10-31 16:39:16 bmaher Exp $
Copyright 2008 by the
Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.
A hyperblock is a directed graph of "predicate" blocks called a predicate flow graph.
Field Summary | |
---|---|
static boolean |
doFastStoreNullification
There are two ways to nullify store instructions: (1) null t100 (2) null_t If this is set to true we do (1) which inserts a null for every store. |
static boolean |
enableInterBlockPredicateMinimization
If inter-block predicate minimization should be performed. |
static boolean |
enableIntraBlockPredicateMinimization
If intra-block predicate minimization should be performed. |
static boolean |
enableRedundantLoadRemoval
If redundant loads should be removed. |
static int |
intraBlockDefault
The default intra-block predicate minimization. |
static boolean |
noLoadStorePredicateField
True if load and store instructions do not have a predicate field. |
static int |
PREDICATE_BOTTOM
Predicate only the bottom of dependence chains. |
static int |
PREDICATE_TOP
Predicate only the top of dependence chains. |
static boolean |
unpredicateLoads
To unpredicate a load it cannot share a LSID with another load. |
static boolean |
useMinMaxLoadStoreAssignment
If true, loads are given a unique LSID and stores are given the minimal number of LSIDs. |
Fields inherited from class scale.backend.Node |
---|
color, label, predecessors, successors, tag |
Constructor Summary | |
---|---|
Hyperblock(Instruction first,
Trips2RegisterSet registers)
Construct a new hyperblock starting with the given instruction. |
|
Hyperblock(PredicateBlock start,
BitVect predicates,
Trips2RegisterSet registers)
Construct a new hyperblock from a PredicateBlock. |
|
Hyperblock(PredicateBlock start,
Trips2RegisterSet registers)
Construct a new hyperblock from a PredicateBlock. |
Method Summary | |
---|---|
void |
addSpill(PredicateBlock block,
Instruction inst)
Add a spill to the hyperblock. |
void |
analyzeLeaveSSA()
Update the block statistics before leaving SSA form. |
void |
assignBranchIds(boolean verbose)
Assign branch identifiers. |
protected void |
assignLoadStoreQueueIds()
Assign load/store queue ids and nullify stores. |
void |
clearPredicates()
Clear the predicates used in this hyperblock. |
static void |
computeHyperblockFlowGraph(Vector<Hyperblock> hbs,
HashMap<Instruction,Hyperblock> entries)
Compute the hyperblock flow graph. |
IntMap<Vector<java.lang.Integer>> |
computeTargets(Stack<Node> wl,
BitVect mov3)
Compute the number of targets for each instruction. |
Hyperblock |
copy()
Copy the hyperblock. |
void |
determinePredicatesBranches()
Compute the set of predicates and number of branches. |
static void |
dumpHyperblockFlowGraph(Hyperblock hbStart)
Output the hyperblock flow graph for debugging. |
void |
dumpPredicateFlowGraph()
Output the predicate flow graph for debugging. |
static Hyperblock |
enterHyperblockFlowGraph(Instruction first,
Trips2Generator gen)
|
void |
enterSSA()
Convert the PFG into SSA form. |
void |
findLastBlock()
Find the last block in the PFG. |
java.lang.String |
getBlockName()
Returns the name of the block, as seen in the TIL. |
int |
getBlockSize()
Return the size of the instructions in the block (not including fanout). |
double |
getBranchProbability(Hyperblock succ)
Return the probability of branching to the specified hyperblock. |
DColor |
getDisplayColorHint()
Return a String specifying the color to use for coloring this node in a graphical display. |
java.lang.String |
getDisplayLabel()
Return a String suitable for labeling this node in a graphical display. |
java.lang.String |
getDisplayName()
Return the unique node label. |
DShape |
getDisplayShapeHint()
Return a String specifying a shape to use when drawing this node in a graphical display. |
DominanceFrontier |
getDominanceFrontier()
Return the dominance frontier information for the PFG. |
Domination |
getDomination()
Return the dominator information for the PFG. |
int |
getFanout()
Return the estimated fanout for the block. |
PredicateBlock |
getFirstBlock()
Return the first block in the PFG. |
PredicateBlock |
getLastBlock()
Return the last block in the PFG. |
BitVect |
getLiveIn()
Return the registers live-in to (and used in) the hyperblock |
BitVect |
getLiveOut()
Return the registers live-out of (and define by) the hyperblock |
int |
getLoopNumber()
|
Vector<PredicateBlock> |
getNextPFGLevel(Vector<PredicateBlock> wl)
Given a set of PFG nodes that are the same depth from the root node, this routine will return the PFG nodes which are one level deeper. |
BitVect |
getPredicates()
Get the predicates for the hyperblock. |
int |
getSpillSize()
Return the estimated size of the spills in the block. |
SSA |
getSSA()
Return the ssa instance for this hyperblock. |
boolean |
hasBranchTo(Hyperblock s)
Return true if there is a branch to the specified hyperblock. |
boolean |
hasCall()
Return true if this hyperblock contains a function call. |
boolean |
hasCallTo(Hyperblock s)
Return true if there is a call to the specified hyperblock. |
boolean |
hasDummyStores()
Return true if the block contains stores inserted for nullification. |
boolean |
hasSwitch()
Return true if this hyperblock contains a switch statement. |
boolean |
inSSA()
Return true if the hyperblock is in SSA form. |
static int |
instructionsMerged()
Return the number of instructions merged. |
protected boolean |
interBlockPredicateMinimization(DataflowAnalysis df)
Perform inter-block predicate minimization. |
void |
invalidateDomination()
Clear the dominator information for the PFG. |
boolean |
isLegalBlock(boolean beforeRegisterAllocation)
Return true if this is a well formed TRIPS block. |
boolean |
isPredicate(int reg)
Return true if the register is used as a predicate. |
boolean |
isSimpleLoop()
Return true if this hyperblock contains a back-edge to itself. |
static Instruction |
leaveHyperblockFlowGraph(Hyperblock hbStart,
Trips2Generator gen)
Convert a function in hyperblock form to straight-line form. |
void |
leaveSSA(boolean removeReadWrite)
Convert the hyperblock out of SSA form. |
static int |
loadsRemoved()
Return the number of loads which were removed. |
int |
maxLSID()
Return the highest assigned load/store ID in the block. |
protected void |
mergeInstructions(boolean includeBranches)
Merge instructions. |
void |
nextVisit()
The next unique color for traversing the graph. |
protected void |
noLoadStorePredicateField()
If load and store instructions cannot be predicated this method ensures that atleast one of the instructions in the dependence chain is predicated. |
static int |
nullWritesInserted()
Return the number of nulls inserted. |
int |
numBranches()
Return the number of branches in the block. |
int |
numSpills()
Return the number of spill instructions in the block. |
void |
optimize(boolean removeLoads,
DataflowAnalysis df)
Optimize a hyperblock. |
static int |
predicatesCombined()
Return the number of predicates combined. |
void |
propagateCopies()
Perform copy propagation in SSA. |
void |
removeDeadPredicateBlocks()
Remove dead predicate blocks. |
void |
removePredicates()
Remove predicates from a hyperblock. |
void |
removeRedundantLoads()
Remove redundant loads within a predicate block. |
protected void |
removeSpillCode()
Remove spill code from a hyperblock. |
void |
setBranchProbability(Hyperblock succ,
double prob)
Set the probability of branching to the specified hyperblock. |
void |
setBranchProbability(Instruction succ,
double prob)
Set the probability of branching to the specified hyperblock. |
void |
setLiveIn(BitVect in)
Update the registers live-in and used by the hyperblock |
void |
setLiveOut(BitVect out)
Update the registers live-out and defined by the hyperblock. |
protected void |
setLoopNumber(int loopNumber)
|
void |
setPredicate(int reg)
Set that a register is used as a predicate. |
void |
setVisited()
Mark that the block has been visited. |
java.lang.String |
toString()
Returns a description of the block. |
void |
updateFanout(int fanout)
Update the fanout. |
void |
updateLastBlock()
Find the last block in the PFG or create one if its missing. |
static int |
valueNumberCount()
Return the number of instructions value numbering removed. |
boolean |
visited()
Return true if the block has been visited. |
static void |
writeDotFlowGraph(Hyperblock hbStart,
java.lang.String filename)
Write a dot file that shows the hyperblock flow graph. |
Methods inherited from class scale.backend.Node |
---|
addInEdge, addOutEdge, deleteInEdge, deleteOutEdge, getInEdge, getInEdges, getLabel, getOutEdge, getOutEdges, getTag, indexOfInEdge, indexOfOutEdge, numInEdges, numOutEdges, pushInEdges, pushInEdges, pushOutEdges, pushOutEdges, replaceInEdge, replaceOutEdge, setLabel, setTag, unlink |
Methods inherited from class scale.common.Root |
---|
addAnnotation, allAnnotations, allMatchingAnnotations, getAnnotation, getDisplayString, getNodeCount, getNodeID, hasAnnotation, hasEqualAnnotation, hashCode, removeAnnotation, removeAnnotations, toStringAnnotations, toStringClass, toStringSpecial, trace, trace, trace |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static boolean enableInterBlockPredicateMinimization
public static boolean enableIntraBlockPredicateMinimization
public static boolean enableRedundantLoadRemoval
public static boolean doFastStoreNullification
public static boolean useMinMaxLoadStoreAssignment
public static boolean unpredicateLoads
public static boolean noLoadStorePredicateField
public static final int PREDICATE_TOP
public static final int PREDICATE_BOTTOM
public static int intraBlockDefault
Constructor Detail |
---|
public Hyperblock(Instruction first, Trips2RegisterSet registers)
first
- the first instruction in the hyperblock.registers
- the RegisterSet to use.public Hyperblock(PredicateBlock start, Trips2RegisterSet registers)
start
- the block which starts the hyperblock.registers
- the RegisterSet to use.public Hyperblock(PredicateBlock start, BitVect predicates, Trips2RegisterSet registers)
start
- the block which starts the hyperblock.end
- the block which ends the hyperblock.registers
- the RegisterSet to use.Method Detail |
---|
public static int nullWritesInserted()
public static int predicatesCombined()
public static int loadsRemoved()
public static int instructionsMerged()
public static int valueNumberCount()
public void removeDeadPredicateBlocks()
public void determinePredicatesBranches()
public final boolean hasCall()
public final boolean hasBranchTo(Hyperblock s)
public final boolean hasCallTo(Hyperblock s)
public final boolean hasSwitch()
public final double getBranchProbability(Hyperblock succ)
public final void setBranchProbability(Hyperblock succ, double prob)
public final void setBranchProbability(Instruction succ, double prob)
public final boolean isSimpleLoop()
public final BitVect getLiveIn()
public final void setLiveIn(BitVect in)
public final BitVect getLiveOut()
public final void setLiveOut(BitVect out)
public final BitVect getPredicates()
public final void clearPredicates()
public final boolean isPredicate(int reg)
public final void setPredicate(int reg)
public Hyperblock copy()
public final Vector<PredicateBlock> getNextPFGLevel(Vector<PredicateBlock> wl)
public final PredicateBlock getFirstBlock()
public final PredicateBlock getLastBlock()
public void findLastBlock()
public final void updateLastBlock()
public final DominanceFrontier getDominanceFrontier()
public final Domination getDomination()
public final void invalidateDomination()
public final void dumpPredicateFlowGraph()
public static void writeDotFlowGraph(Hyperblock hbStart, java.lang.String filename)
public java.lang.String getBlockName()
public final IntMap<Vector<java.lang.Integer>> computeTargets(Stack<Node> wl, BitVect mov3)
public boolean isLegalBlock(boolean beforeRegisterAllocation)
public final int getBlockSize()
public final int getFanout()
public final void updateFanout(int fanout)
public final int numBranches()
public final int maxLSID()
public final int numSpills()
public final int getSpillSize()
public final void addSpill(PredicateBlock block, Instruction inst)
public final boolean hasDummyStores()
protected void assignLoadStoreQueueIds()
protected void noLoadStorePredicateField()
protected void mergeInstructions(boolean includeBranches)
public void removeRedundantLoads()
public void propagateCopies()
protected boolean interBlockPredicateMinimization(DataflowAnalysis df)
public void removePredicates()
protected void removeSpillCode()
public final void assignBranchIds(boolean verbose)
public final void optimize(boolean removeLoads, DataflowAnalysis df)
public final void enterSSA()
public final void leaveSSA(boolean removeReadWrite)
removeReadWrite
- if read and write instructions should be
removed when converting out of SSA form. SSA form can only be
re-entered if read and write instructions are removed.public final void analyzeLeaveSSA()
public final boolean inSSA()
public final SSA getSSA()
public final void setVisited()
setVisited
in class Node
public final boolean visited()
visited
in class Node
public final void nextVisit()
nextVisit
in class Node
public static Hyperblock enterHyperblockFlowGraph(Instruction first, Trips2Generator gen)
public static Instruction leaveHyperblockFlowGraph(Hyperblock hbStart, Trips2Generator gen)
public static void computeHyperblockFlowGraph(Vector<Hyperblock> hbs, HashMap<Instruction,Hyperblock> entries)
public static void dumpHyperblockFlowGraph(Hyperblock hbStart)
public java.lang.String getDisplayName()
getDisplayName
in interface DisplayNode
getDisplayName
in class Root
public java.lang.String getDisplayLabel()
getDisplayLabel
in interface DisplayNode
getDisplayLabel
in class Root
public final java.lang.String toString()
toString
in class Root
public int getLoopNumber()
protected void setLoopNumber(int loopNumber)
public DColor getDisplayColorHint()
getDisplayColorHint
in interface DisplayNode
getDisplayColorHint
in class Root
DColor
public DShape getDisplayShapeHint()
getDisplayShapeHint
in interface DisplayNode
getDisplayShapeHint
in class Root
DShape
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |