From 6a367f33f333b09b3cad83d06ca88abcaf0c66b0 Mon Sep 17 00:00:00 2001 From: Alkis Evlogimenos Date: Tue, 9 Mar 2004 08:35:13 +0000 Subject: [PATCH] Spill explicit physical register defs as well. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12260 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/VirtRegMap.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/CodeGen/VirtRegMap.cpp b/lib/CodeGen/VirtRegMap.cpp index d2c53d5ba6f..7e8e416034c 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) {