Search in sources :

Example 6 with ControlFlowGraph

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));
}
Also used : Register(org.jikesrvm.compilers.opt.ir.Register) ControlFlowGraph(org.jikesrvm.compilers.opt.ir.ControlFlowGraph) BasicBlock(org.jikesrvm.compilers.opt.ir.BasicBlock) Test(org.junit.Test)

Example 7 with ControlFlowGraph

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));
}
Also used : Register(org.jikesrvm.compilers.opt.ir.Register) ControlFlowGraph(org.jikesrvm.compilers.opt.ir.ControlFlowGraph) BasicBlock(org.jikesrvm.compilers.opt.ir.BasicBlock) Test(org.junit.Test)

Example 8 with ControlFlowGraph

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);
}
Also used : ControlFlowGraph(org.jikesrvm.compilers.opt.ir.ControlFlowGraph) BasicBlock(org.jikesrvm.compilers.opt.ir.BasicBlock)

Aggregations

BasicBlock (org.jikesrvm.compilers.opt.ir.BasicBlock)8 ControlFlowGraph (org.jikesrvm.compilers.opt.ir.ControlFlowGraph)8 Register (org.jikesrvm.compilers.opt.ir.Register)4 Test (org.junit.Test)4 Instruction (org.jikesrvm.compilers.opt.ir.Instruction)3 ExceptionHandlerBasicBlock (org.jikesrvm.compilers.opt.ir.ExceptionHandlerBasicBlock)2 TypeReference (org.jikesrvm.classloader.TypeReference)1 InlineSequence (org.jikesrvm.compilers.opt.inlining.InlineSequence)1 GenericPhysicalRegisterSet (org.jikesrvm.compilers.opt.ir.GenericPhysicalRegisterSet)1 AddressConstantOperand (org.jikesrvm.compilers.opt.ir.operand.AddressConstantOperand)1 BranchProfileOperand (org.jikesrvm.compilers.opt.ir.operand.BranchProfileOperand)1 ClassConstantOperand (org.jikesrvm.compilers.opt.ir.operand.ClassConstantOperand)1 MethodOperand (org.jikesrvm.compilers.opt.ir.operand.MethodOperand)1 Operand (org.jikesrvm.compilers.opt.ir.operand.Operand)1 RegisterOperand (org.jikesrvm.compilers.opt.ir.operand.RegisterOperand)1 TrueGuardOperand (org.jikesrvm.compilers.opt.ir.operand.TrueGuardOperand)1 TypeOperand (org.jikesrvm.compilers.opt.ir.operand.TypeOperand)1 LiveInterval (org.jikesrvm.compilers.opt.liveness.LiveInterval)1