1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

Simplify search for abbreviations.

llvm-svn: 25491
This commit is contained in:
Jim Laskey 2006-01-21 01:13:18 +00:00
parent 08d15fdc02
commit 75adb3d269
2 changed files with 21 additions and 10 deletions

View 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);
}
};
//===--------------------------------------------------------------------===//

View 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;