@Test public void getBasicIntervalReturnsAnIntervalIfOneMatches() { CompoundInterval ci = createCompoundIntervalWithoutRegister(); BasicInterval bi = ci.getBasicInterval(DEFAULT_END); assertThat(bi.getBegin(), is(DEFAULT_BEGIN)); assertThat(bi.getEnd(), is(DEFAULT_END)); }
@Test public void getBasicIntervalReturnsIntervalWithGreatestStartIfMultipleMatch() { CompoundInterval ci = new CompoundInterval(DEFAULT_BEGIN, DEFAULT_END, null); ci.add(new BasicInterval(DEFAULT_BEGIN, DEFAULT_END + 1)); BasicInterval bi = ci.getBasicInterval(DEFAULT_END); assertThat(bi.getBegin(), is(DEFAULT_BEGIN)); assertThat(bi.getEnd(), is(DEFAULT_END + 1)); }
@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)); }
@Test public void getBasicIntervalRegAllocStateReturnsIntervalWithGreatestStartIfMultipleMatch() { CompoundInterval ci = new CompoundInterval(DEFAULT_BEGIN, DEFAULT_END, null); ci.add(new BasicInterval(DEFAULT_BEGIN, DEFAULT_END + 1)); 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 + 1)); }