[llvm-commits] [llvm] r47927 - in /llvm/trunk: include/llvm/CodeGen/ lib/CodeGen/ lib/Target/ARM/ lib/Target/X86/

Evan Cheng evan.cheng at apple.com
Tue Mar 4 16:59:57 PST 2008


Author: evancheng
Date: Tue Mar  4 18:59:57 2008
New Revision: 47927

URL: http://llvm.org/viewvc/llvm-project?rev=47927&view=rev
Log:
Refactor code. Remove duplicated functions that basically do the same thing as
findRegisterUseOperandIdx, findRegisterDefOperandIndx. Fix some naming inconsistencies.

Modified:
    llvm/trunk/include/llvm/CodeGen/LiveVariables.h
    llvm/trunk/include/llvm/CodeGen/MachineInstr.h
    llvm/trunk/include/llvm/CodeGen/RegisterScavenging.h
    llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
    llvm/trunk/lib/CodeGen/LiveVariables.cpp
    llvm/trunk/lib/CodeGen/MachineInstr.cpp
    llvm/trunk/lib/CodeGen/PHIElimination.cpp
    llvm/trunk/lib/CodeGen/RegAllocLocal.cpp
    llvm/trunk/lib/CodeGen/RegisterScavenging.cpp
    llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
    llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.h
    llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp
    llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp
    llvm/trunk/lib/CodeGen/VirtRegMap.cpp
    llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp
    llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp

Modified: llvm/trunk/include/llvm/CodeGen/LiveVariables.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveVariables.h?rev=47927&r1=47926&r2=47927&view=diff

==============================================================================
--- llvm/trunk/include/llvm/CodeGen/LiveVariables.h (original)
+++ llvm/trunk/include/llvm/CodeGen/LiveVariables.h Tue Mar  4 18:59:57 2008
@@ -130,7 +130,7 @@
 private:   // Intermediate data structures
   MachineFunction *MF;
 
-  const TargetRegisterInfo *RegInfo;
+  const TargetRegisterInfo *TRI;
 
   // PhysRegInfo - Keep track of which instruction was the last def/use of a
   // physical register. This is a purely local property, because all physical
@@ -175,18 +175,10 @@
 
   virtual bool runOnMachineFunction(MachineFunction &MF);
 
-  /// KillsRegister - Return true if the specified instruction kills the
-  /// specified register.
-  bool KillsRegister(MachineInstr *MI, unsigned Reg) const;
-  
   /// RegisterDefIsDead - Return true if the specified instruction defines the
   /// specified register, but that definition is dead.
   bool RegisterDefIsDead(MachineInstr *MI, unsigned Reg) const;
 
-  /// ModifiesRegister - Return true if the specified instruction modifies the
-  /// specified register.
-  bool ModifiesRegister(MachineInstr *MI, unsigned Reg) const;
-  
   //===--------------------------------------------------------------------===//
   //  API to update live variable information
 
@@ -202,7 +194,7 @@
   /// not found.
   void addVirtualRegisterKilled(unsigned IncomingReg, MachineInstr *MI,
                                 bool AddIfNotFound = false) {
-    if (MI->addRegisterKilled(IncomingReg, RegInfo, AddIfNotFound))
+    if (MI->addRegisterKilled(IncomingReg, TRI, AddIfNotFound))
       getVarInfo(IncomingReg).Kills.push_back(MI); 
   }
 
@@ -239,7 +231,7 @@
   /// AddIfNotFound is true, add a implicit operand if it's not found.
   void addVirtualRegisterDead(unsigned IncomingReg, MachineInstr *MI,
                               bool AddIfNotFound = false) {
-    if (MI->addRegisterDead(IncomingReg, RegInfo, AddIfNotFound))
+    if (MI->addRegisterDead(IncomingReg, TRI, AddIfNotFound))
         getVarInfo(IncomingReg).Kills.push_back(MI);
   }
 

Modified: llvm/trunk/include/llvm/CodeGen/MachineInstr.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineInstr.h?rev=47927&r1=47926&r2=47927&view=diff

==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineInstr.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineInstr.h Tue Mar  4 18:59:57 2008
@@ -138,14 +138,65 @@
   ///
   bool isDebugLabel() const;
 
+  /// readsRegister - Return true if the MachineInstr reads the specified
+  /// register. If TargetRegisterInfo is passed, then it also checks if there
+  /// is a read of a super-register.
+  bool readsRegister(unsigned Reg, const TargetRegisterInfo *TRI = NULL) const {
+    return findRegisterUseOperandIdx(Reg, false, TRI) != -1;
+  }
+
+  /// killsRegister - Return true if the MachineInstr kills the specified
+  /// register. If TargetRegisterInfo is passed, then it also checks if there is
+  /// a kill of a super-register.
+  bool killsRegister(unsigned Reg, const TargetRegisterInfo *TRI = NULL) const {
+    return findRegisterUseOperandIdx(Reg, true, TRI) != -1;
+  }
+
+  /// modifiesRegister - Return true if the MachineInstr modifies the
+  /// specified register. If TargetRegisterInfo is passed, then it also checks
+  /// if there is a def of a super-register.
+  bool modifiesRegister(unsigned Reg,
+                        const TargetRegisterInfo *TRI = NULL) const {
+    return findRegisterDefOperandIdx(Reg, false, TRI) != -1;
+  }
+
+  /// registerDefIsDead - Returns true if the register is dead in this machine
+  /// instruction. If TargetRegisterInfo is passed, then it also checks
+  /// if there is a dead def of a super-register.
+  bool registerDefIsDead(unsigned Reg,
+                         const TargetRegisterInfo *TRI = NULL) const {
+    return findRegisterDefOperandIdx(Reg, true, TRI) != -1;
+  }
+
   /// 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 findRegisterUseOperandIdx(unsigned Reg, bool isKill = false) const;
+  int findRegisterUseOperandIdx(unsigned Reg, bool isKill = false,
+                                const TargetRegisterInfo *TRI = NULL) const;
+
+  /// findRegisterUseOperand - Wrapper for findRegisterUseOperandIdx, it returns
+  /// a pointer to the MachineOperand rather than an index.
+  MachineOperand *findRegisterUseOperand(unsigned Reg,bool isKill = false,
+                                         const TargetRegisterInfo *TRI = NULL) {
+    int Idx = findRegisterUseOperandIdx(Reg, isKill, TRI);
+    return (Idx == -1) ? NULL : &getOperand(Idx);
+  }
   
-  /// findRegisterDefOperand() - Returns the MachineOperand that is a def of
-  /// the specific register or NULL if it is not found.
-  MachineOperand *findRegisterDefOperand(unsigned Reg);
+  /// findRegisterDefOperandIdx() - Returns the operand index that is a def of
+  /// the specific register or -1 if it is not found. It further tightening
+  /// the search criteria to a def that is dead the register if isDead is true.
+  /// If TargetRegisterInfo is passed, then it also checks if there is a def of
+  /// a super-register.
+  int findRegisterDefOperandIdx(unsigned Reg, bool isDead = false,
+                                const TargetRegisterInfo *TRI = NULL) const;
+
+  /// findRegisterDefOperand - Wrapper for findRegisterDefOperandIdx, it returns
+  /// a pointer to the MachineOperand rather than an index.
+  MachineOperand *findRegisterDefOperand(unsigned Reg,bool isDead = false,
+                                         const TargetRegisterInfo *TRI = NULL) {
+    int Idx = findRegisterDefOperandIdx(Reg, isDead, TRI);
+    return (Idx == -1) ? NULL : &getOperand(Idx);
+  }
 
   /// findFirstPredOperandIdx() - Find the index of the first operand in the
   /// operand list that is used to represent the predicate. It returns -1 if

Modified: llvm/trunk/include/llvm/CodeGen/RegisterScavenging.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/RegisterScavenging.h?rev=47927&r1=47926&r2=47927&view=diff

==============================================================================
--- llvm/trunk/include/llvm/CodeGen/RegisterScavenging.h (original)
+++ llvm/trunk/include/llvm/CodeGen/RegisterScavenging.h Tue Mar  4 18:59:57 2008
@@ -127,7 +127,7 @@
   }
 
 private:
-  const TargetRegisterInfo *RegInfo;
+  const TargetRegisterInfo *TRI;
   const TargetInstrInfo *TII;
 
   /// CalleeSavedrRegs - A bitvector of callee saved registers for the target.

Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=47927&r1=47926&r2=47927&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Tue Mar  4 18:59:57 2008
@@ -324,7 +324,7 @@
 
       // If this redefinition is dead, we need to add a dummy unit live
       // range covering the def slot.
-      if (lv_->RegisterDefIsDead(mi, interval.reg))
+      if (mi->registerDefIsDead(interval.reg, tri_))
         interval.addRange(LiveRange(RedefIndex, RedefIndex+1, OldValNo));
 
       DOUT << " RESULT: ";
@@ -399,7 +399,7 @@
   // If it is not used after definition, it is considered dead at
   // the instruction defining it. Hence its interval is:
   // [defSlot(def), defSlot(def)+1)
-  if (lv_->RegisterDefIsDead(mi, interval.reg)) {
+  if (mi->registerDefIsDead(interval.reg, tri_)) {
     DOUT << " dead";
     end = getDefIndex(start) + 1;
     goto exit;
@@ -410,11 +410,11 @@
   // [defSlot(def), useSlot(kill)+1)
   while (++mi != MBB->end()) {
     baseIndex += InstrSlots::NUM;
-    if (lv_->KillsRegister(mi, interval.reg)) {
+    if (mi->killsRegister(interval.reg, tri_)) {
       DOUT << " killed";
       end = getUseIndex(baseIndex) + 1;
       goto exit;
-    } else if (lv_->ModifiesRegister(mi, interval.reg)) {
+    } else if (mi->modifiesRegister(interval.reg, tri_)) {
       // Another instruction redefines the register before it is ever read.
       // Then the register is essentially dead at the instruction that defines
       // it. Hence its interval is:
@@ -459,8 +459,9 @@
     handlePhysicalRegisterDef(MBB, MI, MIIdx, getOrCreateInterval(reg), CopyMI);
     // Def of a register also defines its sub-registers.
     for (const unsigned* AS = tri_->getSubRegisters(reg); *AS; ++AS)
-      // Avoid processing some defs more than once.
-      if (!MI->findRegisterDefOperand(*AS))
+      // If MI also modifies the sub-register explicitly, avoid processing it
+      // more than once. Do not pass in TRI here so it checks for exact match.
+      if (!MI->modifiesRegister(*AS))
         handlePhysicalRegisterDef(MBB, MI, MIIdx, getOrCreateInterval(*AS), 0);
   }
 }
@@ -477,11 +478,11 @@
   unsigned start = baseIndex;
   unsigned end = start;
   while (mi != MBB->end()) {
-    if (lv_->KillsRegister(mi, interval.reg)) {
+    if (mi->killsRegister(interval.reg, tri_)) {
       DOUT << " killed";
       end = getUseIndex(baseIndex) + 1;
       goto exit;
-    } else if (lv_->ModifiesRegister(mi, interval.reg)) {
+    } else if (mi->modifiesRegister(interval.reg, tri_)) {
       // Another instruction redefines the register before it is ever read.
       // Then the register is essentially dead at the instruction that defines
       // it. Hence its interval is:
@@ -842,9 +843,9 @@
     if (!vrm.isReMaterialized(Reg))
       continue;
     MachineInstr *ReMatMI = vrm.getReMaterializedMI(Reg);
-    int OpIdx = ReMatMI->findRegisterUseOperandIdx(li.reg);
-    if (OpIdx != -1)
-      ReMatMI->getOperand(OpIdx).setReg(NewVReg);
+    MachineOperand *UseMO = ReMatMI->findRegisterUseOperand(li.reg);
+    if (UseMO)
+      UseMO->setReg(NewVReg);
   }
 }
 
@@ -1605,7 +1606,7 @@
         LiveRange *LR = &LI->ranges[LI->ranges.size()-1];
         unsigned LastUseIdx = getBaseIndex(LR->end);
         MachineInstr *LastUse = getInstructionFromIndex(LastUseIdx);
-        int UseIdx = LastUse->findRegisterUseOperandIdx(LI->reg);
+        int UseIdx = LastUse->findRegisterUseOperandIdx(LI->reg, false);
         assert(UseIdx != -1);
         if (LastUse->getOperand(UseIdx).isImplicit() ||
             LastUse->getDesc().getOperandConstraint(UseIdx,TOI::TIED_TO) == -1){

Modified: llvm/trunk/lib/CodeGen/LiveVariables.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveVariables.cpp?rev=47927&r1=47926&r2=47927&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/LiveVariables.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveVariables.cpp Tue Mar  4 18:59:57 2008
@@ -76,51 +76,6 @@
   return VI;
 }
 
-/// KillsRegister - Returns true if the machine instruction kills the specified
-/// register.
-bool LiveVariables::KillsRegister(MachineInstr *MI, unsigned Reg) const {
-  for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
-    const MachineOperand &MO = MI->getOperand(i);
-    if (MO.isRegister() && MO.isKill()) {
-      unsigned MOReg = MO.getReg();
-      if (MOReg == Reg ||
-          (TargetRegisterInfo::isPhysicalRegister(MOReg) &&
-           TargetRegisterInfo::isPhysicalRegister(Reg) &&
-           RegInfo->isSubRegister(MOReg, Reg)))
-        return true;
-    }
-  }
-  return false;
-}
-
-/// RegisterDefIsDead - Returns true if the register is dead in this machine
-/// instruction.
-bool LiveVariables::RegisterDefIsDead(MachineInstr *MI, unsigned Reg) const {
-  for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
-    const MachineOperand &MO = MI->getOperand(i);
-    if (MO.isRegister() && MO.isDead()) {
-      unsigned MOReg = MO.getReg();
-      if ((MOReg == Reg) ||
-          (TargetRegisterInfo::isPhysicalRegister(MOReg) &&
-           TargetRegisterInfo::isPhysicalRegister(Reg) &&
-           RegInfo->isSubRegister(MOReg, Reg)))
-        return true;
-    }
-  }
-  return false;
-}
-
-/// ModifiesRegister - Returns true if the machine instruction modifies the
-/// register.
-bool LiveVariables::ModifiesRegister(MachineInstr *MI, unsigned Reg) const {
-  for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
-    const MachineOperand &MO = MI->getOperand(i);
-    if (MO.isRegister() && MO.isDef() && MO.getReg() == Reg)
-      return true;
-  }
-  return false;
-}
-
 void LiveVariables::MarkVirtRegAliveInBlock(VarInfo& VRInfo,
                                             MachineBasicBlock *DefBlock,
                                             MachineBasicBlock *MBB,
@@ -232,7 +187,7 @@
       !PhysRegUsed[Reg]) {
     MachineInstr *Def = PhysRegInfo[Reg];
 
-    if (!Def->findRegisterDefOperand(Reg))
+    if (!Def->modifiesRegister(Reg))
       Def->addOperand(MachineOperand::CreateReg(Reg,
                                                 true  /*IsDef*/,
                                                 true  /*IsImp*/));
@@ -244,14 +199,14 @@
   PhysRegUsed[Reg] = true;
 
   // Now reset the use information for the sub-registers.
-  for (const unsigned *SubRegs = RegInfo->getSubRegisters(Reg);
+  for (const unsigned *SubRegs = TRI->getSubRegisters(Reg);
        unsigned SubReg = *SubRegs; ++SubRegs) {
     PhysRegPartUse[SubReg] = NULL;
     PhysRegInfo[SubReg] = MI;
     PhysRegUsed[SubReg] = true;
   }
 
-  for (const unsigned *SuperRegs = RegInfo->getSuperRegisters(Reg);
+  for (const unsigned *SuperRegs = TRI->getSuperRegisters(Reg);
        unsigned SuperReg = *SuperRegs; ++SuperRegs) {
     // Remember the partial use of this super-register if it was previously
     // defined.
@@ -261,7 +216,7 @@
       // No need to go up more levels. A def of a register also sets its sub-
       // registers. So if PhysRegInfo[SuperReg] is NULL, it means SuperReg's
       // super-registers are not previously defined.
-      for (const unsigned *SSRegs = RegInfo->getSuperRegisters(SuperReg);
+      for (const unsigned *SSRegs = TRI->getSuperRegisters(SuperReg);
            unsigned SSReg = *SSRegs; ++SSRegs)
         if (PhysRegInfo[SSReg] != NULL) {
           HasPrevDef = true;
@@ -281,11 +236,11 @@
 void LiveVariables::addRegisterKills(unsigned Reg, MachineInstr *MI,
                                      SmallSet<unsigned, 4> &SubKills) {
   if (SubKills.count(Reg) == 0) {
-    MI->addRegisterKilled(Reg, RegInfo, true);
+    MI->addRegisterKilled(Reg, TRI, true);
     return;
   }
 
-  for (const unsigned *SubRegs = RegInfo->getImmediateSubRegisters(Reg);
+  for (const unsigned *SubRegs = TRI->getImmediateSubRegisters(Reg);
        unsigned SubReg = *SubRegs; ++SubRegs)
     addRegisterKills(SubReg, MI, SubKills);
 }
@@ -300,7 +255,7 @@
 /// SubKills is filled with the set of sub-registers that are killed elsewhere.
 bool LiveVariables::HandlePhysRegKill(unsigned Reg, const MachineInstr *RefMI,
                                       SmallSet<unsigned, 4> &SubKills) {
-  const unsigned *SubRegs = RegInfo->getImmediateSubRegisters(Reg);
+  const unsigned *SubRegs = TRI->getImmediateSubRegisters(Reg);
 
   for (; unsigned SubReg = *SubRegs; ++SubRegs) {
     const MachineInstr *LastRef = PhysRegInfo[SubReg];
@@ -330,12 +285,12 @@
 
   if (HandlePhysRegKill(Reg, RefMI, SubKills)) {
     // This machine instruction kills this register.
-    RefMI->addRegisterKilled(Reg, RegInfo, true);
+    RefMI->addRegisterKilled(Reg, TRI, true);
     return true;
   }
 
   // Some sub-registers are killed by another machine instruction.
-  for (const unsigned *SubRegs = RegInfo->getImmediateSubRegisters(Reg);
+  for (const unsigned *SubRegs = TRI->getImmediateSubRegisters(Reg);
        unsigned SubReg = *SubRegs; ++SubRegs)
     addRegisterKills(SubReg, RefMI, SubKills);
 
@@ -348,38 +303,38 @@
     if (PhysRegUsed[Reg]) {
       if (!HandlePhysRegKill(Reg, LastRef)) {
         if (PhysRegPartUse[Reg])
-          PhysRegPartUse[Reg]->addRegisterKilled(Reg, RegInfo, true);
+          PhysRegPartUse[Reg]->addRegisterKilled(Reg, TRI, true);
       }
     } else if (PhysRegPartUse[Reg]) {
       // Add implicit use / kill to last partial use.
-      PhysRegPartUse[Reg]->addRegisterKilled(Reg, RegInfo, true);
+      PhysRegPartUse[Reg]->addRegisterKilled(Reg, TRI, true);
     } else if (LastRef != MI) {
       // Defined, but not used. However, watch out for cases where a super-reg
       // is also defined on the same MI.
-      LastRef->addRegisterDead(Reg, RegInfo);
+      LastRef->addRegisterDead(Reg, TRI);
     }
   }
 
-  for (const unsigned *SubRegs = RegInfo->getSubRegisters(Reg);
+  for (const unsigned *SubRegs = TRI->getSubRegisters(Reg);
        unsigned SubReg = *SubRegs; ++SubRegs) {
     if (MachineInstr *LastRef = PhysRegInfo[SubReg]) {
       if (PhysRegUsed[SubReg]) {
         if (!HandlePhysRegKill(SubReg, LastRef)) {
           if (PhysRegPartUse[SubReg])
-            PhysRegPartUse[SubReg]->addRegisterKilled(SubReg, RegInfo, true);
+            PhysRegPartUse[SubReg]->addRegisterKilled(SubReg, TRI, true);
         }
       } else if (PhysRegPartUse[SubReg]) {
         // Add implicit use / kill to last use of a sub-register.
-        PhysRegPartUse[SubReg]->addRegisterKilled(SubReg, RegInfo, true);
+        PhysRegPartUse[SubReg]->addRegisterKilled(SubReg, TRI, true);
       } else if (LastRef != MI) {
         // This must be a def of the subreg on the same MI.
-        LastRef->addRegisterDead(SubReg, RegInfo);
+        LastRef->addRegisterDead(SubReg, TRI);
       }
     }
   }
 
   if (MI) {
-    for (const unsigned *SuperRegs = RegInfo->getSuperRegisters(Reg);
+    for (const unsigned *SuperRegs = TRI->getSuperRegisters(Reg);
          unsigned SuperReg = *SuperRegs; ++SuperRegs) {
       if (PhysRegInfo[SuperReg] && PhysRegInfo[SuperReg] != MI) {
         // The larger register is previously defined. Now a smaller part is
@@ -404,7 +359,7 @@
     PhysRegPartDef[Reg].clear();
     PhysRegPartUse[Reg] = NULL;
 
-    for (const unsigned *SubRegs = RegInfo->getSubRegisters(Reg);
+    for (const unsigned *SubRegs = TRI->getSubRegisters(Reg);
          unsigned SubReg = *SubRegs; ++SubRegs) {
       PhysRegInfo[SubReg] = MI;
       PhysRegUsed[SubReg] = false;
@@ -416,13 +371,12 @@
 
 bool LiveVariables::runOnMachineFunction(MachineFunction &mf) {
   MF = &mf;
-  RegInfo = MF->getTarget().getRegisterInfo();
+  TRI = MF->getTarget().getRegisterInfo();
   MachineRegisterInfo& MRI = mf.getRegInfo();
-  assert(RegInfo && "Target doesn't have register information?");
 
-  ReservedRegisters = RegInfo->getReservedRegs(mf);
+  ReservedRegisters = TRI->getReservedRegs(mf);
 
-  unsigned NumRegs = RegInfo->getNumRegs();
+  unsigned NumRegs = TRI->getNumRegs();
   PhysRegInfo = new MachineInstr*[NumRegs];
   PhysRegUsed = new bool[NumRegs];
   PhysRegPartUse = new MachineInstr*[NumRegs];
@@ -533,7 +487,7 @@
         HandlePhysRegUse(*I, Ret);
 
         // Add live-out registers as implicit uses.
-        if (Ret->findRegisterUseOperandIdx(*I) == -1)
+        if (!Ret->readsRegister(*I))
           Ret->addOperand(MachineOperand::CreateReg(*I, false, true));
       }
     }
@@ -562,12 +516,12 @@
         VirtRegInfo[i]
           .Kills[j]->addRegisterDead(i +
                                      TargetRegisterInfo::FirstVirtualRegister,
-                                     RegInfo);
+                                     TRI);
       else
         VirtRegInfo[i]
           .Kills[j]->addRegisterKilled(i +
                                        TargetRegisterInfo::FirstVirtualRegister,
-                                       RegInfo);
+                                       TRI);
 
   // Check to make sure there are no unreachable blocks in the MC CFG for the
   // function.  If so, it is due to a bug in the instruction selector or some

Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=47927&r1=47926&r2=47927&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Tue Mar  4 18:59:57 2008
@@ -532,25 +532,45 @@
 /// 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::findRegisterUseOperandIdx(unsigned Reg, bool isKill) const {
+int MachineInstr::findRegisterUseOperandIdx(unsigned Reg, bool isKill,
+                                          const TargetRegisterInfo *TRI) const {
   for (unsigned i = 0, e = getNumOperands(); i != e; ++i) {
     const MachineOperand &MO = getOperand(i);
-    if (MO.isRegister() && MO.isUse() && MO.getReg() == Reg)
+    if (!MO.isRegister() || !MO.isUse())
+      continue;
+    unsigned MOReg = MO.getReg();
+    if (!MOReg)
+      continue;
+    if (MOReg == Reg ||
+        (TRI &&
+         TargetRegisterInfo::isPhysicalRegister(MOReg) &&
+         TargetRegisterInfo::isPhysicalRegister(Reg) &&
+         TRI->isSubRegister(MOReg, Reg)))
       if (!isKill || MO.isKill())
         return i;
   }
   return -1;
 }
   
-/// findRegisterDefOperand() - Returns the MachineOperand that is a def of
-/// the specific register or NULL if it is not found.
-MachineOperand *MachineInstr::findRegisterDefOperand(unsigned Reg) {
+/// findRegisterDefOperandIdx() - Returns the operand index that is a def of
+/// the specific register or -1 if it is not found. It further tightening
+  /// the search criteria to a def that is dead the register if isDead is true.
+int MachineInstr::findRegisterDefOperandIdx(unsigned Reg, bool isDead,
+                                          const TargetRegisterInfo *TRI) const {
   for (unsigned i = 0, e = getNumOperands(); i != e; ++i) {
-    MachineOperand &MO = getOperand(i);
-    if (MO.isRegister() && MO.isDef() && MO.getReg() == Reg)
-      return &MO;
+    const MachineOperand &MO = getOperand(i);
+    if (!MO.isRegister() || !MO.isDef())
+      continue;
+    unsigned MOReg = MO.getReg();
+    if (MOReg == Reg ||
+        (TRI &&
+         TargetRegisterInfo::isPhysicalRegister(MOReg) &&
+         TargetRegisterInfo::isPhysicalRegister(Reg) &&
+         TRI->isSubRegister(MOReg, Reg)))
+      if (!isDead || MO.isDead())
+        return i;
   }
-  return NULL;
+  return -1;
 }
 
 /// findFirstPredOperandIdx() - Find the index of the first operand in the

Modified: llvm/trunk/lib/CodeGen/PHIElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PHIElimination.cpp?rev=47927&r1=47926&r2=47927&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/PHIElimination.cpp (original)
+++ llvm/trunk/lib/CodeGen/PHIElimination.cpp Tue Mar  4 18:59:57 2008
@@ -161,7 +161,7 @@
     LV->removeVirtualRegistersKilled(MPhi);
 
     // If the result is dead, update LV.
-    if (LV->RegisterDefIsDead(MPhi, DestReg)) {
+    if (MPhi->registerDefIsDead(DestReg)) {
       LV->addVirtualRegisterDead(DestReg, PHICopy);
       LV->removeVirtualRegistersDead(MPhi);
     }

Modified: llvm/trunk/lib/CodeGen/RegAllocLocal.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLocal.cpp?rev=47927&r1=47926&r2=47927&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/RegAllocLocal.cpp (original)
+++ llvm/trunk/lib/CodeGen/RegAllocLocal.cpp Tue Mar  4 18:59:57 2008
@@ -306,8 +306,7 @@
     // If the instruction reads the register that's spilled, (e.g. this can
     // happen if it is a move to a physical register), then the spill
     // instruction is not a kill.
-    bool isKill = !(I != MBB.end() &&
-                    I->findRegisterUseOperandIdx(PhysReg) != -1);
+    bool isKill = !(I != MBB.end() && I->readsRegister(PhysReg));
     TII->storeRegToStackSlot(MBB, I, PhysReg, isKill, FrameIndex, RC);
     ++NumStores;   // Update statistics
   }

Modified: llvm/trunk/lib/CodeGen/RegisterScavenging.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegisterScavenging.cpp?rev=47927&r1=47926&r2=47927&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/RegisterScavenging.cpp (original)
+++ llvm/trunk/lib/CodeGen/RegisterScavenging.cpp Tue Mar  4 18:59:57 2008
@@ -29,7 +29,7 @@
 void RegScavenger::setUsed(unsigned Reg) {
   RegsAvailable.reset(Reg);
 
-  for (const unsigned *SubRegs = RegInfo->getSubRegisters(Reg);
+  for (const unsigned *SubRegs = TRI->getSubRegisters(Reg);
        unsigned SubReg = *SubRegs; ++SubRegs)
     RegsAvailable.reset(SubReg);
 }
@@ -38,7 +38,7 @@
 void RegScavenger::setUnused(unsigned Reg) {
   RegsAvailable.set(Reg);
 
-  for (const unsigned *SubRegs = RegInfo->getSubRegisters(Reg);
+  for (const unsigned *SubRegs = TRI->getSubRegisters(Reg);
        unsigned SubReg = *SubRegs; ++SubRegs)
     RegsAvailable.set(SubReg);
 }
@@ -47,21 +47,21 @@
   const MachineFunction &MF = *mbb->getParent();
   const TargetMachine &TM = MF.getTarget();
   TII = TM.getInstrInfo();
-  RegInfo = TM.getRegisterInfo();
+  TRI = TM.getRegisterInfo();
 
-  assert((NumPhysRegs == 0 || NumPhysRegs == RegInfo->getNumRegs()) &&
+  assert((NumPhysRegs == 0 || NumPhysRegs == TRI->getNumRegs()) &&
          "Target changed?");
 
   if (!MBB) {
-    NumPhysRegs = RegInfo->getNumRegs();
+    NumPhysRegs = TRI->getNumRegs();
     RegsAvailable.resize(NumPhysRegs);
 
     // Create reserved registers bitvector.
-    ReservedRegs = RegInfo->getReservedRegs(MF);
+    ReservedRegs = TRI->getReservedRegs(MF);
 
     // Create callee-saved registers bitvector.
     CalleeSavedRegs.resize(NumPhysRegs);
-    const unsigned *CSRegs = RegInfo->getCalleeSavedRegs();
+    const unsigned *CSRegs = TRI->getCalleeSavedRegs();
     if (CSRegs != NULL)
       for (unsigned i = 0; CSRegs[i]; ++i)
         CalleeSavedRegs.set(CSRegs[i]);
@@ -93,7 +93,7 @@
   TII->loadRegFromStackSlot(*MBB, MBBI, ScavengedReg,
                                 ScavengingFrameIndex, ScavengedRC);
   MachineBasicBlock::iterator II = prior(MBBI);
-  RegInfo->eliminateFrameIndex(II, 0, this);
+  TRI->eliminateFrameIndex(II, 0, this);
   setUsed(ScavengedReg);
   ScavengedReg = 0;
   ScavengedRC = NULL;
@@ -138,7 +138,7 @@
     if (MO.isKill() && !isReserved(Reg)) {
       ChangedRegs.set(Reg);
 
-      for (const unsigned *SubRegs = RegInfo->getSubRegisters(Reg);
+      for (const unsigned *SubRegs = TRI->getSubRegisters(Reg);
            unsigned SubReg = *SubRegs; ++SubRegs)
         ChangedRegs.set(SubReg);
     }
@@ -210,7 +210,7 @@
     ChangedRegs.set(Reg);
 
     // Set the sub-registers as "used".
-    for (const unsigned *SubRegs = RegInfo->getSubRegisters(Reg);
+    for (const unsigned *SubRegs = TRI->getSubRegisters(Reg);
          unsigned SubReg = *SubRegs; ++SubRegs)
       ChangedRegs.set(SubReg);
   }
@@ -267,12 +267,13 @@
 /// calcDistanceToUse - Calculate the distance to the first use of the
 /// specified register.
 static unsigned calcDistanceToUse(MachineBasicBlock *MBB,
-                                  MachineBasicBlock::iterator I, unsigned Reg) {
+                                  MachineBasicBlock::iterator I, unsigned Reg,
+                                  const TargetRegisterInfo *TRI) {
   unsigned Dist = 0;
   I = next(I);
   while (I != MBB->end()) {
     Dist++;
-    if (I->findRegisterUseOperandIdx(Reg) != -1)
+    if (I->readsRegister(Reg, TRI))
         return Dist;
     I = next(I);    
   }
@@ -302,7 +303,7 @@
   unsigned MaxDist = 0;
   int Reg = Candidates.find_first();
   while (Reg != -1) {
-    unsigned Dist = calcDistanceToUse(MBB, I, Reg);
+    unsigned Dist = calcDistanceToUse(MBB, I, Reg, TRI);
     if (Dist >= MaxDist) {
       MaxDist = Dist;
       SReg = Reg;
@@ -315,12 +316,12 @@
     TII->loadRegFromStackSlot(*MBB, I, ScavengedReg,
                               ScavengingFrameIndex, ScavengedRC);
     MachineBasicBlock::iterator II = prior(I);
-    RegInfo->eliminateFrameIndex(II, SPAdj, this);
+    TRI->eliminateFrameIndex(II, SPAdj, this);
   }
 
   TII->storeRegToStackSlot(*MBB, I, SReg, true, ScavengingFrameIndex, RC);
   MachineBasicBlock::iterator II = prior(I);
-  RegInfo->eliminateFrameIndex(II, SPAdj, this);
+  TRI->eliminateFrameIndex(II, SPAdj, this);
   ScavengedReg = SReg;
   ScavengedRC = RC;
 

Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=47927&r1=47926&r2=47927&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original)
+++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Tue Mar  4 18:59:57 2008
@@ -307,7 +307,7 @@
     MBB->insert(DefMI, NewMI);
     MBB->erase(DefMI);
   }
-  unsigned OpIdx = NewMI->findRegisterUseOperandIdx(IntA.reg);
+  unsigned OpIdx = NewMI->findRegisterUseOperandIdx(IntA.reg, false);
   NewMI->getOperand(OpIdx).setIsKill();
 
   // Update uses of IntA of the specific Val# with IntB.
@@ -588,7 +588,7 @@
 
   // Check if it is necessary to propagate "isDead" property before intervals
   // are joined.
-  MachineOperand *mopd = CopyMI->findRegisterDefOperand(DstReg);
+  MachineOperand *mopd = CopyMI->findRegisterDefOperand(DstReg, false);
   bool isDead = mopd->isDead();
   bool isShorten = false;
   unsigned SrcStart = 0, RemoveStart = 0;
@@ -617,12 +617,9 @@
         RemoveEnd = SrcEnd;
       } else {
         MachineInstr *SrcMI = li_->getInstructionFromIndex(SrcStart);
-        if (SrcMI) {
-          MachineOperand *mops = findDefOperand(SrcMI, SrcReg);
-          if (mops)
-            // A dead def should have a single cycle interval.
-            ++RemoveStart;
-        }
+        if (SrcMI && SrcMI->modifiesRegister(SrcReg, tri_))
+          // A dead def should have a single cycle interval.
+          ++RemoveStart;
       }
     }
   }
@@ -672,9 +669,9 @@
       } else {
         MachineInstr *SrcMI = li_->getInstructionFromIndex(SrcStart);
         if (SrcMI) {
-          MachineOperand *mops = findDefOperand(SrcMI, SrcReg);
-          if (mops)
-            mops->setIsDead();
+          int DeadIdx = SrcMI->findRegisterDefOperandIdx(SrcReg, false, tri_);
+          if (DeadIdx != -1)
+            SrcMI->getOperand(DeadIdx).setIsDead();
         }
       }
     }
@@ -1461,20 +1458,6 @@
 }
 
 
-/// findDefOperand - Returns the MachineOperand that is a def of the specific
-/// register. It returns NULL if the def is not found.
-/// FIXME: Move to MachineInstr.
-MachineOperand *SimpleRegisterCoalescing::findDefOperand(MachineInstr *MI,
-                                                         unsigned Reg) const {
-  for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
-    MachineOperand &MO = MI->getOperand(i);
-    if (MO.isRegister() && MO.isDef() &&
-        tri_->regsOverlap(MO.getReg(), Reg))
-      return &MO;
-  }
-  return NULL;
-}
-
 /// RemoveUnnecessaryKills - Remove kill markers that are no longer accurate
 /// due to live range lengthening as the result of coalescing.
 void SimpleRegisterCoalescing::printRegName(unsigned reg) const {
@@ -1548,7 +1531,7 @@
       if (tii_->isMoveInstr(*mii, srcReg, dstReg) && srcReg == dstReg) {
         // remove from def list
         LiveInterval &RegInt = li_->getOrCreateInterval(srcReg);
-        MachineOperand *MO = mii->findRegisterDefOperand(dstReg);
+        MachineOperand *MO = mii->findRegisterDefOperand(dstReg, false);
         // If def of this move instruction is dead, remove its live range from
         // the dstination register's live interval.
         if (MO->isDead()) {

Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.h?rev=47927&r1=47926&r2=47927&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.h (original)
+++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.h Tue Mar  4 18:59:57 2008
@@ -206,10 +206,6 @@
     MachineOperand *lastRegisterUse(unsigned Start, unsigned End, unsigned Reg,
                                     unsigned &LastUseIdx) const;
 
-    /// findDefOperand - Returns the MachineOperand that is a def of the specific
-    /// register. It returns NULL if the def is not found.
-    MachineOperand *findDefOperand(MachineInstr *MI, unsigned Reg) const;
-
     void printRegName(unsigned reg) const;
   };
 

Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp?rev=47927&r1=47926&r2=47927&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp (original)
+++ llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Tue Mar  4 18:59:57 2008
@@ -351,10 +351,10 @@
           break;
         }
       // Store KillInsts if they match up with the definition
-      } else if (LV.KillsRegister(curr, a)) {
+      } else if (curr->killsRegister(a)) {
         if (def == MRI->getVRegDef(a)) {
           kill = curr;
-        } else if (LV.KillsRegister(curr, b)) {
+        } else if (curr->killsRegister(b)) {
           if (def == MRI->getVRegDef(b)) {
             kill = curr;
           }
@@ -373,7 +373,7 @@
           break;
         }
       // Save KillInsts of First
-      } else if (LV.KillsRegister(curr, a)) {
+      } else if (curr->killsRegister(a)) {
         kill = curr;
       }
     // Symmetric with the above
@@ -386,7 +386,7 @@
           interference = false;
           break;
         }
-      } else if (LV.KillsRegister(curr, b)) {
+      } else if (curr->killsRegister(b)) {
         kill = curr;
       }
     }

Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=47927&r1=47926&r2=47927&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original)
+++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Tue Mar  4 18:59:57 2008
@@ -139,7 +139,7 @@
           // rearrange the code to make it so.  Making it the killing user will
           // allow us to coalesce A and B together, eliminating the copy we are
           // about to insert.
-          if (!LV.KillsRegister(mi, regB)) {
+          if (!mi->killsRegister(regB)) {
             // If this instruction is commutative, check to see if C dies.  If
             // so, swap the B and C operands.  This makes the live ranges of A
             // and C joinable.
@@ -148,7 +148,7 @@
               assert(mi->getOperand(3-si).isRegister() &&
                      "Not a proper commutative instruction!");
               unsigned regC = mi->getOperand(3-si).getReg();
-              if (LV.KillsRegister(mi, regC)) {
+              if (mi->killsRegister(regC)) {
                 DOUT << "2addr: COMMUTING  : " << *mi;
                 MachineInstr *NewMI = TII.commuteInstruction(mi);
                 if (NewMI == 0) {

Modified: llvm/trunk/lib/CodeGen/VirtRegMap.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/VirtRegMap.cpp?rev=47927&r1=47926&r2=47927&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/VirtRegMap.cpp (original)
+++ llvm/trunk/lib/CodeGen/VirtRegMap.cpp Tue Mar  4 18:59:57 2008
@@ -862,8 +862,7 @@
     MachineInstr* DeadStore = MaybeDeadStores[FoldedSS];
     if (DeadStore && (MR & VirtRegMap::isModRef)) {
       unsigned PhysReg = Spills.getSpillSlotOrReMatPhysReg(FoldedSS);
-      if (!PhysReg ||
-          DeadStore->findRegisterUseOperandIdx(PhysReg, true) == -1)
+      if (!PhysReg || !DeadStore->readsRegister(PhysReg))
         continue;
       UnfoldPR = PhysReg;
       UnfoldedOpc = TII->getOpcodeAfterMemoryUnfold(MI.getOpcode(),
@@ -908,7 +907,7 @@
       assert(NewMIs.size() == 1);
       MachineInstr *NewMI = NewMIs.back();
       NewMIs.clear();
-      int Idx = NewMI->findRegisterUseOperandIdx(VirtReg);
+      int Idx = NewMI->findRegisterUseOperandIdx(VirtReg, false);
       assert(Idx != -1);
       SmallVector<unsigned, 2> Ops;
       Ops.push_back(Idx);
@@ -1410,7 +1409,7 @@
           // the physreg.
           if (PhysReg &&
               !TII->isStoreToStackSlot(&MI, SS) && // Not profitable!
-              DeadStore->findRegisterUseOperandIdx(PhysReg, true) != -1 &&
+              DeadStore->killsRegister(PhysReg) &&
               TII->unfoldMemoryOperand(MF, &MI, PhysReg, false, true, NewMIs)) {
             MBB.insert(MII, NewMIs[0]);
             NewStore = NewMIs[1];

Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp?rev=47927&r1=47926&r2=47927&view=diff

==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp Tue Mar  4 18:59:57 2008
@@ -294,8 +294,7 @@
         for (unsigned j = 0; j < 2; ++j) {
           // Look at the two new MI's in reverse order.
           MachineInstr *NewMI = NewMIs[j];
-          int NIdx = NewMI->findRegisterUseOperandIdx(Reg);
-          if (NIdx == -1)
+          if (!NewMI->readsRegister(Reg))
             continue;
           LV.addVirtualRegisterKilled(Reg, NewMI);
           if (VI.removeKill(MI))

Modified: llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp?rev=47927&r1=47926&r2=47927&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp Tue Mar  4 18:59:57 2008
@@ -154,18 +154,6 @@
 
 FunctionPass *llvm::createX86FloatingPointStackifierPass() { return new FPS(); }
 
-/// KillsRegister - Return true if the specified instruction kills (is the last
-/// use of) the specified register.  Note that this routine does not check for
-/// kills of subregisters.
-static bool KillsRegister(MachineInstr *MI, unsigned Reg) {
-  for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
-    MachineOperand &MO = MI->getOperand(i);
-    if (MO.isRegister() && MO.isKill() && MO.getReg() == Reg)
-      return true;
-  }
-  return false;
-}
-
 /// getFPReg - Return the X86::FPx register number for the specified operand.
 /// For example, this returns 3 for X86::FP3.
 static unsigned getFPReg(const MachineOperand &MO) {
@@ -610,7 +598,7 @@
 
   // Is this the last use of the source register?
   unsigned Reg = getFPReg(MI->getOperand(NumOps-1));
-  bool KillsSrc = KillsRegister(MI, X86::FP0+Reg);
+  bool KillsSrc = MI->killsRegister(X86::FP0+Reg);
 
   // FISTP64m is strange because there isn't a non-popping versions.
   // If we have one _and_ we don't want to pop the operand, duplicate the value
@@ -669,7 +657,7 @@
 
   // Is this the last use of the source register?
   unsigned Reg = getFPReg(MI->getOperand(1));
-  bool KillsSrc = KillsRegister(MI, X86::FP0+Reg);
+  bool KillsSrc = MI->killsRegister(X86::FP0+Reg);
 
   if (KillsSrc) {
     // If this is the last use of the source register, just make sure it's on
@@ -778,8 +766,8 @@
   unsigned Dest = getFPReg(MI->getOperand(0));
   unsigned Op0 = getFPReg(MI->getOperand(NumOperands-2));
   unsigned Op1 = getFPReg(MI->getOperand(NumOperands-1));
-  bool KillsOp0 = KillsRegister(MI, X86::FP0+Op0);
-  bool KillsOp1 = KillsRegister(MI, X86::FP0+Op1);
+  bool KillsOp0 = MI->killsRegister(X86::FP0+Op0);
+  bool KillsOp1 = MI->killsRegister(X86::FP0+Op1);
 
   unsigned TOS = getStackEntry(0);
 
@@ -875,8 +863,8 @@
   assert(NumOperands == 2 && "Illegal FUCOM* instruction!");
   unsigned Op0 = getFPReg(MI->getOperand(NumOperands-2));
   unsigned Op1 = getFPReg(MI->getOperand(NumOperands-1));
-  bool KillsOp0 = KillsRegister(MI, X86::FP0+Op0);
-  bool KillsOp1 = KillsRegister(MI, X86::FP0+Op1);
+  bool KillsOp0 = MI->killsRegister(X86::FP0+Op0);
+  bool KillsOp1 = MI->killsRegister(X86::FP0+Op1);
 
   // Make sure the first operand is on the top of stack, the other one can be
   // anywhere.
@@ -901,7 +889,7 @@
 
   unsigned Op0 = getFPReg(MI->getOperand(0));
   unsigned Op1 = getFPReg(MI->getOperand(2));
-  bool KillsOp1 = KillsRegister(MI, X86::FP0+Op1);
+  bool KillsOp1 = MI->killsRegister(X86::FP0+Op1);
 
   // The first operand *must* be on the top of the stack.
   moveToTop(Op0, I);
@@ -958,7 +946,7 @@
     unsigned SrcReg = getFPReg(MI->getOperand(1));
     unsigned DestReg = getFPReg(MI->getOperand(0));
 
-    if (KillsRegister(MI, X86::FP0+SrcReg)) {
+    if (MI->killsRegister(X86::FP0+SrcReg)) {
       // If the input operand is killed, we can just change the owner of the
       // incoming stack slot into the result.
       unsigned Slot = getSlot(SrcReg);





More information about the llvm-commits mailing list