diff options
| author | David Blaikie <dblaikie@gmail.com> | 2014-11-02 03:09:13 +0000 |
|---|---|---|
| committer | David Blaikie <dblaikie@gmail.com> | 2014-11-02 03:09:13 +0000 |
| commit | 871c2d9d63273e326dd7fac1ce70cd0a0b604b81 (patch) | |
| tree | 5e3e0526beca1ea9baf6afc56ff72660aa1a4fb3 /llvm/lib/CodeGen | |
| parent | ce47366150a3d4e3fc09b6851030d503da43b176 (diff) | |
| download | bcm5719-llvm-871c2d9d63273e326dd7fac1ce70cd0a0b604b81.tar.gz bcm5719-llvm-871c2d9d63273e326dd7fac1ce70cd0a0b604b81.zip | |
DebugInfo: Refactor index type DIE initialization by rolling it into the accessor
llvm-svn: 221080
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp | 21 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h | 2 |
2 files changed, 13 insertions, 10 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp index 065026677d0..c49edd8daca 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp @@ -1525,6 +1525,18 @@ void DwarfUnit::constructSubrangeDIE(DIE &Buffer, DISubrange SR, DIE *IndexTy) { addUInt(DW_Subrange, dwarf::DW_AT_count, None, Count); } +DIE *DwarfUnit::getIndexTyDie() { + if (IndexTyDie) + return IndexTyDie; + // Construct an integer type to use for indexes. + IndexTyDie = &createAndAddDIE(dwarf::DW_TAG_base_type, UnitDie); + addString(*IndexTyDie, dwarf::DW_AT_name, "sizetype"); + addUInt(*IndexTyDie, dwarf::DW_AT_byte_size, None, sizeof(int64_t)); + addUInt(*IndexTyDie, dwarf::DW_AT_encoding, dwarf::DW_FORM_data1, + dwarf::DW_ATE_unsigned); + return IndexTyDie; +} + /// constructArrayTypeDIE - Construct array type DIE from DICompositeType. void DwarfUnit::constructArrayTypeDIE(DIE &Buffer, DICompositeType CTy) { if (CTy.isVector()) @@ -1537,15 +1549,6 @@ void DwarfUnit::constructArrayTypeDIE(DIE &Buffer, DICompositeType CTy) { // FIXME: This type should be passed down from the front end // as different languages may have different sizes for indexes. DIE *IdxTy = getIndexTyDie(); - if (!IdxTy) { - // Construct an integer type to use for indexes. - IdxTy = &createAndAddDIE(dwarf::DW_TAG_base_type, UnitDie); - addString(*IdxTy, dwarf::DW_AT_name, "sizetype"); - addUInt(*IdxTy, dwarf::DW_AT_byte_size, None, sizeof(int64_t)); - addUInt(*IdxTy, dwarf::DW_AT_encoding, dwarf::DW_FORM_data1, - dwarf::DW_ATE_unsigned); - setIndexTyDie(IdxTy); - } // Add subranges to array type. DIArray Elements = CTy.getElements(); diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h index de43f8f507e..ce92b417536 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h @@ -430,7 +430,7 @@ private: } // getIndexTyDie - Get an anonymous type for index type. - DIE *getIndexTyDie() { return IndexTyDie; } + DIE *getIndexTyDie(); // setIndexTyDie - Set D as anonymous type for index which can be reused // later. |

