aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/VirtRegMap.cpp
diff options
context:
space:
mode:
authorAlkis Evlogimenos <alkis@evlogimenos.com>2004-03-09 08:35:13 +0000
committerAlkis Evlogimenos <alkis@evlogimenos.com>2004-03-09 08:35:13 +0000
commit6a367f33f333b09b3cad83d06ca88abcaf0c66b0 (patch)
treeb8cc245e6e342ac336ffd574eb9cd7c3dad19a1e /lib/CodeGen/VirtRegMap.cpp
parent73716d582e30f15a7e9ffda2c9c3f8378ef7f930 (diff)
Spill explicit physical register defs as well.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12260 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/VirtRegMap.cpp')
-rw-r--r--lib/CodeGen/VirtRegMap.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/CodeGen/VirtRegMap.cpp b/lib/CodeGen/VirtRegMap.cpp
index d2c53d5ba6..7e8e416034 100644
--- a/lib/CodeGen/VirtRegMap.cpp
+++ b/lib/CodeGen/VirtRegMap.cpp
@@ -283,8 +283,8 @@ namespace {
// the value of the spilled virtual register
VirtRegMap::MI2VirtMap::const_iterator i, e;
for (tie(i, e) = vrm_->getFoldedVirts(mii); i != e; ++i) {
- unsigned physReg = vrm_->getPhys(i->second);
- if (physReg) vacateJustPhysReg(mbb, mii, physReg);
+ if (vrm_->hasPhys(i->second))
+ vacateJustPhysReg(mbb, mii, vrm_->getPhys(i->second));
}
// rewrite all used operands
@@ -304,11 +304,19 @@ namespace {
}
}
- // spill implicit defs
+ // spill implicit physical register defs
const TargetInstrDescriptor& tid = tii_->get(mii->getOpcode());
for (const unsigned* id = tid.ImplicitDefs; *id; ++id)
vacatePhysReg(mbb, mii, *id);
+ // spill explicit physical register defs
+ for (unsigned i = 0, e = mii->getNumOperands(); i != e; ++i) {
+ MachineOperand& op = mii->getOperand(i);
+ if (op.isRegister() && op.getReg() && !op.isUse() &&
+ MRegisterInfo::isPhysicalRegister(op.getReg()))
+ vacatePhysReg(mbb, mii, op.getReg());
+ }
+
// rewrite def operands (def&use was handled with the
// uses so don't check for those here)
for (unsigned i = 0, e = mii->getNumOperands(); i != e; ++i) {