final class NormalBURS extends BURS
DepGraph
,
BURS_StateCoder
,
AbstractBURS_TreeNode
Modifier and Type | Field and Description |
---|---|
private AbstractBURS_TreeNode[] |
heap
A priority queue of ready tree nodes.
|
private int |
numElements |
private int |
numProblemEdges
Number of problem edges
|
private int |
numTreeRoots |
private SpaceEffGraphEdge[] |
problemEdges
track problem nodes (nodes with outgoing non-reg-true edges)
|
private AbstractBURS_TreeNode[] |
treeRoots
Set of all tree roots.
|
AddressConstant, BranchTarget, DEBUG, ir, lastInstr, LongConstant, NullTreeNode, Register
Constructor and Description |
---|
NormalBURS(IR ir)
Create a BURS object for the given IR.
|
Modifier and Type | Method and Description |
---|---|
private void |
buildTrees(DepGraph dg)
Stage 1: Complete the expression trees and identify tree roots.
|
private NormalBURS_DepGraphNode |
castNode(SpaceEffGraphNode node) |
private void |
generateTree(AbstractBURS_TreeNode k,
BURS_StateCoder burs) |
private void |
generateTrees(BURS_StateCoder burs)
Stage 4: Visit the tree roots in topological order and
emit MIR instructions by calling BURS_StateCoder.code on each
supernode in the tree.
|
private void |
handleProblemEdges()
Stage 1c: Mark src node of some problem edges as tree roots to avoid
cyclic dependencies.
|
private boolean |
haveProblemEdges() |
private void |
heapify(int p) |
private void |
initTreeRootNode(AbstractBURS_TreeNode t,
SpaceEffGraphNode treeRoot)
Initialize nextSorted for nodes in tree rooted at t i.e.
|
void |
invoke(NormalBURS_DepGraph dg)
Build BURS trees for dependence graph dg, label the trees, and
then generate MIR instructions based on the labelling.
|
private void |
labelTrees()
Stage 3: Label the trees with their min cost cover.
|
private void |
makeTreeRoot(AbstractBURS_TreeNode n) |
private boolean |
mustBeTreeRoot(DepGraphNode n)
Checks if the given node needs to be a tree rode.
|
private void |
orderTrees(DepGraph dg)
Stage 2: Construct topological ordering of tree roots based on the
dependencies between nodes in the tree.
|
private void |
problemEdgePrep()
Stage 1b: Do bookkeeping to make it easier to identify
harmless problem edges.
|
private void |
problemEdgePrep(AbstractBURS_TreeNode n,
SpaceEffGraphNode root) |
private boolean |
reachableChild(AbstractBURS_TreeNode n,
SpaceEffGraphNode goal,
int searchnum) |
private boolean |
reachableRoot(SpaceEffGraphNode current,
SpaceEffGraphNode goal,
int searchnum) |
private void |
readySetInsert(AbstractBURS_TreeNode node) |
private boolean |
readySetNotEmpty() |
private AbstractBURS_TreeNode |
readySetRemove() |
private SpaceEffGraphNode |
regTrueParent(SpaceEffGraphNode n) |
(package private) void |
rememberAsProblemEdge(SpaceEffGraphEdge e) |
private void |
swap(int x,
int y) |
private boolean |
trueEdgeRedundant(SpaceEffGraphNode current,
SpaceEffGraphNode goal,
SpaceEffGraphNode root) |
action, append, debug, dumpTree, finalizeBlock, label, makeCoder, mark, prepareForBlock
private int numTreeRoots
private SpaceEffGraphEdge[] problemEdges
private int numProblemEdges
private AbstractBURS_TreeNode[] treeRoots
private AbstractBURS_TreeNode[] heap
private int numElements
NormalBURS(IR ir)
ir
- the IR to translate from LIR to MIR.public void invoke(NormalBURS_DepGraph dg)
dg
- the dependence graph.private NormalBURS_DepGraphNode castNode(SpaceEffGraphNode node)
private void buildTrees(DepGraph dg)
dg
- The dependence graph.private void problemEdgePrep()
private void problemEdgePrep(AbstractBURS_TreeNode n, SpaceEffGraphNode root)
private void handleProblemEdges()
private boolean trueEdgeRedundant(SpaceEffGraphNode current, SpaceEffGraphNode goal, SpaceEffGraphNode root)
private boolean reachableRoot(SpaceEffGraphNode current, SpaceEffGraphNode goal, int searchnum)
private boolean reachableChild(AbstractBURS_TreeNode n, SpaceEffGraphNode goal, int searchnum)
private void orderTrees(DepGraph dg)
dg
- The dependence graph.private void labelTrees()
private void generateTrees(BURS_StateCoder burs)
burs
- the BURS_StateCoder object.private void generateTree(AbstractBURS_TreeNode k, BURS_StateCoder burs)
private boolean mustBeTreeRoot(DepGraphNode n)
n
- the dep graph node in question.true
if node n must be a root of a BURS tree
based only on its register true dependencies.private SpaceEffGraphNode regTrueParent(SpaceEffGraphNode n)
private void initTreeRootNode(AbstractBURS_TreeNode t, SpaceEffGraphNode treeRoot)
t
- the BURS nodetreeRoot
- the dependence graph node that belongs to the BURS nodeprivate void makeTreeRoot(AbstractBURS_TreeNode n)
private void readySetInsert(AbstractBURS_TreeNode node)
private boolean readySetNotEmpty()
private AbstractBURS_TreeNode readySetRemove()
private void heapify(int p)
private void swap(int x, int y)
void rememberAsProblemEdge(SpaceEffGraphEdge e)
private boolean haveProblemEdges()