diff options
author | Bill Wendling <isanbard@gmail.com> | 2010-09-09 20:13:48 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2010-09-09 20:13:48 +0000 |
commit | c343b4cec3a945434ddfda6e49bd7d0cc6df2157 (patch) | |
tree | c44801e84c00bf8ed1518d41fb0024f7efaa0a2f /llvm/lib | |
parent | 68d848b984f7ad0be20bcbd2b0957439a2137a39 (diff) | |
download | llvm-c343b4cec3a945434ddfda6e49bd7d0cc6df2157.zip llvm-c343b4cec3a945434ddfda6e49bd7d0cc6df2157.tar.gz llvm-c343b4cec3a945434ddfda6e49bd7d0cc6df2157.tar.bz2 |
Approved by Evan:
$ svn merge -c 113299 https://llvm.org/svn/llvm-project/llvm/trunk
--- Merging r113299 into '.':
U lib/CodeGen/VirtRegRewriter.cpp
llvm-svn: 113531
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/VirtRegRewriter.cpp | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/llvm/lib/CodeGen/VirtRegRewriter.cpp b/llvm/lib/CodeGen/VirtRegRewriter.cpp index d988e10..240d28c 100644 --- a/llvm/lib/CodeGen/VirtRegRewriter.cpp +++ b/llvm/lib/CodeGen/VirtRegRewriter.cpp @@ -67,23 +67,16 @@ VirtRegRewriter::~VirtRegRewriter() {} /// Note that operands may be added, so the MO reference is no longer valid. static void substitutePhysReg(MachineOperand &MO, unsigned Reg, const TargetRegisterInfo &TRI) { - if (unsigned SubIdx = MO.getSubReg()) { - // Insert the physical subreg and reset the subreg field. - MO.setReg(TRI.getSubReg(Reg, SubIdx)); - MO.setSubReg(0); - - // Any def, dead, and kill flags apply to the full virtual register, so they - // also apply to the full physical register. Add imp-def/dead and imp-kill - // as needed. + if (MO.getSubReg()) { + MO.substPhysReg(Reg, TRI); + + // Any kill flags apply to the full virtual register, so they also apply to + // the full physical register. + // We assume that partial defs have already been decorated with a super-reg + // <imp-def> operand by LiveIntervals. MachineInstr &MI = *MO.getParent(); - if (MO.isDef()) - if (MO.isDead()) - MI.addRegisterDead(Reg, &TRI, /*AddIfNotFound=*/ true); - else - MI.addRegisterDefined(Reg, &TRI); - else if (!MO.isUndef() && - (MO.isKill() || - MI.isRegTiedToDefOperand(&MO-&MI.getOperand(0)))) + if (MO.isUse() && !MO.isUndef() && + (MO.isKill() || MI.isRegTiedToDefOperand(&MO-&MI.getOperand(0)))) MI.addRegisterKilled(Reg, &TRI, /*AddIfNotFound=*/ true); } else { MO.setReg(Reg); |