[llvm-commits] [llvm] r154002 - /llvm/trunk/include/llvm/MC/MCRegisterInfo.h

Benjamin Kramer benny.kra at googlemail.com
Wed Apr 4 01:24:08 PDT 2012


Author: d0k
Date: Wed Apr  4 03:24:08 2012
New Revision: 154002

URL: http://llvm.org/viewvc/llvm-project?rev=154002&view=rev
Log:
Implement DwarfLLVMRegPair::operator< without violating asymmetry.

MSVC8 verifies this.

Modified:
    llvm/trunk/include/llvm/MC/MCRegisterInfo.h

Modified: llvm/trunk/include/llvm/MC/MCRegisterInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCRegisterInfo.h?rev=154002&r1=154001&r2=154002&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCRegisterInfo.h (original)
+++ llvm/trunk/include/llvm/MC/MCRegisterInfo.h Wed Apr  4 03:24:08 2012
@@ -134,8 +134,7 @@
     unsigned FromReg;
     unsigned ToReg;
 
-    bool operator==(unsigned Reg) const { return FromReg == Reg; }
-    bool operator<(unsigned Reg) const { return FromReg < Reg; }
+    bool operator<(DwarfLLVMRegPair RHS) const { return FromReg < RHS.FromReg; }
   };
 private:
   const MCRegisterDesc *Desc;                 // Pointer to the descriptor array
@@ -315,7 +314,8 @@
     const DwarfLLVMRegPair *M = isEH ? EHL2DwarfRegs : L2DwarfRegs;
     unsigned Size = isEH ? EHL2DwarfRegsSize : L2DwarfRegsSize;
 
-    const DwarfLLVMRegPair *I = std::lower_bound(M, M+Size, RegNum);
+    DwarfLLVMRegPair Key = { RegNum, 0 };
+    const DwarfLLVMRegPair *I = std::lower_bound(M, M+Size, Key);
     if (I == M+Size || I->FromReg != RegNum)
       return -1;
     return I->ToReg;
@@ -327,7 +327,8 @@
     const DwarfLLVMRegPair *M = isEH ? EHDwarf2LRegs : Dwarf2LRegs;
     unsigned Size = isEH ? EHDwarf2LRegsSize : Dwarf2LRegsSize;
 
-    const DwarfLLVMRegPair *I = std::lower_bound(M, M+Size, RegNum);
+    DwarfLLVMRegPair Key = { RegNum, 0 };
+    const DwarfLLVMRegPair *I = std::lower_bound(M, M+Size, Key);
     assert(I != M+Size && I->FromReg == RegNum && "Invalid RegNum");
     return I->ToReg;
   }





More information about the llvm-commits mailing list