use of org.jikesrvm.compilers.opt.liveness.LiveInterval in project JikesRVM by JikesRVM.
the class GenericRegisterRestrictions method init.
/**
* Records all the register restrictions dictated by an IR.
*
* PRECONDITION: the instructions in each basic block are numbered in
* increasing order before calling this.
*
* @param ir the IR to process
*/
public final void init(IR ir) {
LiveInterval livenessInformation = ir.getLivenessInformation();
this.regAllocState = ir.MIRInfo.regAllocState;
// process each basic block
for (Enumeration<BasicBlock> e = ir.getBasicBlocks(); e.hasMoreElements(); ) {
BasicBlock b = e.nextElement();
processBlock(b, livenessInformation);
}
}
use of org.jikesrvm.compilers.opt.liveness.LiveInterval in project JikesRVM by JikesRVM.
the class IntervalAnalysis method perform.
/**
* compute live intervals for this ir
* the result is a sorted (by beginning point) set of compound
* intervals, stored in the private 'intervals' field.
*
* @param ir the ir
*/
@Override
public void perform(IR ir) {
this.ir = ir;
this.regAllocState = ir.MIRInfo.regAllocState;
ControlFlowGraph cfg = ir.cfg;
GenericPhysicalRegisterSet phys = ir.regpool.getPhysicalRegisterSet();
LinearScanState state = new LinearScanState();
ir.MIRInfo.linearScanState = state;
// create topological list and a reverse topological list
// the results are on listOfBlocks and reverseTopFirst lists
createTopAndReverseList(cfg);
// give dfn values to each instruction
assignDepthFirstNumbers(cfg);
// initialize registers
initializeRegisters();
int lastBeginSeen = -1;
// visit each basic block in the listOfBlocks list
for (BasicBlock bb = listOfBlocks; bb != null; bb = (BasicBlock) bb.nextSorted) {
// visit each live interval for this basic block
LiveInterval liveIntervals = ir.getLivenessInformation();
for (LiveIntervalElement live = liveIntervals.getFirstLiveIntervalElement(bb); live != null; live = live.getNext()) {
// begin.
if (VM.VerifyAssertions) {
int begin = regAllocState.getDfnBegin(live, bb);
VM._assert(begin >= lastBeginSeen);
lastBeginSeen = begin;
}
// skip registers which are not allocated.
if (live.getRegister().isPhysical() && !phys.isAllocatable(live.getRegister())) {
continue;
}
CompoundInterval resultingInterval = processLiveInterval(live, bb);
if (!bb.getInfrequent() && resultingInterval != null) {
resultingInterval.setFrequent();
}
}
}
// debug support
if (LinearScan.VERBOSE_DEBUG) {
VM.sysWriteln("**** start of interval dump " + ir.method + " ****");
VM.sysWrite(ir.MIRInfo.linearScanState.intervals.toString());
VM.sysWriteln("**** end of interval dump ****");
}
}
Aggregations