use of org.jikesrvm.compilers.opt.ir.ControlFlowGraph in project JikesRVM by JikesRVM.
the class CompoundIntervalTest method addRangeCreatesNewIntervalWhenThereIsAGapBetweenRanges.
@Test
public void addRangeCreatesNewIntervalWhenThereIsAGapBetweenRanges() {
Register reg = new Register(3);
CompoundInterval ci = new CompoundInterval(DEFAULT_BEGIN, DEFAULT_END, reg);
assertThat(ci.last().getEnd(), is(DEFAULT_END));
RegisterAllocatorState regAllocState = new RegisterAllocatorState(1);
LiveIntervalElement live = new LiveIntervalElement(reg, null, null);
ControlFlowGraph emptyCfg = new ControlFlowGraph(0);
BasicBlock bb = new BasicBlock(1, null, emptyCfg);
regAllocState.initializeDepthFirstNumbering(10);
regAllocState.setDFN(bb.firstInstruction(), DEFAULT_END + 2);
regAllocState.setDFN(bb.lastInstruction(), DEFAULT_END + 3);
BasicInterval bi = ci.addRange(regAllocState, live, bb);
assertThat(ci.last(), sameInstance(bi));
}
use of org.jikesrvm.compilers.opt.ir.ControlFlowGraph in project JikesRVM by JikesRVM.
the class CompoundIntervalTest method addRangeChangesEndOfLastIntervalWhenRangesDirectlyFollowEachOther_NoDefUse.
@Test
public void addRangeChangesEndOfLastIntervalWhenRangesDirectlyFollowEachOther_NoDefUse() {
Register reg = new Register(3);
CompoundInterval ci = new CompoundInterval(DEFAULT_BEGIN, DEFAULT_END, reg);
assertThat(ci.last().getEnd(), is(DEFAULT_END));
RegisterAllocatorState regAllocState = new RegisterAllocatorState(1);
LiveIntervalElement live = new LiveIntervalElement(reg, null, null);
ControlFlowGraph emptyCfg = new ControlFlowGraph(0);
BasicBlock bb = new BasicBlock(1, null, emptyCfg);
regAllocState.initializeDepthFirstNumbering(10);
regAllocState.setDFN(bb.firstInstruction(), DEFAULT_END);
regAllocState.setDFN(bb.lastInstruction(), DEFAULT_END + 1);
BasicInterval bi = ci.addRange(regAllocState, live, bb);
assertNull(bi);
assertThat(ci.last().getEnd(), is(DEFAULT_END + 1));
}
use of org.jikesrvm.compilers.opt.ir.ControlFlowGraph in project JikesRVM by JikesRVM.
the class TestingTools method addEmptyCFGToIR.
public static void addEmptyCFGToIR(IR ir) {
ir.cfg = new ControlFlowGraph(0);
BasicBlock prologue = new BasicBlock(PROLOGUE_BLOCK_BCI, null, ir.cfg);
BasicBlock epilogue = new BasicBlock(EPILOGUE_BLOCK_BCI, null, ir.cfg);
ir.cfg.addLastInCodeOrder(prologue);
ir.cfg.addLastInCodeOrder(epilogue);
BasicBlock exit = ir.cfg.exit();
epilogue.insertOut(exit);
}
Aggregations