[llvm-commits] [llvm] r140946 - in /llvm/trunk/lib/Target/ARM: ARMConstantPoolValue.cpp ARMConstantPoolValue.h

Bill Wendling isanbard at gmail.com
Sat Oct 1 05:44:29 PDT 2011


Author: void
Date: Sat Oct  1 07:44:28 2011
New Revision: 140946

URL: http://llvm.org/viewvc/llvm-project?rev=140946&view=rev
Log:
Add a convenience method to tell if two things are equal.

Modified:
    llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp
    llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h

Modified: llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp?rev=140946&r1=140945&r2=140946&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp Sat Oct  1 07:44:28 2011
@@ -69,9 +69,7 @@
         (Constants[i].getAlignment() & AlignMask) == 0) {
       ARMConstantPoolValue *CPV =
         (ARMConstantPoolValue *)Constants[i].Val.MachineCPVal;
-      if (CPV->LabelId == LabelId &&
-          CPV->PCAdjust == PCAdjust &&
-          CPV->Modifier == Modifier)
+      if (this->equals(CPV))
         return i;
     }
   }
@@ -186,11 +184,7 @@
         (ARMConstantPoolValue *)Constants[i].Val.MachineCPVal;
       ARMConstantPoolConstant *APC = dyn_cast<ARMConstantPoolConstant>(CPV);
       if (!APC) continue;
-
-      if (APC->getGV() == this->CVal &&
-          APC->getLabelId() == this->getLabelId() &&
-          APC->getPCAdjustment() == this->getPCAdjustment() &&
-          APC->getModifier() == this->getModifier())
+      if (APC->CVal == CVal && equals(APC))
         return i;
     }
   }
@@ -256,10 +250,7 @@
       ARMConstantPoolSymbol *APS = dyn_cast<ARMConstantPoolSymbol>(CPV);
       if (!APS) continue;
 
-      if (APS->getLabelId() == this->getLabelId() &&
-          APS->getPCAdjustment() == this->getPCAdjustment() &&
-          CPV_streq(APS->getSymbol(), this->getSymbol()) &&
-          APS->getModifier() == this->getModifier())
+      if (CPV_streq(APS->S, S) && equals(APS))
         return i;
     }
   }
@@ -315,10 +306,7 @@
       ARMConstantPoolMBB *APMBB = dyn_cast<ARMConstantPoolMBB>(CPV);
       if (!APMBB) continue;
 
-      if (APMBB->getLabelId() == this->getLabelId() &&
-          APMBB->getPCAdjustment() == this->getPCAdjustment() &&
-          APMBB->getMBB() == this->getMBB() &&
-          APMBB->getModifier() == this->getModifier())
+      if (APMBB->MBB == MBB && equals(APMBB))
         return i;
     }
   }

Modified: llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h?rev=140946&r1=140945&r2=140946&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h (original)
+++ llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h Sat Oct  1 07:44:28 2011
@@ -93,6 +93,12 @@
   /// constantpool entry as another ARM constpool value.
   virtual bool hasSameValue(ARMConstantPoolValue *ACPV);
 
+  bool equals(const ARMConstantPoolValue *A) const {
+    return this->LabelId == A->LabelId &&
+      this->PCAdjust == A->PCAdjust &&
+      this->Modifier == A->Modifier;
+  }
+
   virtual void print(raw_ostream &O) const;
   void print(raw_ostream *O) const { if (O) print(*O); }
   void dump() const;





More information about the llvm-commits mailing list