Rename findRegisterUseOperand to findRegisterUseOperandIdx to avoid confusion.
authorEvan Cheng <evan.cheng@apple.com>
Thu, 26 Apr 2007 19:00:32 +0000 (19:00 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Thu, 26 Apr 2007 19:00:32 +0000 (19:00 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36483 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/MachineInstr.h
lib/CodeGen/LiveIntervalAnalysis.cpp
lib/CodeGen/LiveVariables.cpp
lib/CodeGen/MachineInstr.cpp
lib/CodeGen/RegisterScavenging.cpp
lib/CodeGen/VirtRegMap.cpp
lib/Target/ARM/ARMInstrInfo.cpp
lib/Target/ARM/ARMLoadStoreOptimizer.cpp

index 4f252673e776f88a9bad386615f1b8c218716fc9..a81c70e37119078fa339bcf1a47a9239bca7fa12 100644 (file)
@@ -390,10 +390,10 @@ public:
     delete removeFromParent();
   }
 
-  /// findRegisterUseOperand() - Returns the operand index that is a use of
+  /// findRegisterUseOperandIdx() - 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.
-  int findRegisterUseOperand(unsigned Reg, bool isKill = false);
+  int findRegisterUseOperandIdx(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 e936158f3e1223262c03370b18329afb01f7b71e..c542033548dabcdc46b93dc3c3993f84e3b2e8d0 100644 (file)
@@ -887,7 +887,7 @@ bool LiveIntervals::AdjustCopiesBackFrom(LiveInterval &IntA, LiveInterval &IntB,
 
   // If the source instruction was killing the source register before the
   // merge, unset the isKill marker given the live range has been extended.
-  int UIdx = ValLREndInst->findRegisterUseOperand(IntB.reg, true);
+  int UIdx = ValLREndInst->findRegisterUseOperandIdx(IntB.reg, true);
   if (UIdx != -1)
     ValLREndInst->getOperand(UIdx).unsetIsKill();
   
index 9c7f13d9b02af047050f95d7ed06d570f50f49f1..4816cc12577ed5211e57f54ef068a33c13c19474 100644 (file)
@@ -435,7 +435,8 @@ bool LiveVariables::runOnMachineFunction(MachineFunction &mf) {
                "Cannot have a live-in virtual register!");
         HandlePhysRegUse(*I, Ret);
         // Add live-out registers as implicit uses.
-        Ret->addRegOperand(*I, false, true);
+        if (Ret->findRegisterUseOperandIdx(*I) == -1)
+          Ret->addRegOperand(*I, false, true);
       }
     }
 
index a1e76916f1df0d2e9cc321928615845c69cdcd48..1c0d9cc4eb1c195d1efb270f2d6e6f5352d0b9d0 100644 (file)
@@ -169,10 +169,10 @@ bool MachineOperand::isIdenticalTo(const MachineOperand &Other) const {
   }
 }
 
-/// findRegisterUseOperand() - Returns the MachineOperand that is a use of
+/// findRegisterUseOperandIdx() - Returns the MachineOperand 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.
-int MachineInstr::findRegisterUseOperand(unsigned Reg, bool isKill){
+int MachineInstr::findRegisterUseOperandIdx(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)
index 13a361991959d717419b12df073538a0ab0f9592..93c63bf1acaa158d291e25f23ea2ad41ee40d82d 100644 (file)
@@ -235,7 +235,7 @@ static unsigned calcDistanceToUse(MachineBasicBlock *MBB,
   I = next(I);
   while (I != MBB->end()) {
     Dist++;
-    if (I->findRegisterUseOperand(Reg) != -1)
+    if (I->findRegisterUseOperandIdx(Reg) != -1)
         return Dist;
     I = next(I);    
   }
index 482e336f8719a41c1116eaf5853a2ec640c82fee..9ae38ac9013904845d2b0877e55fc6d1871561a9 100644 (file)
@@ -764,7 +764,7 @@ void LocalSpiller::RewriteMBB(MachineBasicBlock &MBB, VirtRegMap &VRM,
           // necessary.
           bool WasKill = false;
           if (SSMI) {
-            int UIdx = SSMI->findRegisterUseOperand(PhysReg, true);
+            int UIdx = SSMI->findRegisterUseOperandIdx(PhysReg, true);
             if (UIdx != -1) {
               MachineOperand &MOK = SSMI->getOperand(UIdx);
               WasKill = MOK.isKill();
@@ -849,7 +849,7 @@ void LocalSpiller::RewriteMBB(MachineBasicBlock &MBB, VirtRegMap &VRM,
         // necessary.
         bool WasKill = false;
         if (SSMI) {
-          int UIdx = SSMI->findRegisterUseOperand(PhysReg, true);
+          int UIdx = SSMI->findRegisterUseOperandIdx(PhysReg, true);
           if (UIdx != -1) {
             MachineOperand &MOK = SSMI->getOperand(UIdx);
             WasKill = MOK.isKill();
@@ -859,7 +859,7 @@ void LocalSpiller::RewriteMBB(MachineBasicBlock &MBB, VirtRegMap &VRM,
         MachineInstr *CopyMI = prior(MII);
         if (WasKill) {
           // Transfer kill to the next use.
-          int UIdx = CopyMI->findRegisterUseOperand(PhysReg);
+          int UIdx = CopyMI->findRegisterUseOperandIdx(PhysReg);
           assert(UIdx != -1);
           MachineOperand &MOU = CopyMI->getOperand(UIdx);
           MOU.setIsKill();
@@ -957,7 +957,7 @@ void LocalSpiller::RewriteMBB(MachineBasicBlock &MBB, VirtRegMap &VRM,
               // extended. Remove its kill.
               bool WasKill = false;
               if (SSMI) {
-                int UIdx = SSMI->findRegisterUseOperand(InReg, true);
+                int UIdx = SSMI->findRegisterUseOperandIdx(InReg, true);
                 if (UIdx != -1) {
                   MachineOperand &MOK = SSMI->getOperand(UIdx);
                   WasKill = MOK.isKill();
@@ -967,7 +967,7 @@ void LocalSpiller::RewriteMBB(MachineBasicBlock &MBB, VirtRegMap &VRM,
               if (NextMII != MBB.end()) {
                 // If NextMII uses InReg and the use is not a two address
                 // operand, mark it killed.
-                int UIdx = NextMII->findRegisterUseOperand(InReg);
+                int UIdx = NextMII->findRegisterUseOperandIdx(InReg);
                 if (UIdx != -1) {
                   MachineOperand &MOU = NextMII->getOperand(UIdx);
                   if (WasKill) {
index 37156c4c10fda1d30ffb4136a7d1ebd54634c109..a5ab09c993d4d58a78bf885f6fb9cb8c5b4e4b7c 100644 (file)
@@ -278,7 +278,7 @@ ARMInstrInfo::convertToThreeAddress(MachineFunction::iterator &MFI,
         for (unsigned j = 0; j < 2; ++j) {
           // Look at the two new MI's in reverse order.
           MachineInstr *NewMI = NewMIs[j];
-          int NIdx = NewMI->findRegisterUseOperand(Reg);
+          int NIdx = NewMI->findRegisterUseOperandIdx(Reg);
           if (NIdx == -1)
             continue;
           LV.addVirtualRegisterKilled(Reg, NewMI);
index 6dee9c619865cf8af5a8d82b9691cce472cb96fe..3f8f35016d19d8632399c6966a8ec8d56cbedb55 100644 (file)
@@ -221,7 +221,7 @@ ARMLoadStoreOpt::MergeLDR_STR(MachineBasicBlock &MBB, unsigned SIndex,
     }
   }
 
-  bool BaseKill = Loc->findRegisterUseOperand(Base, true) != -1;
+  bool BaseKill = Loc->findRegisterUseOperandIdx(Base, true) != -1;
   if (mergeOps(MBB, ++Loc, SOffset, Base, BaseKill, Opcode,Scratch,Regs, TII)) {
     Merges.push_back(prior(Loc));
     for (unsigned i = SIndex, e = MemOps.size(); i != e; ++i) {