use of org.jikesrvm.compilers.opt.util.SpaceEffGraphEdge in project JikesRVM by JikesRVM.
the class NormalBURS method mustBeTreeRoot.
/**
* Checks if the given node needs to be a tree rode.
* If the node does not need to be a tree root right now
* but might later have to be marked as a tree
* root, then include in a set of problem nodes.
*
* @param n the dep graph node in question.
* @return {@code true} if node n must be a root of a BURS tree
* based only on its register true dependencies.
*/
private boolean mustBeTreeRoot(DepGraphNode n) {
// A "fan-out" node must be a root of a BURS tree.
// (A fan-out node is a node with > 1 outgoing register-true dependences)
SpaceEffGraphEdge trueDepEdge = null;
for (SpaceEffGraphEdge out = n.firstOutEdge(); out != null; out = out.getNextOut()) {
if (DepGraphEdge.isRegTrue(out)) {
if (trueDepEdge != null)
return true;
trueDepEdge = out;
}
}
if (trueDepEdge == null) {
// 0 outgoing register-true dependencies
return true;
} else {
// Exactly 1 true edge, since we would have bailed out of above
// loop if we'd found a second one.
// If the node produces a register value that is live on exit
// from the basic block then it must be the root of a BURS tree.
Instruction instr = n.instruction();
if (instr.operator() == IR_PROLOGUE)
return true;
RegisterOperand rop = ResultCarrier.getResult(instr);
if (rop.getRegister().spansBasicBlock())
return true;
SpaceEffGraphNode parent = trueDepEdge.toNode();
// by not forcing n to be a tree root.
for (SpaceEffGraphEdge out = n.firstOutEdge(); out != null; out = out.getNextOut()) {
if (out != trueDepEdge) {
boolean match = false;
for (SpaceEffGraphEdge out2 = parent.firstOutEdge(); out2 != null; out2 = out2.getNextOut()) {
if (out2.toNode() == out.toNode()) {
match = true;
break;
}
}
if (!match) {
// could be trouble. Remember for later processing.
rememberAsProblemEdge(out);
}
}
}
return false;
}
}
use of org.jikesrvm.compilers.opt.util.SpaceEffGraphEdge in project JikesRVM by JikesRVM.
the class BasicBlock method getNumberOfNormalOut.
/**
* Get the number of out nodes that are to "normal" basic blocks
*
* @return the number of out nodes that are not the start of
* exception handlers
*/
public final int getNumberOfNormalOut() {
int count = 0;
boolean countValid = true;
for (SpaceEffGraphEdge e = _outEdgeStart; e != null; e = e.getNextOut()) {
BasicBlock bb = (BasicBlock) e.toNode();
if (!bb.isExceptionHandlerBasicBlock()) {
count++;
} else if (bb.isExceptionHandlerWithNormalIn()) {
countValid = false;
break;
}
}
if (countValid) {
return count;
} else {
HashSet<BasicBlock> setOfTargets = new HashSet<BasicBlock>();
for (SpaceEffGraphEdge e = _outEdgeStart; e != null; e = e.getNextOut()) {
BasicBlock bb = (BasicBlock) e.toNode();
if (!bb.isExceptionHandlerBasicBlock()) {
setOfTargets.add(bb);
}
}
for (Enumeration<Instruction> e = enumerateBranchInstructions(); e.hasMoreElements(); ) {
Enumeration<BasicBlock> targets = e.nextElement().getBranchTargets();
while (targets.hasMoreElements()) {
setOfTargets.add(targets.nextElement());
}
}
return setOfTargets.size();
}
}
use of org.jikesrvm.compilers.opt.util.SpaceEffGraphEdge in project JikesRVM by JikesRVM.
the class LSTNode method getChildren.
public Enumeration<LSTNode> getChildren() {
return new Enumeration<LSTNode>() {
private SpaceEffGraphEdge _edge = _outEdgeStart;
@Override
public boolean hasMoreElements() {
return _edge != null;
}
@Override
public LSTNode nextElement() {
SpaceEffGraphEdge e = _edge;
_edge = e.getNextOut();
return (LSTNode) e.toNode();
}
};
}
Aggregations