Add the start of DIE hashing for DWARF4 type units and split dwarf

CUs.

Currently only hashes the name of CUs and the names of any children,
but it's an obvious first step to show the framework. The testcase
should continue to be correct, however, as it's an empty TU.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188243 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Christopher
2013-08-13 01:21:55 +00:00
parent 72dba254ae
commit 0710bfa866
4 changed files with 164 additions and 5 deletions

View File

@ -67,6 +67,11 @@ GenerateODRHash("generate-odr-hash", cl::Hidden,
cl::desc("Add an ODR hash to external type DIEs."),
cl::init(false));
static cl::opt<bool>
GenerateCUHash("generate-cu-hash", cl::Hidden,
cl::desc("Add the CU hash as the dwo_id."),
cl::init(false));
namespace {
enum DefaultOnOff {
Default,
@ -1024,14 +1029,19 @@ void DwarfDebug::finalizeModuleInfo() {
// If we're splitting the dwarf out now that we've got the entire
// CU then construct a skeleton CU based upon it.
if (useSplitDwarf()) {
uint64_t ID = 0;
if (GenerateCUHash) {
DIEHash CUHash;
ID = CUHash.computeCUSignature(TheCU->getCUDie());
}
// This should be a unique identifier when we want to build .dwp files.
TheCU->addUInt(TheCU->getCUDie(), dwarf::DW_AT_GNU_dwo_id,
dwarf::DW_FORM_data8, 0);
dwarf::DW_FORM_data8, ID);
// Now construct the skeleton CU associated.
CompileUnit *SkCU = constructSkeletonCU(CUI->first);
// This should be a unique identifier when we want to build .dwp files.
SkCU->addUInt(SkCU->getCUDie(), dwarf::DW_AT_GNU_dwo_id,
dwarf::DW_FORM_data8, 0);
dwarf::DW_FORM_data8, ID);
}
}