use of org.jikesrvm.compilers.opt.ir.BasicBlock in project JikesRVM by JikesRVM.
the class YieldPoints method perform.
/**
* Insert yield points in method prologues, loop heads, and method exits
*/
@Override
public final void perform(IR ir) {
if (!ir.method.isInterruptible()) {
// don't insert yieldpoints in Uninterruptible code.
return;
}
// (1) Insert prologue yieldpoint unconditionally.
// As part of prologue/epilogue insertion we'll remove
// the yieldpoints in trivial methods that otherwise wouldn't need
// a stackframe.
prependYield(ir.cfg.entry(), YIELDPOINT_PROLOGUE, 0, ir.getGc().getInlineSequence());
// (2) If using epilogue yieldpoints scan basic blocks, looking for returns or throws
if (VM.UseEpilogueYieldPoints) {
for (Enumeration<BasicBlock> e = ir.getBasicBlocks(); e.hasMoreElements(); ) {
BasicBlock block = e.nextElement();
if (block.hasReturn() || block.hasAthrowInst()) {
prependYield(block, YIELDPOINT_EPILOGUE, INSTRUMENTATION_BCI, ir.getGc().getInlineSequence());
}
}
}
// (3) Insert yieldpoints in loop heads based on the LST.
LSTGraph lst = ir.HIRInfo.loopStructureTree;
if (lst != null) {
for (java.util.Enumeration<LSTNode> e = lst.getRoot().getChildren(); e.hasMoreElements(); ) {
processLoopNest(e.nextElement());
}
}
}
use of org.jikesrvm.compilers.opt.ir.BasicBlock in project JikesRVM by JikesRVM.
the class DepGraph method computeHandlerLiveSet.
/**
* Determine the set of variables live on entry to any handler
* block that is reachable from currentBlock
*/
private void computeHandlerLiveSet() {
if (ir.getHandlerLivenessComputed() && currentBlock.hasExceptionHandlers()) {
Enumeration<BasicBlock> e = currentBlock.getExceptionalOut();
while (e.hasMoreElements()) {
ExceptionHandlerBasicBlock handlerBlock = (ExceptionHandlerBasicBlock) e.nextElement();
handlerLiveSet.add(handlerBlock.getLiveSet());
}
}
}
use of org.jikesrvm.compilers.opt.ir.BasicBlock in project JikesRVM by JikesRVM.
the class DepGraphStats method printBasicBlockStatistics.
/**
* Print the dependence graph stats for all basic blocks in an IR.
* @param ir the IR
*/
public static void printBasicBlockStatistics(IR ir) {
final boolean DEBUG = false;
System.out.println();
System.out.println("**** START OF printBasicBlockStatistics() for method " + ir.method + " ****");
if (DEBUG) {
ir.printInstructions();
}
// Performing live analysis may reduce dependences between PEIs and stores
if (ir.options.L2M_HANDLER_LIVENESS) {
new LiveAnalysis(false, false, true).perform(ir);
}
for (BasicBlock bb = ir.firstBasicBlockInCodeOrder(); bb != null; bb = bb.nextBasicBlockInCodeOrder()) {
// DepGraph dg =
new DepGraph(ir, bb.firstRealInstruction(), bb.lastRealInstruction(), bb);
}
System.out.println("**** END OF printBasicBlockStatistics() ****");
}
use of org.jikesrvm.compilers.opt.ir.BasicBlock in project JikesRVM by JikesRVM.
the class LTDominators method LINK.
/**
* Adds edge (block1, block2) to the forest maintained as an auxiliary
* data structure. This implementation uses path compression and
* results in a O(e * alpha(e,n)) complexity, where e is the number of
* edges in the CFG and n is the number of nodes.
*
* @param block1 a basic block corresponding to the source of the new edge
* @param block2 a basic block corresponding to the source of the new edge
*/
private void LINK(BasicBlock block1, BasicBlock block2) {
if (DEBUG) {
System.out.println(" Linking " + block1 + " with " + block2);
}
BasicBlock s = block2;
while (getSemi(getLabel(block2)) < getSemi(getLabel(getChild(s)))) {
if (getSize(s) + getSize(getChild(getChild(s))) >= 2 * getSize(getChild(s))) {
LTDominatorInfo.getInfo(getChild(s), ir).setAncestor(s);
LTDominatorInfo.getInfo(s, ir).setChild(getChild(getChild(s)));
} else {
LTDominatorInfo.getInfo(getChild(s), ir).setSize(getSize(s));
LTDominatorInfo.getInfo(s, ir).setAncestor(getChild(s));
s = getChild(s);
}
}
LTDominatorInfo.getInfo(s, ir).setLabel(getLabel(block2));
LTDominatorInfo.getInfo(block1, ir).setSize(getSize(block1) + getSize(block2));
if (getSize(block1) < 2 * getSize(block2)) {
BasicBlock tmp = s;
s = getChild(block1);
LTDominatorInfo.getInfo(block1, ir).setChild(tmp);
}
while (s != null) {
LTDominatorInfo.getInfo(s, ir).setAncestor(block1);
s = getChild(s);
}
if (DEBUG) {
System.out.println(" .... done");
}
}
use of org.jikesrvm.compilers.opt.ir.BasicBlock in project JikesRVM by JikesRVM.
the class LTDominators method printDFSNumbers.
/**
* Print the result of the DFS numbering performed in Step 1
*/
private void printDFSNumbers() {
for (Enumeration<BasicBlock> bbEnum = cfg.basicBlocks(); bbEnum.hasMoreElements(); ) {
BasicBlock block = bbEnum.nextElement();
// We don't compute a result for the exit node for forward direction
if (forward && block.isExit()) {
continue;
}
LTDominatorInfo info = ir.getLtDominators().getInfo(block);
System.out.println(" " + block + " " + info);
}
// has number 1
for (int i = 1; i <= DFSCounter; i++) {
System.out.println(" Vertex: " + i + " " + vertex[i]);
}
}
Aggregations