diff options
| author | Jim Laskey <jlaskey@mac.com> | 2006-01-21 01:13:18 +0000 |
|---|---|---|
| committer | Jim Laskey <jlaskey@mac.com> | 2006-01-21 01:13:18 +0000 |
| commit | 3d8f3a55b7242c529d2c6c2d5b850427211a9677 (patch) | |
| tree | e555b4268d439fc0fd19b15e7b0a9453e3ab16b1 | |
| parent | 45900baadb58907db9e832fdd97fac78632b9f48 (diff) | |
| download | bcm5719-llvm-3d8f3a55b7242c529d2c6c2d5b850427211a9677.tar.gz bcm5719-llvm-3d8f3a55b7242c529d2c6c2d5b850427211a9677.zip | |
Simplify search for abbreviations.
llvm-svn: 25491
| -rw-r--r-- | llvm/include/llvm/CodeGen/DwarfWriter.h | 19 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/DwarfWriter.cpp | 12 |
2 files changed, 21 insertions, 10 deletions
diff --git a/llvm/include/llvm/CodeGen/DwarfWriter.h b/llvm/include/llvm/CodeGen/DwarfWriter.h index 7d04e0abccf..3c8ef877ea0 100644 --- a/llvm/include/llvm/CodeGen/DwarfWriter.h +++ b/llvm/include/llvm/CodeGen/DwarfWriter.h @@ -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); + } }; //===--------------------------------------------------------------------===// diff --git a/llvm/lib/CodeGen/DwarfWriter.cpp b/llvm/lib/CodeGen/DwarfWriter.cpp index a5424d048b4..09ec6f1458d 100644 --- a/llvm/lib/CodeGen/DwarfWriter.cpp +++ b/llvm/lib/CodeGen/DwarfWriter.cpp @@ -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; |

