mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-10 02:25:47 +00:00
DwarfDebug: Include type units in accelerator tables.
Since type units aren't in the CUMap, use the DwarfUnits list to iterate over units for tasks such as accelerator table building. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195776 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1063,10 +1063,10 @@ void DwarfDebug::finalizeModuleInfo() {
|
|||||||
computeInlinedDIEs();
|
computeInlinedDIEs();
|
||||||
|
|
||||||
// Handle anything that needs to be done on a per-cu basis.
|
// Handle anything that needs to be done on a per-cu basis.
|
||||||
for (DenseMap<const MDNode *, CompileUnit *>::iterator CUI = CUMap.begin(),
|
for (SmallVectorImpl<CompileUnit *>::const_iterator I = getUnits().begin(),
|
||||||
CUE = CUMap.end();
|
E = getUnits().end();
|
||||||
CUI != CUE; ++CUI) {
|
I != E; ++I) {
|
||||||
CompileUnit *TheCU = CUI->second;
|
CompileUnit *TheCU = *I;
|
||||||
// Emit DW_AT_containing_type attribute to connect types with their
|
// Emit DW_AT_containing_type attribute to connect types with their
|
||||||
// vtable holding type.
|
// vtable holding type.
|
||||||
TheCU->constructContainingTypeDIEs();
|
TheCU->constructContainingTypeDIEs();
|
||||||
@@ -1953,7 +1953,8 @@ void DwarfUnits::computeSizeAndOffsets() {
|
|||||||
|
|
||||||
// Iterate over each compile unit and set the size and offsets for each
|
// Iterate over each compile unit and set the size and offsets for each
|
||||||
// DIE within each compile unit. All offsets are CU relative.
|
// DIE within each compile unit. All offsets are CU relative.
|
||||||
for (SmallVectorImpl<CompileUnit *>::iterator I = CUs.begin(), E = CUs.end();
|
for (SmallVectorImpl<CompileUnit *>::const_iterator I = CUs.begin(),
|
||||||
|
E = CUs.end();
|
||||||
I != E; ++I) {
|
I != E; ++I) {
|
||||||
(*I)->setDebugInfoOffset(SecOffset);
|
(*I)->setDebugInfoOffset(SecOffset);
|
||||||
|
|
||||||
@@ -2227,10 +2228,10 @@ void DwarfDebug::emitEndOfLineMatrix(unsigned SectionEnd) {
|
|||||||
void DwarfDebug::emitAccelNames() {
|
void DwarfDebug::emitAccelNames() {
|
||||||
DwarfAccelTable AT(
|
DwarfAccelTable AT(
|
||||||
DwarfAccelTable::Atom(dwarf::DW_ATOM_die_offset, dwarf::DW_FORM_data4));
|
DwarfAccelTable::Atom(dwarf::DW_ATOM_die_offset, dwarf::DW_FORM_data4));
|
||||||
for (DenseMap<const MDNode *, CompileUnit *>::iterator I = CUMap.begin(),
|
for (SmallVectorImpl<CompileUnit *>::const_iterator I = getUnits().begin(),
|
||||||
E = CUMap.end();
|
E = getUnits().end();
|
||||||
I != E; ++I) {
|
I != E; ++I) {
|
||||||
CompileUnit *TheCU = I->second;
|
CompileUnit *TheCU = *I;
|
||||||
const StringMap<std::vector<const DIE *> > &Names = TheCU->getAccelNames();
|
const StringMap<std::vector<const DIE *> > &Names = TheCU->getAccelNames();
|
||||||
for (StringMap<std::vector<const DIE *> >::const_iterator
|
for (StringMap<std::vector<const DIE *> >::const_iterator
|
||||||
GI = Names.begin(),
|
GI = Names.begin(),
|
||||||
@@ -2260,10 +2261,10 @@ void DwarfDebug::emitAccelNames() {
|
|||||||
void DwarfDebug::emitAccelObjC() {
|
void DwarfDebug::emitAccelObjC() {
|
||||||
DwarfAccelTable AT(
|
DwarfAccelTable AT(
|
||||||
DwarfAccelTable::Atom(dwarf::DW_ATOM_die_offset, dwarf::DW_FORM_data4));
|
DwarfAccelTable::Atom(dwarf::DW_ATOM_die_offset, dwarf::DW_FORM_data4));
|
||||||
for (DenseMap<const MDNode *, CompileUnit *>::iterator I = CUMap.begin(),
|
for (SmallVectorImpl<CompileUnit *>::const_iterator I = getUnits().begin(),
|
||||||
E = CUMap.end();
|
E = getUnits().end();
|
||||||
I != E; ++I) {
|
I != E; ++I) {
|
||||||
CompileUnit *TheCU = I->second;
|
CompileUnit *TheCU = *I;
|
||||||
const StringMap<std::vector<const DIE *> > &Names = TheCU->getAccelObjC();
|
const StringMap<std::vector<const DIE *> > &Names = TheCU->getAccelObjC();
|
||||||
for (StringMap<std::vector<const DIE *> >::const_iterator
|
for (StringMap<std::vector<const DIE *> >::const_iterator
|
||||||
GI = Names.begin(),
|
GI = Names.begin(),
|
||||||
@@ -2292,10 +2293,10 @@ void DwarfDebug::emitAccelObjC() {
|
|||||||
void DwarfDebug::emitAccelNamespaces() {
|
void DwarfDebug::emitAccelNamespaces() {
|
||||||
DwarfAccelTable AT(
|
DwarfAccelTable AT(
|
||||||
DwarfAccelTable::Atom(dwarf::DW_ATOM_die_offset, dwarf::DW_FORM_data4));
|
DwarfAccelTable::Atom(dwarf::DW_ATOM_die_offset, dwarf::DW_FORM_data4));
|
||||||
for (DenseMap<const MDNode *, CompileUnit *>::iterator I = CUMap.begin(),
|
for (SmallVectorImpl<CompileUnit *>::const_iterator I = getUnits().begin(),
|
||||||
E = CUMap.end();
|
E = getUnits().end();
|
||||||
I != E; ++I) {
|
I != E; ++I) {
|
||||||
CompileUnit *TheCU = I->second;
|
CompileUnit *TheCU = *I;
|
||||||
const StringMap<std::vector<const DIE *> > &Names =
|
const StringMap<std::vector<const DIE *> > &Names =
|
||||||
TheCU->getAccelNamespace();
|
TheCU->getAccelNamespace();
|
||||||
for (StringMap<std::vector<const DIE *> >::const_iterator
|
for (StringMap<std::vector<const DIE *> >::const_iterator
|
||||||
@@ -2331,10 +2332,10 @@ void DwarfDebug::emitAccelTypes() {
|
|||||||
Atoms.push_back(
|
Atoms.push_back(
|
||||||
DwarfAccelTable::Atom(dwarf::DW_ATOM_type_flags, dwarf::DW_FORM_data1));
|
DwarfAccelTable::Atom(dwarf::DW_ATOM_type_flags, dwarf::DW_FORM_data1));
|
||||||
DwarfAccelTable AT(Atoms);
|
DwarfAccelTable AT(Atoms);
|
||||||
for (DenseMap<const MDNode *, CompileUnit *>::iterator I = CUMap.begin(),
|
for (SmallVectorImpl<CompileUnit *>::const_iterator I = getUnits().begin(),
|
||||||
E = CUMap.end();
|
E = getUnits().end();
|
||||||
I != E; ++I) {
|
I != E; ++I) {
|
||||||
CompileUnit *TheCU = I->second;
|
CompileUnit *TheCU = *I;
|
||||||
const StringMap<std::vector<std::pair<const DIE *, unsigned> > > &Names =
|
const StringMap<std::vector<std::pair<const DIE *, unsigned> > > &Names =
|
||||||
TheCU->getAccelTypes();
|
TheCU->getAccelTypes();
|
||||||
for (StringMap<
|
for (StringMap<
|
||||||
@@ -2428,9 +2429,10 @@ void DwarfDebug::emitDebugPubNames(bool GnuStyle) {
|
|||||||
GnuStyle ? Asm->getObjFileLowering().getDwarfGnuPubNamesSection()
|
GnuStyle ? Asm->getObjFileLowering().getDwarfGnuPubNamesSection()
|
||||||
: Asm->getObjFileLowering().getDwarfPubNamesSection();
|
: Asm->getObjFileLowering().getDwarfPubNamesSection();
|
||||||
|
|
||||||
typedef DenseMap<const MDNode *, CompileUnit *> CUMapType;
|
for (SmallVectorImpl<CompileUnit *>::const_iterator I = getUnits().begin(),
|
||||||
for (CUMapType::iterator I = CUMap.begin(), E = CUMap.end(); I != E; ++I) {
|
E = getUnits().end();
|
||||||
CompileUnit *TheCU = I->second;
|
I != E; ++I) {
|
||||||
|
CompileUnit *TheCU = *I;
|
||||||
unsigned ID = TheCU->getUniqueID();
|
unsigned ID = TheCU->getUniqueID();
|
||||||
|
|
||||||
// Start the dwarf pubnames section.
|
// Start the dwarf pubnames section.
|
||||||
@@ -2496,10 +2498,10 @@ void DwarfDebug::emitDebugPubTypes(bool GnuStyle) {
|
|||||||
GnuStyle ? Asm->getObjFileLowering().getDwarfGnuPubTypesSection()
|
GnuStyle ? Asm->getObjFileLowering().getDwarfGnuPubTypesSection()
|
||||||
: Asm->getObjFileLowering().getDwarfPubTypesSection();
|
: Asm->getObjFileLowering().getDwarfPubTypesSection();
|
||||||
|
|
||||||
for (DenseMap<const MDNode *, CompileUnit *>::iterator I = CUMap.begin(),
|
for (SmallVectorImpl<CompileUnit *>::const_iterator I = getUnits().begin(),
|
||||||
E = CUMap.end();
|
E = getUnits().end();
|
||||||
I != E; ++I) {
|
I != E; ++I) {
|
||||||
CompileUnit *TheCU = I->second;
|
CompileUnit *TheCU = *I;
|
||||||
// Start the dwarf pubtypes section.
|
// Start the dwarf pubtypes section.
|
||||||
Asm->OutStreamer.SwitchSection(PSec);
|
Asm->OutStreamer.SwitchSection(PSec);
|
||||||
|
|
||||||
|
@@ -258,6 +258,8 @@ public:
|
|||||||
|
|
||||||
~DwarfUnits();
|
~DwarfUnits();
|
||||||
|
|
||||||
|
const SmallVectorImpl<CompileUnit *> &getUnits() { return CUs; }
|
||||||
|
|
||||||
/// \brief Compute the size and offset of a DIE given an incoming Offset.
|
/// \brief Compute the size and offset of a DIE given an incoming Offset.
|
||||||
unsigned computeSizeAndOffset(DIE *Die, unsigned Offset);
|
unsigned computeSizeAndOffset(DIE *Die, unsigned Offset);
|
||||||
|
|
||||||
@@ -479,10 +481,12 @@ class DwarfDebug {
|
|||||||
// Holder for the skeleton information.
|
// Holder for the skeleton information.
|
||||||
DwarfUnits SkeletonHolder;
|
DwarfUnits SkeletonHolder;
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
void addScopeVariable(LexicalScope *LS, DbgVariable *Var);
|
void addScopeVariable(LexicalScope *LS, DbgVariable *Var);
|
||||||
|
|
||||||
|
const SmallVectorImpl<CompileUnit *> &getUnits() {
|
||||||
|
return InfoHolder.getUnits();
|
||||||
|
}
|
||||||
|
|
||||||
/// \brief Find abstract variable associated with Var.
|
/// \brief Find abstract variable associated with Var.
|
||||||
DbgVariable *findAbstractVariable(DIVariable &Var, DebugLoc Loc);
|
DbgVariable *findAbstractVariable(DIVariable &Var, DebugLoc Loc);
|
||||||
|
|
||||||
|
@@ -91,11 +91,29 @@
|
|||||||
; CHECK: DW_TAG_structure_type
|
; CHECK: DW_TAG_structure_type
|
||||||
; CHECK-NEXT: debug_str{{.*}}"wombat"
|
; CHECK-NEXT: debug_str{{.*}}"wombat"
|
||||||
|
|
||||||
; Don't emit pubtype entries for type DIEs in the compile unit that just indirect to a type unit.
|
; Use the unit size as a rough hash/identifier for the unit we're dealing with
|
||||||
|
; it happens to be unambiguous at the moment, but it's hardly ideal.
|
||||||
; CHECK-LABEL: .debug_pubtypes contents:
|
; CHECK-LABEL: .debug_pubtypes contents:
|
||||||
; CHECK-NEXT: unit_offset = 0x00000000
|
; Don't emit pubtype entries for type DIEs in the compile unit that just indirect to a type unit.
|
||||||
; CHECK-NEXT: Offset
|
; CHECK-NEXT: unit_size = 0x00000174
|
||||||
; CHECK-NEXT: {{^$}}
|
; CHECK-NEXT: Offset Name
|
||||||
|
; Type unit for 'bar'
|
||||||
|
; CHECK-NEXT: unit_size = 0x0000001f
|
||||||
|
; CHECK-NEXT: Offset Name
|
||||||
|
; CHECK-NEXT: "bar"
|
||||||
|
; CHECK-NEXT: unit_size = 0x00000059
|
||||||
|
; CHECK-NEXT: Offset Name
|
||||||
|
; CHECK-NEXT: "int"
|
||||||
|
; CHECK-NEXT: "echidna::capybara::mongoose::fluffy"
|
||||||
|
; CHECK-NEXT: unit_size = 0x0000002f
|
||||||
|
; CHECK-NEXT: Offset Name
|
||||||
|
; CHECK-NEXT: "walrus"
|
||||||
|
; CHECK-NEXT: unit_size = 0x0000003f
|
||||||
|
; CHECK-NEXT: Offset Name
|
||||||
|
; CHECK-NEXT: "int"
|
||||||
|
; CHECK-NEXT: unit_size = 0x00000036
|
||||||
|
; CHECK-NEXT: Offset Name
|
||||||
|
; CHECK-NEXT: "wombat"
|
||||||
|
|
||||||
%struct.bar = type { i8 }
|
%struct.bar = type { i8 }
|
||||||
%"class.echidna::capybara::mongoose::fluffy" = type { i32, i32 }
|
%"class.echidna::capybara::mongoose::fluffy" = type { i32, i32 }
|
||||||
|
Reference in New Issue
Block a user