diff options
author | Bill Wendling <isanbard@gmail.com> | 2011-10-01 12:44:28 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2011-10-01 12:44:28 +0000 |
commit | 405ca137a1bf5b08fbda3ba086fb013537ce8662 (patch) | |
tree | 82790712fb3d3ce5ab349a5656c28e72c8ce5924 | |
parent | 3320f2a3bfd4daec23ba7ceb50525140cc6316da (diff) |
Add a convenience method to tell if two things are equal.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140946 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/ARM/ARMConstantPoolValue.cpp | 20 | ||||
-rw-r--r-- | lib/Target/ARM/ARMConstantPoolValue.h | 6 |
2 files changed, 10 insertions, 16 deletions
diff --git a/lib/Target/ARM/ARMConstantPoolValue.cpp b/lib/Target/ARM/ARMConstantPoolValue.cpp index 2c200bdf2f..729ecc6342 100644 --- a/lib/Target/ARM/ARMConstantPoolValue.cpp +++ b/lib/Target/ARM/ARMConstantPoolValue.cpp @@ -69,9 +69,7 @@ int ARMConstantPoolValue::getExistingMachineCPValue(MachineConstantPool *CP, (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 @@ int ARMConstantPoolConstant::getExistingMachineCPValue(MachineConstantPool *CP, (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 @@ int ARMConstantPoolSymbol::getExistingMachineCPValue(MachineConstantPool *CP, 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 @@ int ARMConstantPoolMBB::getExistingMachineCPValue(MachineConstantPool *CP, 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; } } diff --git a/lib/Target/ARM/ARMConstantPoolValue.h b/lib/Target/ARM/ARMConstantPoolValue.h index f1176f60fb..0d0def32b7 100644 --- a/lib/Target/ARM/ARMConstantPoolValue.h +++ b/lib/Target/ARM/ARMConstantPoolValue.h @@ -93,6 +93,12 @@ public: /// 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; |