Improve compatibility with VC2005, patch by Morten Ofstad!
authorJeff Cohen <jeffc@jolt-lang.org>
Thu, 26 Jan 2006 20:41:32 +0000 (20:41 +0000)
committerJeff Cohen <jeffc@jolt-lang.org>
Thu, 26 Jan 2006 20:41:32 +0000 (20:41 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25661 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/LiveInterval.h
include/llvm/Target/SubtargetFeature.h
lib/Target/SubtargetFeature.cpp
lib/Target/X86/X86FloatingPoint.cpp
lib/Transforms/Scalar/CorrelatedExprs.cpp

index 4606781efd2295c174aa7a29368b84adc66a7b6d..f4f2b473668ca77aaddfb3e72d7ebf4682adf5d7 100644 (file)
@@ -64,6 +64,9 @@ namespace llvm {
     return V < LR.start;
   }
 
+  inline bool operator<(const LiveRange &LR, unsigned V) {
+    return LR.start < V;
+  }
 
   /// LiveInterval - This class represents some number of live ranges for a
   /// register or value.  This class also contains a bit of register allocator
index aab86885888de4199db9127ad4038fb3d50dc7ae..a9f7a71921b6fb431ebaddca872212669524f981 100644 (file)
@@ -36,8 +36,8 @@ struct SubtargetFeatureKV {
   uint32_t Value;                       // K-V integer value
   
   // Compare routine for std binary search
-  bool operator<(const std::string &S) const {
-    return strcmp(Key, S.c_str()) < 0;
+  bool operator<(const SubtargetFeatureKV &S) const {
+    return strcmp(Key, S.Key) < 0;
   }
 };
   
@@ -51,8 +51,8 @@ struct SubtargetInfoKV {
   void *Value;                          // K-V pointer value
   
   // Compare routine for std binary search
-  bool operator<(const std::string &S) const {
-    return strcmp(Key, S.c_str()) < 0;
+  bool operator<(const SubtargetInfoKV &S) const {
+    return strcmp(Key, S.Key) < 0;
   }
 };
   
index c9ddaf74b8ba540dc2f46d382f88cbaa68e23806..7856ddb66a48f2cc309f53ac1f5b666f476e98b6 100644 (file)
@@ -112,10 +112,13 @@ void SubtargetFeatures::AddFeature(const std::string &String,
 
 /// Find KV in array using binary search.
 template<typename T> const T *Find(const std::string &S, const T *A, size_t L) {
+  // Make the lower bound element we're looking for
+  T KV;
+  KV.Key = S.c_str();
   // Determine the end of the array
   const T *Hi = A + L;
   // Binary search the array
-  const T *F = std::lower_bound(A, Hi, S);
+  const T *F = std::lower_bound(A, Hi, KV);
   // If not found then return NULL
   if (F == Hi || std::string(F->Key) != S) return NULL;
   // Return the found array item
index 73144cb28f15a7cb8f4bfc9e4ac3b2ac87337e20..af5bb7db338a78c0710514338fa8d5ae88de83ca 100644 (file)
@@ -281,7 +281,12 @@ namespace {
     unsigned from;
     unsigned to;
     bool operator<(const TableEntry &TE) const { return from < TE.from; }
-    bool operator<(unsigned V) const { return from < V; }
+    friend bool operator<(const TableEntry &TE, unsigned V) {
+      return TE.from < V;
+    }
+    friend bool operator<(unsigned V, const TableEntry &TE) {
+      return V < TE.from;
+    }
   };
 }
 
index d00614b5d3dac7eda0d50f4cd671ec6a13861d68..3da7e6e2df572da6701c71c289f898b42223b28b 100644 (file)
@@ -135,7 +135,8 @@ namespace {
     Relation &getRelation(Value *V) {
       // Binary search for V's entry...
       std::vector<Relation>::iterator I =
-        std::lower_bound(Relationships.begin(), Relationships.end(), V);
+        std::lower_bound(Relationships.begin(), Relationships.end(),
+                         Relation(V));
 
       // If we found the entry, return it...
       if (I != Relationships.end() && I->getValue() == V)
@@ -148,7 +149,8 @@ namespace {
     const Relation *requestRelation(Value *V) const {
       // Binary search for V's entry...
       std::vector<Relation>::const_iterator I =
-        std::lower_bound(Relationships.begin(), Relationships.end(), V);
+        std::lower_bound(Relationships.begin(), Relationships.end(),
+                         Relation(V));
       if (I != Relationships.end() && I->getValue() == V)
         return &*I;
       return 0;