use of org.jikesrvm.compilers.opt.regalloc.LiveIntervalElement in project JikesRVM by JikesRVM.
the class LiveIntervalEnumeration method nextElement.
@Override
public LiveIntervalElement nextElement() {
LiveIntervalElement result = currentElement;
currentElement = currentElement.getNext();
return result;
}
use of org.jikesrvm.compilers.opt.regalloc.LiveIntervalElement in project JikesRVM by JikesRVM.
the class RegisterRestrictions method addArchRestrictions.
@Override
public void addArchRestrictions(BasicBlock bb, ArrayList<LiveIntervalElement> symbolics) {
// the code in MIRSplitRanges.
for (Enumeration<Instruction> ie = bb.forwardInstrEnumerator(); ie.hasMoreElements(); ) {
Instruction s = ie.nextElement();
if (s.isPEI() && s.operator() != IR_PROLOGUE) {
if (bb.hasApplicableExceptionalOut(s) || !SCRATCH_IN_PEI) {
for (Enumeration<Operand> e = s.getOperands(); e.hasMoreElements(); ) {
Operand op = e.nextElement();
if (op != null && op.isRegister()) {
noteMustNotSpill(op.asRegister().getRegister());
handle8BitRestrictions(s);
}
}
}
}
// handle special cases
switch(s.getOpcode()) {
case MIR_LOWTABLESWITCH_opcode:
{
RegisterOperand op = MIR_LowTableSwitch.getMethodStart(s);
noteMustNotSpill(op.getRegister());
op = MIR_LowTableSwitch.getIndex(s);
noteMustNotSpill(op.getRegister());
}
break;
case IA32_MOVZX__B_opcode:
case IA32_MOVSX__B_opcode:
case IA32_MOVZXQ__B_opcode:
case IA32_MOVSXQ__B_opcode:
{
if (MIR_Unary.getVal(s).isRegister()) {
RegisterOperand val = MIR_Unary.getVal(s).asRegister();
restrictTo8Bits(val.getRegister());
}
}
break;
case IA32_SET__B_opcode:
{
if (MIR_Set.getResult(s).isRegister()) {
RegisterOperand op = MIR_Set.getResult(s).asRegister();
restrictTo8Bits(op.getRegister());
}
}
break;
default:
handle8BitRestrictions(s);
break;
}
}
for (Enumeration<Instruction> ie = bb.forwardInstrEnumerator(); ie.hasMoreElements(); ) {
Instruction s = ie.nextElement();
if (s.operator() == IA32_FNINIT) {
// No floating point register survives across an FNINIT
for (LiveIntervalElement symb : symbolics) {
if (symb.getRegister().isFloatingPoint()) {
if (contains(symb, regAllocState.getDFN(s))) {
addRestrictions(symb.getRegister(), phys.asIA32().getFPRs());
}
}
}
} else if (s.operator() == IA32_FCLEAR) {
// Only some FPRs survive across an FCLEAR
for (LiveIntervalElement symb : symbolics) {
if (symb.getRegister().isFloatingPoint()) {
if (contains(symb, regAllocState.getDFN(s))) {
int nSave = MIR_UnaryNoRes.getVal(s).asIntConstant().value;
for (int i = nSave; i < NUM_FPRS; i++) {
addRestriction(symb.getRegister(), phys.getFPR(i));
}
}
}
}
}
}
}
use of org.jikesrvm.compilers.opt.regalloc.LiveIntervalElement in project JikesRVM by JikesRVM.
the class LiveAnalysis method addToRegisterMap.
private void addToRegisterMap(Register r, LiveIntervalElement i) {
int regNumber = r.getNumber();
ArrayList<LiveIntervalElement> set = registerMap[regNumber];
if (set == null) {
set = new ArrayList<LiveIntervalElement>(3);
registerMap[regNumber] = set;
}
set.add(i);
}
use of org.jikesrvm.compilers.opt.regalloc.LiveIntervalElement in project JikesRVM by JikesRVM.
the class LiveAnalysis method computeRegisterMap.
/**
* Sets up a mapping from each register to the set of live intervals for
* the register.
* <p>
* Side effect: map each live interval element to its basic block.
*
* @param ir the governing IR
*/
@SuppressWarnings("unchecked")
private void computeRegisterMap(IR ir) {
registerMap = new ArrayList[ir.regpool.getNumberOfSymbolicRegisters()];
for (Enumeration<BasicBlock> e = ir.getBasicBlocks(); e.hasMoreElements(); ) {
BasicBlock bb = e.nextElement();
for (Enumeration<LiveIntervalElement> i = liveIntervals.enumerateLiveIntervals(bb); i.hasMoreElements(); ) {
LiveIntervalElement lie = i.nextElement();
lie.setBasicBlock(bb);
if (lie.getRegister().isSymbolic()) {
addToRegisterMap(lie.getRegister(), lie);
}
}
}
}
use of org.jikesrvm.compilers.opt.regalloc.LiveIntervalElement in project JikesRVM by JikesRVM.
the class LiveInterval method createEndLiveRange.
/**
* This method checks if an existing unresolved live interval node, i.e.,
* one that has an end instruction, but no beginning instruction, is present
* for the register and basic block passed. If one does not exist, it
* creates a node with the end instruction being <code>inst</code>. If one
* already exists no action is taken.
*
* @param reg The register
* @param block The basic block
* @param inst The end instruction to use, if we have to create a neode.
*/
public void createEndLiveRange(Register reg, BasicBlock block, Instruction inst) {
if (DEBUG) {
System.out.println("Marking Register " + reg + "'s live range as ENDing at instruction\n " + inst + " in block #" + block.getNumber());
printLiveIntervalList(block);
}
if (!containsUnresolvedElement(block, reg)) {
LiveIntervalElement elem = new LiveIntervalElement(reg, null, inst);
prependLiveIntervalElement(block, elem);
}
}
Aggregations