llvm.org GIT mirror llvm / 587f6ed
Approved by Evan: $ svn merge -c 113299 https://llvm.org/svn/llvm-project/llvm/trunk --- Merging r113299 into '.': U lib/CodeGen/VirtRegRewriter.cpp git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_28@113531 91177308-0d34-0410-b5e6-96231b3b80d8 Bill Wendling 9 years ago
1 changed file(s) with 9 addition(s) and 16 deletion(s). Raw diff Collapse all Expand all
6666 /// Note that operands may be added, so the MO reference is no longer valid.
6767 static void substitutePhysReg(MachineOperand &MO, unsigned Reg,
6868 const TargetRegisterInfo &TRI) {
69 if (unsigned SubIdx = MO.getSubReg()) {
70 // Insert the physical subreg and reset the subreg field.
71 MO.setReg(TRI.getSubReg(Reg, SubIdx));
72 MO.setSubReg(0);
73
74 // Any def, dead, and kill flags apply to the full virtual register, so they
75 // also apply to the full physical register. Add imp-def/dead and imp-kill
76 // as needed.
69 if (MO.getSubReg()) {
70 MO.substPhysReg(Reg, TRI);
71
72 // Any kill flags apply to the full virtual register, so they also apply to
73 // the full physical register.
74 // We assume that partial defs have already been decorated with a super-reg
75 // operand by LiveIntervals.
7776 MachineInstr &MI = *MO.getParent();
78 if (MO.isDef())
79 if (MO.isDead())
80 MI.addRegisterDead(Reg, &TRI, /*AddIfNotFound=*/ true);
81 else
82 MI.addRegisterDefined(Reg, &TRI);
83 else if (!MO.isUndef() &&
84 (MO.isKill() ||
85 MI.isRegTiedToDefOperand(&MO-&MI.getOperand(0))))
77 if (MO.isUse() && !MO.isUndef() &&
78 (MO.isKill() || MI.isRegTiedToDefOperand(&MO-&MI.getOperand(0))))
8679 MI.addRegisterKilled(Reg, &TRI, /*AddIfNotFound=*/ true);
8780 } else {
8881 MO.setReg(Reg);