summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/DIE.cpp
diff options
context:
space:
mode:
authorManman Ren <manman.ren@gmail.com>2013-10-31 17:54:35 +0000
committerManman Ren <manman.ren@gmail.com>2013-10-31 17:54:35 +0000
commit4dbdc9021d7f655a8a5bd6c97806a9069778252a (patch)
treef28d57a6b63611b2f7da5cc399b63f245706a943 /llvm/lib/CodeGen/AsmPrinter/DIE.cpp
parent8d72f4a06fb6bc054493455e5f2db722b1df6395 (diff)
downloadbcm5719-llvm-4dbdc9021d7f655a8a5bd6c97806a9069778252a.tar.gz
bcm5719-llvm-4dbdc9021d7f655a8a5bd6c97806a9069778252a.zip
Debug Info: remove duplication of DIEs when a DIE can be shared across CUs.
We add a map in DwarfDebug to map MDNodes that are shareable across CUs to the corresponding DIEs: MDTypeNodeToDieMap. These DIEs can be shared across CUs, that is why we keep the maps in DwarfDebug instead of CompileUnit. We make the assumption that if a DIE is not added to an owner yet, we assume it belongs to the current CU. Since DIEs for the type system are added to their owners immediately after creation, and other DIEs belong to the current CU, the assumption should be true. 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. We also add a testing case to show ref_addr relocations for non-darwin platforms. llvm-svn: 193779
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DIE.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DIE.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DIE.cpp b/llvm/lib/CodeGen/AsmPrinter/DIE.cpp
index 334c1083161..69444285f4e 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DIE.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DIE.cpp
@@ -115,13 +115,21 @@ DIE::~DIE() {
/// Climb up the parent chain to get the compile unit DIE to which this DIE
/// belongs.
const DIE *DIE::getCompileUnit() const {
+ const DIE *Cu = getCompileUnitOrNull();
+ 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.
+const DIE *DIE::getCompileUnitOrNull() const {
const 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) {
OpenPOWER on IntegriCloud