diff options
| author | David Blaikie <dblaikie@gmail.com> | 2013-12-06 19:38:46 +0000 |
|---|---|---|
| committer | David Blaikie <dblaikie@gmail.com> | 2013-12-06 19:38:46 +0000 |
| commit | 2666e24ca57a1a68f28127b84fe9d6eca46ca9f1 (patch) | |
| tree | 1c1da2b121453a026694b939d93d4831021ed96c /llvm/lib | |
| parent | f5308fac1e8205a862fdcfe9e5c8f66cf3c9c4d3 (diff) | |
| download | bcm5719-llvm-2666e24ca57a1a68f28127b84fe9d6eca46ca9f1.tar.gz bcm5719-llvm-2666e24ca57a1a68f28127b84fe9d6eca46ca9f1.zip | |
DebugInfo: Ensure unit IDs (for non-skeletal units) match thein index in the list
This simplifies reasoning about the code and enables simple navigation
from a skeleton to its full unit. (currently there are no type unit
skeletons, so the skeleton list doesn't have the same ID == index
property)
Eventually we should get rid of this ID and just store the labels we
need as the IDs are allowing this code to create difficult to
manage/understand associations (loops over non-skeletal units are
implicitly referencing their skeletal units during pub* emission, for
example). It may be necessary to have some kind of skeleton->full unit
association and a more direct pointer or similar device would be
preferable than an index.
llvm-svn: 196600
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 18 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h | 3 |
2 files changed, 9 insertions, 12 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index dffd4e03e27..7d780d1c2ed 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -179,7 +179,7 @@ static unsigned getDwarfVersionFromModule(const Module *M) { DwarfDebug::DwarfDebug(AsmPrinter *A, Module *M) : Asm(A), MMI(Asm->MMI), FirstCU(0), SourceIdMap(DIEValueAllocator), - PrevLabel(NULL), GlobalCUIndexCount(0), GlobalRangeCount(0), + PrevLabel(NULL), GlobalRangeCount(0), InfoHolder(A, "info_string", DIEValueAllocator), SkeletonHolder(A, "skel_string", DIEValueAllocator) { @@ -747,8 +747,10 @@ CompileUnit *DwarfDebug::constructCompileUnit(DICompileUnit DIUnit) { CompilationDir = DIUnit.getDirectory(); DIE *Die = new DIE(dwarf::DW_TAG_compile_unit); - CompileUnit *NewCU = new CompileUnit(GlobalCUIndexCount++, Die, DIUnit, Asm, - this, &InfoHolder); + CompileUnit *NewCU = new CompileUnit(InfoHolder.getUnits().size(), Die, + DIUnit, Asm, this, &InfoHolder); + InfoHolder.addUnit(NewCU); + FileIDCUMap[NewCU->getUniqueID()] = 0; // Call this to emit a .file directive if it wasn't emitted for the source @@ -816,8 +818,6 @@ CompileUnit *DwarfDebug::constructCompileUnit(DICompileUnit DIUnit) { if (!FirstCU) FirstCU = NewCU; - InfoHolder.addUnit(NewCU); - CUMap.insert(std::make_pair(DIUnit, NewCU)); CUDieMap.insert(std::make_pair(Die, NewCU)); return NewCU; @@ -3048,8 +3048,10 @@ void DwarfDebug::addTypeUnitType(uint16_t Language, DIE *RefDie, } } else { DIE *UnitDie = new DIE(dwarf::DW_TAG_type_unit); - TypeUnit *NewTU = new TypeUnit(GlobalCUIndexCount++, UnitDie, Language, Asm, - this, &InfoHolder); + TypeUnit *NewTU = new TypeUnit(InfoHolder.getUnits().size(), UnitDie, + Language, Asm, this, &InfoHolder); + InfoHolder.addUnit(NewTU); + NewTU->addUInt(UnitDie, dwarf::DW_AT_language, dwarf::DW_FORM_data2, Language); @@ -3077,8 +3079,6 @@ void DwarfDebug::addTypeUnitType(uint16_t Language, DIE *RefDie, // Remove the References vector and add the type hash. I->second.first = Signature; I->second.second = NULL; - - InfoHolder.addUnit(NewTU); } // Populate all the signatures. diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h index d188735f870..567301dab64 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h @@ -437,9 +437,6 @@ class DwarfDebug : public AsmPrinterHandler { // table for the same directory as DW_AT_comp_dir. StringRef CompilationDir; - // Counter for assigning globally unique IDs for CUs. - unsigned GlobalCUIndexCount; - // Counter for assigning globally unique IDs for ranges. unsigned GlobalRangeCount; |

