Change findRegisterUseOperand() to return operand index instead.
authorEvan Cheng <evan.cheng@apple.com>
Mon, 26 Mar 2007 22:37:45 +0000 (22:37 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Mon, 26 Mar 2007 22:37:45 +0000 (22:37 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35363 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 3351aa802103dc20df72f78377fadcf85d4d6605..f6eaac07581bbeb55f28621b2c4cafe792665aa9 100644 (file)
@@ -390,10 +390,10 @@ public:
     delete removeFromParent();
   }
 
-  /// findRegisterUseOperand() - Returns the MachineOperand that is a use of
-  /// the specific register or NULL if it is not found. It further tightening
+  /// findRegisterUseOperand() - Returns the operand index that is a use of
+  /// the specific register or -1 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);
+  int 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 8c5da0272f0908f27738e605a8b6f412ff238d26..a1e76916f1df0d2e9cc321928615845c69cdcd48 100644 (file)
@@ -170,16 +170,16 @@ 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. It further tightening
+/// the specific register or -1 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){
+int 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)
       if (!isKill || MO.isKill())
-        return &MO;
+        return i;
   }
-  return NULL;
+  return -1;
 }
   
 /// findRegisterDefOperand() - Returns the MachineOperand that is a def of