diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2012-02-03 21:23:14 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2012-02-03 21:23:14 +0000 |
commit | 56fe2ed51e642aa3ad57dd9e30bad414790d01b4 (patch) | |
tree | 9b3a826f5d2858a30fc86bbd1d6be0c8573f9771 /llvm/lib/CodeGen/MachineInstr.cpp | |
parent | e023d5d7f367c1ce12b492a3f576f9d4832d08a1 (diff) | |
download | bcm5719-llvm-56fe2ed51e642aa3ad57dd9e30bad414790d01b4.tar.gz bcm5719-llvm-56fe2ed51e642aa3ad57dd9e30bad414790d01b4.zip |
Handle register mask operands in setPhysRegsDeadExcept().
Calls that use register mask operands don't have implicit defs for
returned values. The register mask operand handles the call clobber,
but it always behaves like a set of dead defs.
Add live implicit defs for any implicitly defined physregs that are
actually used.
llvm-svn: 149715
Diffstat (limited to 'llvm/lib/CodeGen/MachineInstr.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineInstr.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp index 6ce01a46ed1..de2082a779b 100644 --- a/llvm/lib/CodeGen/MachineInstr.cpp +++ b/llvm/lib/CodeGen/MachineInstr.cpp @@ -1795,8 +1795,13 @@ void MachineInstr::addRegisterDefined(unsigned IncomingReg, void MachineInstr::setPhysRegsDeadExcept(ArrayRef<unsigned> UsedRegs, const TargetRegisterInfo &TRI) { + bool HasRegMask = false; for (unsigned i = 0, e = getNumOperands(); i != e; ++i) { MachineOperand &MO = getOperand(i); + if (MO.isRegMask()) { + HasRegMask = true; + continue; + } if (!MO.isReg() || !MO.isDef()) continue; unsigned Reg = MO.getReg(); if (!TargetRegisterInfo::isPhysicalRegister(Reg)) continue; @@ -1810,6 +1815,13 @@ void MachineInstr::setPhysRegsDeadExcept(ArrayRef<unsigned> UsedRegs, // If there are no uses, including partial uses, the def is dead. if (Dead) MO.setIsDead(); } + + // This is a call with a register mask operand. + // Mask clobbers are always dead, so add defs for the non-dead defines. + if (HasRegMask) + for (ArrayRef<unsigned>::iterator I = UsedRegs.begin(), E = UsedRegs.end(); + I != E; ++I) + addRegisterDefined(*I, &TRI); } unsigned |