Search in sources :

Example 96 with Instruction

use of org.jikesrvm.compilers.opt.ir.Instruction in project JikesRVM by JikesRVM.

the class CompoundIntervalTest method addRangeChangesEndOfLastIntervalWhenRangesDirectlyFollowEachOther_DefUseSameInstruction.

@Test
public void addRangeChangesEndOfLastIntervalWhenRangesDirectlyFollowEachOther_DefUseSameInstruction() {
    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);
    Instruction empty = Empty.create(WRITE_FLOOR);
    Instruction defUse = Empty.create(WRITE_FLOOR);
    Instruction lastUse = Empty.create(WRITE_FLOOR);
    LiveIntervalElement live = new LiveIntervalElement(reg, defUse, lastUse);
    ControlFlowGraph emptyCfg = new ControlFlowGraph(0);
    BasicBlock bb = new BasicBlock(1, null, emptyCfg);
    bb.appendInstruction(empty);
    bb.appendInstruction(defUse);
    bb.appendInstruction(lastUse);
    regAllocState.initializeDepthFirstNumbering(10);
    regAllocState.setDFN(empty, DEFAULT_BEGIN);
    regAllocState.setDFN(defUse, DEFAULT_END);
    regAllocState.setDFN(lastUse, 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) Instruction(org.jikesrvm.compilers.opt.ir.Instruction) Test(org.junit.Test)

Example 97 with Instruction

use of org.jikesrvm.compilers.opt.ir.Instruction in project JikesRVM by JikesRVM.

the class CompoundIntervalTest method getBasicIntervalRegAllocStateReturnsAnIntervalIfOneMatches.

@Test
public void getBasicIntervalRegAllocStateReturnsAnIntervalIfOneMatches() {
    CompoundInterval ci = createCompoundIntervalWithoutRegister();
    RegisterAllocatorState regAllocState = new RegisterAllocatorState(1);
    regAllocState.initializeDepthFirstNumbering(20);
    Instruction writeFloor = Empty.create(WRITE_FLOOR);
    regAllocState.setDFN(writeFloor, DEFAULT_END);
    BasicInterval bi = ci.getBasicInterval(regAllocState, writeFloor);
    assertThat(bi.getBegin(), is(DEFAULT_BEGIN));
    assertThat(bi.getEnd(), is(DEFAULT_END));
}
Also used : Instruction(org.jikesrvm.compilers.opt.ir.Instruction) Test(org.junit.Test)

Example 98 with Instruction

use of org.jikesrvm.compilers.opt.ir.Instruction in project JikesRVM by JikesRVM.

the class CompoundIntervalTest method addRangeChangesEndOfLastIntervalWhenRangesDirectlyFollowEachOther_DefUse.

@Test
public void addRangeChangesEndOfLastIntervalWhenRangesDirectlyFollowEachOther_DefUse() {
    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);
    Instruction def = Empty.create(WRITE_FLOOR);
    Instruction lastUse = Empty.create(WRITE_FLOOR);
    LiveIntervalElement live = new LiveIntervalElement(reg, def, lastUse);
    ControlFlowGraph emptyCfg = new ControlFlowGraph(0);
    BasicBlock bb = new BasicBlock(1, null, emptyCfg);
    bb.appendInstruction(def);
    bb.appendInstruction(lastUse);
    regAllocState.initializeDepthFirstNumbering(10);
    regAllocState.setDFN(def, DEFAULT_END);
    regAllocState.setDFN(lastUse, 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) Instruction(org.jikesrvm.compilers.opt.ir.Instruction) Test(org.junit.Test)

Example 99 with Instruction

use of org.jikesrvm.compilers.opt.ir.Instruction in project JikesRVM by JikesRVM.

the class ScratchMapTest method endSymbolicIntervalRemovesInformationAboutScratchRegisterFromPendingMap.

@Test(expected = NullPointerException.class)
public void endSymbolicIntervalRemovesInformationAboutScratchRegisterFromPendingMap() {
    Register symb = createRegister(0);
    Register scratch = createRegister(1);
    Instruction begin = createInstruction();
    scratchMap.beginSymbolicInterval(symb, scratch, begin);
    Instruction end = createInstruction();
    scratchMap.endSymbolicInterval(symb, end);
    scratchMap.endSymbolicInterval(symb, end);
}
Also used : Register(org.jikesrvm.compilers.opt.ir.Register) Instruction(org.jikesrvm.compilers.opt.ir.Instruction) Test(org.junit.Test)

Example 100 with Instruction

use of org.jikesrvm.compilers.opt.ir.Instruction in project JikesRVM by JikesRVM.

the class ScratchMapTest method endSymbolicIntervalForNotStartedIntervalCausesNPE.

@Test(expected = NullPointerException.class)
public void endSymbolicIntervalForNotStartedIntervalCausesNPE() {
    Register symb = createRegister(0);
    Instruction inst = createInstruction();
    scratchMap.endSymbolicInterval(symb, inst);
}
Also used : Register(org.jikesrvm.compilers.opt.ir.Register) Instruction(org.jikesrvm.compilers.opt.ir.Instruction) Test(org.junit.Test)

Aggregations

Instruction (org.jikesrvm.compilers.opt.ir.Instruction)356 RegisterOperand (org.jikesrvm.compilers.opt.ir.operand.RegisterOperand)204 Operand (org.jikesrvm.compilers.opt.ir.operand.Operand)144 BasicBlock (org.jikesrvm.compilers.opt.ir.BasicBlock)117 Register (org.jikesrvm.compilers.opt.ir.Register)106 IntConstantOperand (org.jikesrvm.compilers.opt.ir.operand.IntConstantOperand)72 BranchProfileOperand (org.jikesrvm.compilers.opt.ir.operand.BranchProfileOperand)61 ConditionOperand (org.jikesrvm.compilers.opt.ir.operand.ConditionOperand)61 MethodOperand (org.jikesrvm.compilers.opt.ir.operand.MethodOperand)54 LocationOperand (org.jikesrvm.compilers.opt.ir.operand.LocationOperand)53 Test (org.junit.Test)49 TrueGuardOperand (org.jikesrvm.compilers.opt.ir.operand.TrueGuardOperand)46 TypeReference (org.jikesrvm.classloader.TypeReference)38 BranchOperand (org.jikesrvm.compilers.opt.ir.operand.BranchOperand)38 NullConstantOperand (org.jikesrvm.compilers.opt.ir.operand.NullConstantOperand)35 BasicBlockOperand (org.jikesrvm.compilers.opt.ir.operand.BasicBlockOperand)33 HeapOperand (org.jikesrvm.compilers.opt.ir.operand.HeapOperand)33 TrapCodeOperand (org.jikesrvm.compilers.opt.ir.operand.TrapCodeOperand)31 AddressConstantOperand (org.jikesrvm.compilers.opt.ir.operand.AddressConstantOperand)28 TypeOperand (org.jikesrvm.compilers.opt.ir.operand.TypeOperand)27