summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineInstr.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2008-03-03 23:57:28 +0000
committerBill Wendling <isanbard@gmail.com>2008-03-03 23:57:28 +0000
commit0e541ea7308af88d1426038c7a644eb122bd04de (patch)
tree997c71dc55f00857e10cf0c8b7e7f910a4fa274d /llvm/lib/CodeGen/MachineInstr.cpp
parente1c4f9954909dd1241f6e60eb1ad4c4b752e4e38 (diff)
downloadbcm5719-llvm-0e541ea7308af88d1426038c7a644eb122bd04de.tar.gz
bcm5719-llvm-0e541ea7308af88d1426038c7a644eb122bd04de.zip
Miscellaneous clean-ups based on Evan's feedback:
- Cleaned up how the prologue-epilogue inserter loops over the instructions. - Instead of restarting the processing of an instruction if we remove an implicit kill, just update the end iterator and make sure that the iterator isn't incremented. llvm-svn: 47870
Diffstat (limited to 'llvm/lib/CodeGen/MachineInstr.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineInstr.cpp50
1 files changed, 27 insertions, 23 deletions
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp
index b0a225831c6..600e790aad5 100644
--- a/llvm/lib/CodeGen/MachineInstr.cpp
+++ b/llvm/lib/CodeGen/MachineInstr.cpp
@@ -680,37 +680,40 @@ bool MachineInstr::addRegisterKilled(unsigned IncomingReg,
bool AddIfNotFound) {
// Go through the machine instruction's operands to eliminate any potentially
// illegal conditions. I.e., a super- and sub-register both marked "kill".
- Restart:
- for (unsigned i = 0, e = getNumOperands(); i < e; ++i) {
+ for (unsigned i = 0, e = getNumOperands(); i < e;) {
MachineOperand &MO = getOperand(i);
-
if (MO.isRegister() && MO.isUse()) {
unsigned Reg = MO.getReg();
if (!Reg || IncomingReg == Reg ||
!TargetRegisterInfo::isPhysicalRegister(Reg) ||
- !TargetRegisterInfo::isPhysicalRegister(IncomingReg))
+ !TargetRegisterInfo::isPhysicalRegister(IncomingReg)) {
+ ++i;
continue;
+ }
- if (RegInfo->isSubRegister(IncomingReg, Reg)) {
- if (MO.isKill()) {
- if (MO.isImplicit()) {
- // Remove this implicit use that marks the sub-register "kill". Let
- // the super-register take care of this information.
- RemoveOperand(i);
- goto Restart; // Instruction was modified, redo checking.
- } else {
- // The super-register is going to take care of this kill
- // information.
- MO.setIsKill(false);
- }
- }
- } else if (RegInfo->isSuperRegister(IncomingReg, Reg) && MO.isKill()) {
+ if (RegInfo->isSuperRegister(IncomingReg, Reg) && MO.isKill())
// The kill information is already handled by a super-register. Don't
// add this sub-register as a kill.
return true;
+
+ if (RegInfo->isSubRegister(IncomingReg, Reg) && MO.isKill()) {
+ if (MO.isImplicit()) {
+ // Remove this implicit use that marks the sub-register
+ // "kill". Let the super-register take care of this
+ // information.
+ RemoveOperand(i);
+ e = getNumOperands();
+ continue;
+ } else {
+ // The super-register is going to take care of this kill
+ // information.
+ MO.setIsKill(false);
+ }
}
}
+
+ ++i;
}
// If the register already exists, then make sure it or its super-register is
@@ -725,13 +728,14 @@ bool MachineInstr::addRegisterKilled(unsigned IncomingReg,
if (Reg == IncomingReg) {
MO.setIsKill();
return true;
- } else if (TargetRegisterInfo::isPhysicalRegister(Reg) &&
- TargetRegisterInfo::isPhysicalRegister(IncomingReg) &&
- RegInfo->isSuperRegister(IncomingReg, Reg) &&
- MO.isKill()) {
+ }
+
+ if (TargetRegisterInfo::isPhysicalRegister(Reg) &&
+ TargetRegisterInfo::isPhysicalRegister(IncomingReg) &&
+ RegInfo->isSuperRegister(IncomingReg, Reg) &&
+ MO.isKill())
// A super-register kill already exists.
return true;
- }
}
}
OpenPOWER on IntegriCloud