@Override public final void perform(IR ir){
  java.util.HashMap<Register,Register> newMap=new java.util.HashMap<Register,Register>(5);
  for (Enumeration<BasicBlock> be=ir.getBasicBlocks(); be.hasMoreElements(); ) {
    BasicBlock bb=be.nextElement();
    for (Enumeration<Instruction> ie=bb.forwardInstrEnumerator(); ie.hasMoreElements(); ) {
      Instruction s=ie.nextElement();
      ;
      newMap.clear();
      if (s.isPEI() && s.operator() != IR_PROLOGUE) {
        if (bb.hasApplicableExceptionalOut(s) || !RegisterRestrictions.SCRATCH_IN_PEI) {
          splitAllLiveRanges(s,newMap,ir,false);
        }
      }
switch (s.getOpcode()) {
case MIR_LOWTABLESWITCH_opcode:
{
          RegisterOperand rOp=MIR_LowTableSwitch.getIndex(s);
          RegisterOperand temp=findOrCreateTemp(rOp,newMap,ir);
          insertMoveBefore(temp,rOp.copyRO(),s);
          rOp.setRegister(temp.getRegister());
        }
      break;
  }
}
}
}

@ Override public final void perform ( IR ir ) { java . util . HashMap < Register , Register > newMap = new java . util . HashMap < Register , Register > ( 5 ) ; for ( Enumeration < BasicBlock > be = ir . getBasicBlocks ( ) ; be . hasMoreElements ( ) ; ) { BasicBlock bb = be . nextElement ( ) ; for ( Enumeration < Instruction > ie = bb . forwardInstrEnumerator ( ) ; ie . hasMoreElements ( ) ; ) { Instruction s = ie . nextElement ( ) ; ; newMap . clear ( ) ; if ( s . isPEI ( ) && s . operator ( ) != IR_PROLOGUE ) { if ( bb . hasApplicableExceptionalOut ( s ) || ! RegisterRestrictions . SCRATCH_IN_PEI ) { splitAllLiveRanges ( s , newMap , ir , false ) ; } } switch ( s . getOpcode ( ) ) { case MIR_LOWTABLESWITCH_opcode : { RegisterOperand rOp = MIR_LowTableSwitch . getIndex ( s ) ; RegisterOperand temp = findOrCreateTemp ( rOp , newMap , ir ) ; insertMoveBefore ( temp , rOp . copyRO ( ) , s ) ; rOp . setRegister ( temp . getRegister ( ) ) ; } break ; } } } }
the main method . < p > we split live ranges for registers around peis which have catch blocks . suppose we have a pei s which uses a symbolic register r1 . we must ensure that after register allocation , r1 is not assigned to a scratch location in s , since this would mess up code in the catch block that uses r1 . < p > so , instead , we introduce a new temporary r2 which holds the value of r1 . the live range for r2 spans only the instruction s . later , we will ensure that r2 is never spilled . < p > todo : this could be implemented more efficiently .
