1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00

DebugInfo: Sink accelerator table lists down (GlobalNames/Types) into DwarfCompileUnit

llvm-svn: 221083
This commit is contained in:
David Blaikie 2014-11-02 06:16:39 +00:00
parent 5e147c4bc9
commit 9a1d2d413e
6 changed files with 42 additions and 33 deletions

View File

@ -694,5 +694,22 @@ void DwarfCompileUnit::emitHeader(const MCSymbol *ASectionSym) const {
DwarfUnit::emitHeader(ASectionSym);
}
/// addGlobalName - Add a new global name to the compile unit.
void DwarfCompileUnit::addGlobalName(StringRef Name, DIE &Die,
DIScope Context) {
if (getCUNode().getEmissionKind() == DIBuilder::LineTablesOnly)
return;
std::string FullName = getParentContextString(Context) + Name.str();
GlobalNames[FullName] = &Die;
}
/// Add a new global type to the unit.
void DwarfCompileUnit::addGlobalType(DIType Ty, const DIE &Die,
DIScope Context) {
if (getCUNode().getEmissionKind() == DIBuilder::LineTablesOnly)
return;
std::string FullName = getParentContextString(Context) + Ty.getName().str();
GlobalTypes[FullName] = &Die;
}
} // end llvm namespace

View File

@ -42,6 +42,12 @@ class DwarfCompileUnit : public DwarfUnit {
/// The start of the unit within its section.
MCSymbol *LabelBegin;
/// GlobalNames - A map of globally visible named entities for this unit.
StringMap<const DIE *> GlobalNames;
/// GlobalTypes - A map of globally visible types for this unit.
StringMap<const DIE *> GlobalTypes;
/// \brief Construct a DIE for the given DbgVariable without initializing the
/// DbgVariable's DIE reference.
std::unique_ptr<DIE> constructVariableDIEImpl(const DbgVariable &DV,
@ -176,6 +182,15 @@ public:
assert(Section);
return LabelBegin;
}
/// Add a new global name to the compile unit.
void addGlobalName(StringRef Name, DIE &Die, DIScope Context) override;
/// Add a new global type to the compile unit.
void addGlobalType(DIType Ty, const DIE &Die, DIScope Context) override;
const StringMap<const DIE *> &getGlobalNames() const { return GlobalNames; }
const StringMap<const DIE *> &getGlobalTypes() const { return GlobalTypes; }
};
} // end llvm namespace

View File

@ -1562,12 +1562,13 @@ void DwarfDebug::emitDebugPubNames(bool GnuStyle) {
GnuStyle ? Asm->getObjFileLowering().getDwarfGnuPubNamesSection()
: Asm->getObjFileLowering().getDwarfPubNamesSection();
emitDebugPubSection(GnuStyle, PSec, "Names", &DwarfUnit::getGlobalNames);
emitDebugPubSection(GnuStyle, PSec, "Names",
&DwarfCompileUnit::getGlobalNames);
}
void DwarfDebug::emitDebugPubSection(
bool GnuStyle, const MCSection *PSec, StringRef Name,
const StringMap<const DIE *> &(DwarfUnit::*Accessor)() const) {
const StringMap<const DIE *> &(DwarfCompileUnit::*Accessor)() const) {
for (const auto &NU : CUMap) {
DwarfCompileUnit *TheU = NU.second;
@ -1631,7 +1632,8 @@ void DwarfDebug::emitDebugPubTypes(bool GnuStyle) {
GnuStyle ? Asm->getObjFileLowering().getDwarfGnuPubTypesSection()
: Asm->getObjFileLowering().getDwarfPubTypesSection();
emitDebugPubSection(GnuStyle, PSec, "Types", &DwarfUnit::getGlobalTypes);
emitDebugPubSection(GnuStyle, PSec, "Types",
&DwarfCompileUnit::getGlobalTypes);
}
// Emit visible names into a debug str section.

View File

@ -396,10 +396,9 @@ class DwarfDebug : public AsmPrinterHandler {
/// index.
void emitDebugPubTypes(bool GnuStyle = false);
void
emitDebugPubSection(bool GnuStyle, const MCSection *PSec, StringRef Name,
const StringMap<const DIE *> &(DwarfUnit::*Accessor)()
const);
void emitDebugPubSection(
bool GnuStyle, const MCSection *PSec, StringRef Name,
const StringMap<const DIE *> &(DwarfCompileUnit::*Accessor)() const);
/// \brief Emit visible names into a debug str section.
void emitDebugStr();

View File

@ -1003,22 +1003,6 @@ void DwarfUnit::addType(DIE &Entity, DIType Ty, dwarf::Attribute Attribute) {
addDIEEntry(Entity, Attribute, Entry);
}
/// addGlobalName - Add a new global name to the compile unit.
void DwarfUnit::addGlobalName(StringRef Name, DIE &Die, DIScope Context) {
if (getCUNode().getEmissionKind() == DIBuilder::LineTablesOnly)
return;
std::string FullName = getParentContextString(Context) + Name.str();
GlobalNames[FullName] = &Die;
}
/// Add a new global type to the unit.
void DwarfUnit::addGlobalType(DIType Ty, const DIE &Die, DIScope Context) {
if (getCUNode().getEmissionKind() == DIBuilder::LineTablesOnly)
return;
std::string FullName = getParentContextString(Context) + Ty.getName().str();
GlobalTypes[FullName] = &Die;
}
/// getParentContextString - Walks the metadata parent chain in a language
/// specific manner (using the compile unit language) and returns
/// it as a string. This is done at the metadata level because DIEs may

View File

@ -96,12 +96,6 @@ protected:
/// descriptors to debug information entries using a DIEEntry proxy.
DenseMap<const MDNode *, DIEEntry *> MDNodeToDIEEntryMap;
/// GlobalNames - A map of globally visible named entities for this unit.
StringMap<const DIE *> GlobalNames;
/// GlobalTypes - A map of globally visible types for this unit.
StringMap<const DIE *> GlobalTypes;
/// DIEBlocks - A list of all the DIEBlocks in use.
std::vector<DIEBlock *> DIEBlocks;
@ -146,8 +140,6 @@ public:
uint16_t getLanguage() const { return CUNode.getLanguage(); }
DICompileUnit getCUNode() const { return CUNode; }
DIE &getUnitDie() { return UnitDie; }
const StringMap<const DIE *> &getGlobalNames() const { return GlobalNames; }
const StringMap<const DIE *> &getGlobalTypes() const { return GlobalTypes; }
unsigned getDebugInfoOffset() const { return DebugInfoOffset; }
void setDebugInfoOffset(unsigned DbgInfoOff) { DebugInfoOffset = DbgInfoOff; }
@ -175,10 +167,10 @@ public:
std::string getParentContextString(DIScope Context) const;
/// Add a new global name to the compile unit.
void addGlobalName(StringRef Name, DIE &Die, DIScope Context);
virtual void addGlobalName(StringRef Name, DIE &Die, DIScope Context) {}
/// Add a new global type to the compile unit.
void addGlobalType(DIType Ty, const DIE &Die, DIScope Context);
virtual void addGlobalType(DIType Ty, const DIE &Die, DIScope Context) {}
/// addAccelNamespace - Add a new name to the namespace accelerator table.
void addAccelNamespace(StringRef Name, const DIE &Die);