Use findRegisterUseOperand to find a kill of particular register.
authorEvan Cheng <evan.cheng@apple.com>
Fri, 23 Feb 2007 01:04:26 +0000 (01:04 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Fri, 23 Feb 2007 01:04:26 +0000 (01:04 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34512 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/MachineInstr.h
lib/CodeGen/MachineInstr.cpp

index 9cefe7bf20ce50d1aa54c54c8ec34d6f8a024f62..ef06d97ea92c2260c6ce1ca8fd93a50fc9072863 100644 (file)
@@ -390,8 +390,9 @@ public:
   }
 
   /// findRegisterUseOperand() - Returns the MachineOperand that is a use of
-  /// the specific register or NULL if it is not found.
-  MachineOperand *findRegisterUseOperand(unsigned Reg);
+  /// the specific register or NULL if it is not found. It further tightening
+  /// the search criteria to a use that kills the register if isKill is true.
+  MachineOperand *findRegisterUseOperand(unsigned Reg, bool isKill = false);
   
   /// findRegisterDefOperand() - Returns the MachineOperand that is a def of
   /// the specific register or NULL if it is not found.
index 01a3e3ee381a172d59f442dde4b6bdff3dc16b82..8c5da0272f0908f27738e605a8b6f412ff238d26 100644 (file)
@@ -170,12 +170,14 @@ bool MachineOperand::isIdenticalTo(const MachineOperand &Other) const {
 }
 
 /// findRegisterUseOperand() - Returns the MachineOperand that is a use of
-/// the specific register or NULL if it is not found.
-MachineOperand *MachineInstr::findRegisterUseOperand(unsigned Reg) {
+/// the specific register or NULL if it is not found. It further tightening
+/// the search criteria to a use that kills the register if isKill is true.
+MachineOperand *MachineInstr::findRegisterUseOperand(unsigned Reg, bool isKill){
   for (unsigned i = 0, e = getNumOperands(); i != e; ++i) {
     MachineOperand &MO = getOperand(i);
     if (MO.isReg() && MO.isUse() && MO.getReg() == Reg)
-      return &MO;
+      if (!isKill || MO.isKill())
+        return &MO;
   }
   return NULL;
 }