Lib/Target/Subst.cpp
/**
 * Globally change register tag vt to wt in given instruction
 */
Globally change register tag vt to wt in given instruction
Globally change register tag vt to wt in given instruction
void substRegTag(Instr* instr, RegTag vt, RegTag wt) {
  assert(vt != wt);  
  if (instr->has_dest()) {
    Reg tmp = instr->dest();
    if (tmp.tag == vt) {
      tmp.tag = wt;
      instr->dest(tmp);
    }
  }
  if (instr->tag == ALU) {
      if (instr->ALU.srcA.is_reg() && instr->ALU.srcA.reg().tag == vt)
        instr->ALU.srcA.reg().tag = wt;
      if (instr->ALU.srcB.is_reg() && instr->ALU.srcB.reg().tag == vt)
        instr->ALU.srcB.reg().tag = wt;
  }
}
void substRegTag ( Instr * instr , RegTag vt , RegTag wt ) { assert ( vt != wt ) ; if ( instr -> has_dest ( ) ) { Reg tmp = instr -> dest ( ) ; if ( tmp . tag == vt ) { tmp . tag = wt ; instr -> dest ( tmp ) ; } } if ( instr -> tag == ALU ) { if ( instr -> ALU . srcA . is_reg ( ) && instr -> ALU . srcA . reg ( ) . tag == vt ) instr -> ALU . srcA . reg ( ) . tag = wt ; if ( instr -> ALU . srcB . is_reg ( ) && instr -> ALU . srcB . reg ( ) . tag == vt ) instr -> ALU . srcB . reg ( ) . tag = wt ; } }
Globally change register tag vt to wt in given instruction
Globally change register tag vt to wt in given instruction
// otherwise subst is senseless