Simplify search for abbreviations.
authorJim Laskey <jlaskey@mac.com>
Sat, 21 Jan 2006 01:13:18 +0000 (01:13 +0000)
committerJim Laskey <jlaskey@mac.com>
Sat, 21 Jan 2006 01:13:18 +0000 (01:13 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25491 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/DwarfWriter.h
lib/CodeGen/DwarfWriter.cpp

index 7d04e0abccff6d3b35e959507648698ddddab8bf..3c8ef877ea0ab84416d3b04478f6ab80f3ca1435 100644 (file)
@@ -476,6 +476,25 @@ namespace llvm {
     // Accessors
     unsigned getAttribute() const { return Attribute; }
     unsigned getForm()      const { return Form; }
+    
+    /// operator== - Used by DIEAbbrev to locate entry.
+    ///
+    bool operator==(const DIEAbbrevData &DAD) const {
+      return Attribute == DAD.Attribute && Form == DAD.Form;
+    }
+
+    /// operator!= - Used by DIEAbbrev to locate entry.
+    ///
+    bool operator!=(const DIEAbbrevData &DAD) const {
+      return Attribute != DAD.Attribute || Form != DAD.Form;
+    }
+    
+    /// operator< - Used by DIEAbbrev to locate entry.
+    ///
+    bool operator<(const DIEAbbrevData &DAD) const {
+      return Attribute < DAD.Attribute ||
+            (Attribute == DAD.Attribute && Form < DAD.Form);
+    }
   };
   
   //===--------------------------------------------------------------------===//
index a5424d048b4b16e5f05143730eade9f744c65fd6..09ec6f1458d46b63e5c277a5ddffc84705d9ccdf 100644 (file)
@@ -589,10 +589,7 @@ bool DIEAbbrev::operator==(const DIEAbbrev &DA) const {
   if (Data.size() != DA.Data.size()) return false;
   
   for (unsigned i = 0, N = Data.size(); i < N; i++) {
-    const DIEAbbrevData &AttrData = Data[i];
-    const DIEAbbrevData &DAAttrData = DA.Data[i];
-    if (AttrData.getAttribute() != DAAttrData.getAttribute()) return false;
-    if (AttrData.getForm() != DAAttrData.getForm()) return false;
+    if (Data[i] != DA.Data[i]) return false;
   }
   
   return true;
@@ -606,12 +603,7 @@ bool DIEAbbrev::operator<(const DIEAbbrev &DA) const {
   if (Data.size() != DA.Data.size()) return Data.size() < DA.Data.size();
   
   for (unsigned i = 0, N = Data.size(); i < N; i++) {
-    const DIEAbbrevData &AttrData = Data[i];
-    const DIEAbbrevData &DAAttrData = DA.Data[i];
-    if (AttrData.getAttribute() != DAAttrData.getAttribute())
-      return AttrData.getAttribute() < DAAttrData.getAttribute();
-    if (AttrData.getForm() != DAAttrData.getForm())
-      return AttrData.getForm() < DAAttrData.getForm();
+    if (Data[i] != DA.Data[i]) return Data[i] < DA.Data[i];
   }
   
   return false;