[llvm-commits] [llvm] r47492 - /llvm/trunk/lib/CodeGen/VirtRegMap.cpp
Evan Cheng
evan.cheng at apple.com
Fri Feb 22 11:22:06 PST 2008
Author: evancheng
Date: Fri Feb 22 13:22:06 2008
New Revision: 47492
URL: http://llvm.org/viewvc/llvm-project?rev=47492&view=rev
Log:
Make sure reload of implicit uses are issued before remat's.
Modified:
llvm/trunk/lib/CodeGen/VirtRegMap.cpp
Modified: llvm/trunk/lib/CodeGen/VirtRegMap.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/VirtRegMap.cpp?rev=47492&r1=47491&r2=47492&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/VirtRegMap.cpp (original)
+++ llvm/trunk/lib/CodeGen/VirtRegMap.cpp Fri Feb 22 13:22:06 2008
@@ -1040,7 +1040,7 @@
/// ReusedOperands - Keep track of operand reuse in case we need to undo
/// reuse.
ReuseInfo ReusedOperands(MI, TRI);
- // Process all of the spilled uses and all non spilled reg references.
+ SmallVector<unsigned, 4> VirtUseOps;
for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) {
MachineOperand &MO = MI.getOperand(i);
if (!MO.isRegister() || MO.getReg() == 0)
@@ -1053,9 +1053,21 @@
RegInfo->setPhysRegUsed(VirtReg);
continue;
}
-
+
+ // We want to process implicit virtual register uses first.
+ if (MO.isImplicit())
+ VirtUseOps.insert(VirtUseOps.begin(), i);
+ else
+ VirtUseOps.push_back(i);
+ }
+
+ // Process all of the spilled uses and all non spilled reg references.
+ for (unsigned j = 0, e = VirtUseOps.size(); j != e; ++j) {
+ unsigned i = VirtUseOps[j];
+ MachineOperand &MO = MI.getOperand(i);
+ unsigned VirtReg = MO.getReg();
assert(TargetRegisterInfo::isVirtualRegister(VirtReg) &&
- "Not a virtual or a physical register?");
+ "Not a virtual register?");
unsigned SubIdx = MO.getSubReg();
if (VRM.isAssignedReg(VirtReg)) {
More information about the llvm-commits
mailing list