[llvm-commits] [llvm] r113670 - in /llvm/trunk: include/llvm/Target/TargetInstrInfo.h lib/CodeGen/PeepholeOptimizer.cpp lib/Target/ARM/ARMBaseInstrInfo.cpp lib/Target/ARM/ARMBaseInstrInfo.h

Bill Wendling isanbard at gmail.com
Fri Sep 10 17:13:50 PDT 2010


Author: void
Date: Fri Sep 10 19:13:50 2010
New Revision: 113670

URL: http://llvm.org/viewvc/llvm-project?rev=113670&view=rev
Log:
Rename ConvertToSetZeroFlag to something more general.

Modified:
    llvm/trunk/include/llvm/Target/TargetInstrInfo.h
    llvm/trunk/lib/CodeGen/PeepholeOptimizer.cpp
    llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp
    llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h

Modified: llvm/trunk/include/llvm/Target/TargetInstrInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetInstrInfo.h?rev=113670&r1=113669&r2=113670&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetInstrInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetInstrInfo.h Fri Sep 10 19:13:50 2010
@@ -585,10 +585,11 @@
     return false;
   }
 
-  /// ConvertToSetZeroFlag - Convert the instruction supplying the argument to
-  /// the comparison into one that sets the zero bit in the flags
-  /// register. Update the iterator *only* if a transformation took place.
-  virtual bool ConvertToSetZeroFlag(MachineInstr * /*CmpInstr*/,
+  /// OptimizeCompareInstr - See if the comparison instruction can be converted
+  /// into something more efficient. E.g., on ARM most instructions can set the
+  /// flags register, obviating the need for a separate CMP. Update the iterator
+  /// *only* if a transformation took place.
+  virtual bool OptimizeCompareInstr(MachineInstr * /*CmpInstr*/,
                                     unsigned /*SrcReg*/, int /*CmpValue*/,
                                     MachineBasicBlock::iterator &) const {
     return false;

Modified: llvm/trunk/lib/CodeGen/PeepholeOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PeepholeOptimizer.cpp?rev=113670&r1=113669&r2=113670&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/PeepholeOptimizer.cpp (original)
+++ llvm/trunk/lib/CodeGen/PeepholeOptimizer.cpp Fri Sep 10 19:13:50 2010
@@ -243,8 +243,8 @@
       TargetRegisterInfo::isPhysicalRegister(SrcReg))
     return false;
 
-  // Attempt to convert the defining instruction to set the "zero" flag.
-  if (TII->ConvertToSetZeroFlag(MI, SrcReg, CmpValue, NextIter)) {
+  // Attempt to optimize the comparison instruction.
+  if (TII->OptimizeCompareInstr(MI, SrcReg, CmpValue, NextIter)) {
     ++NumEliminated;
     return true;
   }

Modified: llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp?rev=113670&r1=113669&r2=113670&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp Fri Sep 10 19:13:50 2010
@@ -1377,11 +1377,11 @@
   return false;
 }
 
-/// ConvertToSetZeroFlag - Convert the instruction supplying the argument to the
+/// OptimizeCompareInstr - Convert the instruction supplying the argument to the
 /// comparison into one that sets the zero bit in the flags register. Update the
 /// iterator *only* if a transformation took place.
 bool ARMBaseInstrInfo::
-ConvertToSetZeroFlag(MachineInstr *CmpInstr, unsigned SrcReg, int CmpValue,
+OptimizeCompareInstr(MachineInstr *CmpInstr, unsigned SrcReg, int CmpValue,
                      MachineBasicBlock::iterator &MII) const {
   if (CmpValue != 0)
     return false;

Modified: llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h?rev=113670&r1=113669&r2=113670&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h (original)
+++ llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h Fri Sep 10 19:13:50 2010
@@ -344,9 +344,9 @@
   virtual bool AnalyzeCompare(const MachineInstr *MI, unsigned &SrcReg,
                               int &CmpValue) const;
 
-  /// ConvertToSetZeroFlag - Convert the instruction to set the zero flag so
+  /// OptimizeCompareInstr - Convert the instruction to set the zero flag so
   /// that we can remove a "comparison with zero".
-  virtual bool ConvertToSetZeroFlag(MachineInstr *CmpInstr, unsigned SrcReg,
+  virtual bool OptimizeCompareInstr(MachineInstr *CmpInstr, unsigned SrcReg,
                                     int CmpValue,
                                     MachineBasicBlock::iterator &MII) const;
 





More information about the llvm-commits mailing list