aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/AsmPrinter/DwarfDebug.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
commitb8b70e10a2b3f252314e0d176379778fe8f3b582 (patch)
treebc8eda4c9cd5ed6c4cd419ba90c867160b6d3005 /lib/CodeGen/AsmPrinter/DwarfDebug.cpp
parent6d6e66a3eeb579794378dd528e73645ea54bc69b (diff)
downloadexternal_llvm-b8b70e10a2b3f252314e0d176379778fe8f3b582.zip
external_llvm-b8b70e10a2b3f252314e0d176379778fe8f3b582.tar.gz
external_llvm-b8b70e10a2b3f252314e0d176379778fe8f3b582.tar.bz2
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193779 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter/DwarfDebug.cpp')
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfDebug.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 771cb32..d18b7a5 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -2083,6 +2083,9 @@ void DwarfDebug::emitDIE(DIE *Die, ArrayRef<DIEAbbrev *> Abbrevs) {
DwarfInfoSectionSym,
DIEEntry::getRefAddrSize(Asm));
} else {
+ // Make sure Origin belong to the same CU.
+ assert(Die->getCompileUnit() == Origin->getCompileUnit() &&
+ "The referenced DIE should belong to the same CU in ref4");
Asm->EmitInt32(Addr);
}
break;