summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2010-05-13 00:19:39 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2010-05-13 00:19:39 +0000
commit680b74941f579fb48f044f0020a673ef2ef8ac01 (patch)
treed17aa01dada7d904bc2d7880ac5a3f3099ec2ebc
parent2f736c9577748663371301278be92955af055a79 (diff)
downloadbcm5719-llvm-680b74941f579fb48f044f0020a673ef2ef8ac01.tar.gz
bcm5719-llvm-680b74941f579fb48f044f0020a673ef2ef8ac01.zip
More asserts around physreg uses
llvm-svn: 103685
-rw-r--r--llvm/lib/CodeGen/RegAllocFast.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/RegAllocFast.cpp b/llvm/lib/CodeGen/RegAllocFast.cpp
index eac8407fff3..304162a303f 100644
--- a/llvm/lib/CodeGen/RegAllocFast.cpp
+++ b/llvm/lib/CodeGen/RegAllocFast.cpp
@@ -487,7 +487,7 @@ unsigned RAFast::reloadVirtReg(MachineBasicBlock &MBB, MachineInstr *MI,
}
/// reservePhysReg - Mark PhysReg as reserved. This is very similar to
-/// defineVirtReg except the physreg is reverved instead of allocated.
+/// defineVirtReg except the physreg is reserved instead of allocated.
void RAFast::reservePhysReg(MachineBasicBlock &MBB, MachineInstr *MI,
unsigned PhysReg) {
UsedInInstr.set(PhysReg);
@@ -623,6 +623,16 @@ void RAFast::AllocateBasicBlock(MachineBasicBlock &MBB) {
if (!Reg || !TargetRegisterInfo::isPhysicalRegister(Reg) ||
ReservedRegs.test(Reg)) continue;
if (MO.isUse()) {
+#ifndef NDEBUG
+ // We are using a physreg directly. It had better not be clobbered by a
+ // virtreg.
+ assert(PhysRegState[Reg] <= regReserved && "Using clobbered physreg");
+ if (PhysRegState[Reg] == regDisabled)
+ for (const unsigned *AS = TRI->getAliasSet(Reg);
+ unsigned Alias = *AS; ++AS)
+ assert(PhysRegState[Alias] <= regReserved &&
+ "Physreg alias was clobbered");
+#endif
PhysKills.push_back(Reg); // Any clean physreg use is a kill.
UsedInInstr.set(Reg);
} else if (MO.isEarlyClobber()) {
OpenPOWER on IntegriCloud