diff options
author | Manman Ren <manman.ren@gmail.com> | 2013-10-01 19:52:23 +0000 |
---|---|---|
committer | Manman Ren <manman.ren@gmail.com> | 2013-10-01 19:52:23 +0000 |
commit | 8990d7ee842a2f4014046a7dc7eb4e1bdb9ef4c2 (patch) | |
tree | 66258883a93697129b5f4afacace222c0ab471ab /llvm/lib/CodeGen/AsmPrinter/DIE.cpp | |
parent | a4da6fb53577d16b61fab965284dbf4cb5a31ff2 (diff) | |
download | bcm5719-llvm-8990d7ee842a2f4014046a7dc7eb4e1bdb9ef4c2.tar.gz bcm5719-llvm-8990d7ee842a2f4014046a7dc7eb4e1bdb9ef4c2.zip |
Debug Info: remove duplication of DIEs when a DIE is part of the type system
and it is shared across CUs.
We add a few maps in DwarfDebug to map MDNodes for the type system to the
corresponding DIEs: MDTypeNodeToDieMap, MDSPNodeToDieMap, and
MDStaticMemberNodeToDieMap. These DIEs can be shared across CUs, that is why we
keep the maps in DwarfDebug instead of CompileUnit.
Sometimes, when we try to add an attribute to a DIE, the DIE is not yet added
to its owner yet, so we don't know whether we should use ref_addr or ref4.
We create a worklist that will be processed during finalization to add
attributes with the correct form (ref_addr or ref4).
We add addDIEEntry to DwarfDebug to be a wrapper around DIE->addValue. It checks
whether we know the correct form, if not, we update the worklist
(DIEEntryWorklist).
A testing case is added to show that we only create a single DIE for a type
MDNode and we use ref_addr to refer to the type DIE.
llvm-svn: 191792
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DIE.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DIE.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DIE.cpp b/llvm/lib/CodeGen/AsmPrinter/DIE.cpp index 7fb3c90dcb6..7a14be65e2a 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DIE.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DIE.cpp @@ -113,13 +113,21 @@ DIE::~DIE() { /// Climb up the parent chain to get the compile unit DIE to which this DIE /// belongs. DIE *DIE::getCompileUnit() { + DIE *Cu = checkCompileUnit(); + assert(Cu && "We should not have orphaned DIEs."); + return Cu; +} + +/// Climb up the parent chain to get the compile unit DIE this DIE belongs +/// to. Return NULL if DIE is not added to an owner yet. +DIE *DIE::checkCompileUnit() { DIE *p = this; while (p) { if (p->getTag() == dwarf::DW_TAG_compile_unit) return p; p = p->getParent(); } - llvm_unreachable("We should not have orphaned DIEs."); + return NULL; } DIEValue *DIE::findAttribute(uint16_t Attribute) { |