summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2014-02-14 23:58:13 +0000
committerDavid Blaikie <dblaikie@gmail.com>2014-02-14 23:58:13 +0000
commit60e6386b876c6cffc7dcf1db173cb9feeca9cded (patch)
tree126fbfd32da1540ad88bcb977b320cb158530615 /llvm/lib/CodeGen
parentdfade747f00d67766c24cb7ba7bcea31f403c4f9 (diff)
downloadbcm5719-llvm-60e6386b876c6cffc7dcf1db173cb9feeca9cded.tar.gz
bcm5719-llvm-60e6386b876c6cffc7dcf1db173cb9feeca9cded.zip
DebugInfo: Implement DW_AT_stmt_list for type units
Type units will share the statement list of their defining compile unit. This is a tradeoff that reduces .o debug info size at the cost of some linked debug info size (since the contents of those string tables won't be deduplicated along with the type unit) which seems right for now. llvm-svn: 201445
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp9
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp8
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h7
3 files changed, 22 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 4c5fe2ecb99..7ffc0b66068 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -2944,14 +2944,17 @@ DwarfCompileUnit *DwarfDebug::constructSkeletonCU(const DwarfCompileUnit *CU) {
// This DIE has the following attributes: DW_AT_comp_dir, DW_AT_dwo_name,
// DW_AT_addr_base.
DwarfTypeUnit *DwarfDebug::constructSkeletonTU(DwarfTypeUnit *TU) {
+ DwarfCompileUnit &CU = static_cast<DwarfCompileUnit &>(
+ *SkeletonHolder.getUnits()[TU->getCU().getUniqueID()]);
DIE *Die = new DIE(dwarf::DW_TAG_type_unit);
- DwarfTypeUnit *NewTU = new DwarfTypeUnit(TU->getUniqueID(), Die, TU->getCU(),
- Asm, this, &SkeletonHolder);
+ DwarfTypeUnit *NewTU =
+ new DwarfTypeUnit(TU->getUniqueID(), Die, CU, Asm, this, &SkeletonHolder);
NewTU->setTypeSignature(TU->getTypeSignature());
NewTU->setType(NULL);
NewTU->initSection(
Asm->getObjFileLowering().getDwarfTypesSection(TU->getTypeSignature()));
+ CU.applyStmtList(*Die);
initSkeletonUnit(TU, Die, NewTU);
return NewTU;
@@ -3020,6 +3023,8 @@ void DwarfDebug::addDwarfTypeUnitType(DwarfCompileUnit &CU,
NewTU->setTypeSignature(Signature);
if (useSplitDwarf())
NewTU->setSkeleton(constructSkeletonTU(NewTU));
+ else
+ CU.applyStmtList(*UnitDie);
NewTU->setType(NewTU->createTypeDIE(CTy));
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
index 661a5446c4f..ae92b6aa6d2 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
@@ -1990,6 +1990,8 @@ void DwarfCompileUnit::initStmtList(MCSymbol *DwarfLineSectionSym) {
bool UseTheFirstCU =
Asm->OutStreamer.hasRawTextSupport() || (getUniqueID() == 0);
+ stmtListIndex = UnitDie->getValues().size();
+
// DW_AT_stmt_list is a offset of line number information for this
// compile unit in debug_line section. For split dwarf this is
// left in the skeleton CU and so not included.
@@ -2005,6 +2007,12 @@ void DwarfCompileUnit::initStmtList(MCSymbol *DwarfLineSectionSym) {
DwarfLineSectionSym);
}
+void DwarfCompileUnit::applyStmtList(DIE &D) {
+ D.addValue(dwarf::DW_AT_stmt_list,
+ UnitDie->getAbbrev().getData()[stmtListIndex].getForm(),
+ UnitDie->getValues()[stmtListIndex]);
+}
+
void DwarfTypeUnit::emitHeader(const MCSection *ASection,
const MCSymbol *ASectionSym) const {
DwarfUnit::emitHeader(ASection, ASectionSym);
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
index bbbf3833159..2fa40cb63cb 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
@@ -539,12 +539,19 @@ private:
};
class DwarfCompileUnit : public DwarfUnit {
+ /// The attribute index of DW_AT_stmt_list in the compile unit DIE, avoiding
+ /// the need to search for it in applyStmtList.
+ unsigned stmtListIndex;
+
public:
DwarfCompileUnit(unsigned UID, DIE *D, DICompileUnit Node, AsmPrinter *A,
DwarfDebug *DW, DwarfFile *DWU);
void initStmtList(MCSymbol *DwarfLineSectionSym);
+ /// Apply the DW_AT_stmt_list from this compile unit to the specified DIE.
+ void applyStmtList(DIE &D);
+
/// createGlobalVariableDIE - create global variable DIE.
void createGlobalVariableDIE(DIGlobalVariable GV);
OpenPOWER on IntegriCloud