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 | 620f436b205ab75e1dd48b9af8823bc30c53fd0e (patch) | |
tree | 14f7063a4c9f6a7de435b7b16894045baeb9ffb0 /lib/CodeGen/AsmPrinter/DIE.cpp | |
parent | dfef7cbfc6a96d129b99750f554c7dbc000d3228 (diff) | |
download | external_llvm-620f436b205ab75e1dd48b9af8823bc30c53fd0e.zip external_llvm-620f436b205ab75e1dd48b9af8823bc30c53fd0e.tar.gz external_llvm-620f436b205ab75e1dd48b9af8823bc30c53fd0e.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191792 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter/DIE.cpp')
-rw-r--r-- | lib/CodeGen/AsmPrinter/DIE.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/CodeGen/AsmPrinter/DIE.cpp b/lib/CodeGen/AsmPrinter/DIE.cpp index 7fb3c90..7a14be6 100644 --- a/lib/CodeGen/AsmPrinter/DIE.cpp +++ b/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) { |