mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-26 05:32:25 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201445 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ff1677e9c5
commit
4b45137a4f
@ -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));
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -71,6 +71,7 @@
|
||||
; FISSION-NOT: type_signature
|
||||
; FISSION-LABEL: type_signature = 0x1d02f3be30cc5688
|
||||
; FISSION: DW_TAG_type_unit
|
||||
; FISSION: DW_AT_stmt_list [DW_FORM_sec_offset] (0x00000000)
|
||||
; FISSION: DW_AT_GNU_dwo_name{{.*}}"bar.dwo"
|
||||
; FISSION: DW_AT_comp_dir{{.*}}"/tmp/dbginfo"
|
||||
; FISSION-NOT: type_signature
|
||||
@ -114,6 +115,8 @@
|
||||
; CHECK-NOT: type_signature
|
||||
; CHECK-LABEL: type_signature = 0xe94f6d3843e62d6b
|
||||
; CHECK: DW_TAG_type_unit
|
||||
; SINGLE: DW_AT_stmt_list [DW_FORM_sec_offset] (0x00000000)
|
||||
; FISSION-NOT: DW_AT_stmt_list
|
||||
; CHECK-NOT: NULL
|
||||
; CHECK-NOT: DW_AT_GNU_odr_signature
|
||||
; CHECK: DW_TAG_structure_type
|
||||
@ -141,21 +144,21 @@
|
||||
; CHECK-NEXT: Offset Name
|
||||
; CHECK-NEXT: "walrus"
|
||||
; Type unit for 'bar'
|
||||
; SINGLE-NEXT: unit_size = 0x00000023
|
||||
; FISSION-NEXT: unit_size = 0x00000024
|
||||
; SINGLE-NEXT: unit_size = 0x00000027
|
||||
; FISSION-NEXT: unit_size = 0x00000028
|
||||
; CHECK-NEXT: Offset Name
|
||||
; CHECK-NEXT: "bar"
|
||||
; SINGLE-NEXT: unit_size = 0x0000005d
|
||||
; FISSION-NEXT: unit_size = 0x00000024
|
||||
; SINGLE-NEXT: unit_size = 0x00000061
|
||||
; FISSION-NEXT: unit_size = 0x00000028
|
||||
; CHECK-NEXT: Offset Name
|
||||
; CHECK-NEXT: "int"
|
||||
; CHECK-NEXT: "echidna::capybara::mongoose::fluffy"
|
||||
; SINGLE-NEXT: unit_size = 0x0000003a
|
||||
; FISSION-NEXT: unit_size = 0x00000024
|
||||
; SINGLE-NEXT: unit_size = 0x0000003e
|
||||
; FISSION-NEXT: unit_size = 0x00000028
|
||||
; CHECK-NEXT: Offset Name
|
||||
; CHECK-NEXT: "wombat"
|
||||
; SINGLE-NEXT: unit_size = 0x0000004b
|
||||
; FISSION-NEXT: unit_size = 0x00000024
|
||||
; SINGLE-NEXT: unit_size = 0x0000004f
|
||||
; FISSION-NEXT: unit_size = 0x00000028
|
||||
; CHECK-NEXT: Offset Name
|
||||
; CHECK-NEXT: "int"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user