public class DepGraph extends SpaceEffGraph
Modifier and Type | Field and Description |
---|---|
private BasicBlock |
currentBlock
The basic block we are processing
|
private DepGraphNode[] |
depGraphNodes |
private LiveSet |
handlerLiveSet
Set of variables that are live on entry to at least one catch block that
is reachable via a PEI in currentBlock.
|
private IR |
ir
The IR we are processing
|
_firstNode, _lastNode, backwardTopSorted, forwardTopSorted, numberOfNodes
Constructor and Description |
---|
DepGraph(IR ir,
Instruction start,
Instruction end,
BasicBlock currentBlock)
Constructor (computes the dependence graph!).
|
Modifier and Type | Method and Description |
---|---|
private void |
clearDepGraphNodeForRegister(Register r) |
private void |
clearRegisters(Instruction start,
Instruction end)
Initialize (clear) the dNode field in Register for all registers
in this basic block by setting them to null.
|
private void |
computeBackwardDependences(Instruction start,
Instruction end)
Computes anti dependences by doing a backwards
traversal of the instructions from start to end.
|
private void |
computeBackwardDependencesDef(Operand op,
DepGraphNode destNode,
DepGraphNode lastExceptionNode)
Compute backward dependences from a given def to a given node.
|
private void |
computeBackwardDependencesUse(Operand op,
DepGraphNode destNode,
DepGraphNode lastExceptionNode)
Compute backward dependences from a given use to a given node.
|
private void |
computeControlAndBarrierDependences(Instruction start,
Instruction end)
Compute control and barrier (acquire/release) dependences
in two passes (one forward, one reverse over the instructions
from start to end.
|
private void |
computeForwardDependences(Instruction start,
Instruction end)
Computes flow and output dependences by doing a forward
traversal of the instructions from start to end.
|
private void |
computeForwardDependencesDef(Operand op,
DepGraphNode destNode,
DepGraphNode lastExceptionNode)
Compute forward dependences from a given def to a given node.
|
private void |
computeForwardDependencesUse(Operand op,
DepGraphNode destNode,
DepGraphNode lastExceptionNode)
Compute forward dependences from a given use to a given node.
|
private void |
computeHandlerLiveSet()
Determine the set of variables live on entry to any handler
block that is reachable from currentBlock
|
private void |
computeImplicitBackwardDependencesDef(Register r,
DepGraphNode destNode)
Compute implicit backward dependences from a given register def
to a given node.
|
private void |
computeImplicitBackwardDependencesUse(Register r,
DepGraphNode destNode)
Compute implicit backward dependences from a given register use
to a given node.
|
private void |
computeImplicitForwardDependencesDef(Register r,
DepGraphNode destNode)
Compute implicit forward dependences from a given register def
to a given node.
|
private void |
computeImplicitForwardDependencesUse(Register r,
DepGraphNode destNode)
Compute implicit forward dependences from a given register use
to a given node.
|
protected DepGraphNode |
createDepGraphNode(Instruction p) |
private void |
createNodes(Instruction start,
Instruction end) |
private DepGraphNode |
getDepGraphNode(Register r) |
private LocationOperand |
getLocation(Instruction s)
Get the location of a given load or store instruction.
|
void |
printDepGraph()
Print the dependence graph to standard out.
|
private void |
setDepGraphNodeForRegister(DepGraphNode dNode,
Register r) |
addGraphEdge, addGraphEdge, addGraphNode, addRootNode, addTopSortNode, allocateNodeNumber, buildRevTopSort, buildTopSort, clearDFS, compactNodeNumbering, enumerateNodes, firstNode, initTopSort, isTopSorted, lastNode, numberOfNodes, printDepthFirst, removeGraphNode, resetTopSorted, rootNodes, setFirstNode, setLastNode, setNumberOfNodes, setTopSorted, startNode, topSort, topSortOrder, toString
private final LiveSet handlerLiveSet
private final BasicBlock currentBlock
private final DepGraphNode[] depGraphNodes
public DepGraph(IR ir, Instruction start, Instruction end, BasicBlock currentBlock)
ir
- the IR to compute the dependence graph forstart
- instruction to start computation fromend
- instruction to end computation atcurrentBlock
- the basic block that the instructions are living inprivate DepGraphNode getDepGraphNode(Register r)
private void setDepGraphNodeForRegister(DepGraphNode dNode, Register r)
private void clearDepGraphNodeForRegister(Register r)
private void computeHandlerLiveSet()
private void createNodes(Instruction start, Instruction end)
protected DepGraphNode createDepGraphNode(Instruction p)
private void computeForwardDependences(Instruction start, Instruction end)
start
- start instructionend
- end instructionprivate void computeBackwardDependences(Instruction start, Instruction end)
start
- start instructionend
- end instructionprivate void computeControlAndBarrierDependences(Instruction start, Instruction end)
start
- start instructionend
- end instructionprivate void computeForwardDependencesUse(Operand op, DepGraphNode destNode, DepGraphNode lastExceptionNode)
op
- source operanddestNode
- destination nodelastExceptionNode
- node representing the last PEIprivate void computeForwardDependencesDef(Operand op, DepGraphNode destNode, DepGraphNode lastExceptionNode)
op
- source operanddestNode
- destination nodelastExceptionNode
- node representing the last PEIprivate void computeBackwardDependencesUse(Operand op, DepGraphNode destNode, DepGraphNode lastExceptionNode)
op
- source operanddestNode
- destination nodelastExceptionNode
- node representing the last PEIprivate void computeBackwardDependencesDef(Operand op, DepGraphNode destNode, DepGraphNode lastExceptionNode)
op
- source operanddestNode
- destination nodelastExceptionNode
- node representing the last PEIprivate void computeImplicitForwardDependencesUse(Register r, DepGraphNode destNode)
r
- source registerdestNode
- destination nodeprivate void computeImplicitForwardDependencesDef(Register r, DepGraphNode destNode)
r
- source registerdestNode
- destination nodeprivate void computeImplicitBackwardDependencesUse(Register r, DepGraphNode destNode)
r
- source registerdestNode
- destination nodeprivate void computeImplicitBackwardDependencesDef(Register r, DepGraphNode destNode)
r
- source registerdestNode
- destination nodeprivate LocationOperand getLocation(Instruction s)
s
- the instruction to get the location from.null
private void clearRegisters(Instruction start, Instruction end)
start
- the first opt instruction in the regionend
- the last opt instruction in the regionpublic void printDepGraph()