mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-26 05:25:47 +00:00
DebugInfo: Constify accelerator table handling, and separate type accelarator insertion in preparation for a second use of this code from type units.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195164 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -31,7 +31,7 @@ DwarfAccelTable::DwarfAccelTable(ArrayRef<DwarfAccelTable::Atom> atomList)
|
|||||||
|
|
||||||
DwarfAccelTable::~DwarfAccelTable() {}
|
DwarfAccelTable::~DwarfAccelTable() {}
|
||||||
|
|
||||||
void DwarfAccelTable::AddName(StringRef Name, DIE *die, char Flags) {
|
void DwarfAccelTable::AddName(StringRef Name, const DIE *die, char Flags) {
|
||||||
assert(Data.empty() && "Already finalized!");
|
assert(Data.empty() && "Already finalized!");
|
||||||
// If the string is in the list already then add this die to the list
|
// If the string is in the list already then add this die to the list
|
||||||
// otherwise add a new one.
|
// otherwise add a new one.
|
||||||
|
@@ -165,10 +165,10 @@ private:
|
|||||||
// HashData[hash_data_count]
|
// HashData[hash_data_count]
|
||||||
public:
|
public:
|
||||||
struct HashDataContents {
|
struct HashDataContents {
|
||||||
DIE *Die; // Offsets
|
const DIE *Die; // Offsets
|
||||||
char Flags; // Specific flags to output
|
char Flags; // Specific flags to output
|
||||||
|
|
||||||
HashDataContents(DIE *D, char Flags) : Die(D), Flags(Flags) {}
|
HashDataContents(const DIE *D, char Flags) : Die(D), Flags(Flags) {}
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
void print(raw_ostream &O) const {
|
void print(raw_ostream &O) const {
|
||||||
O << " Offset: " << Die->getOffset() << "\n";
|
O << " Offset: " << Die->getOffset() << "\n";
|
||||||
@@ -241,7 +241,7 @@ private:
|
|||||||
public:
|
public:
|
||||||
DwarfAccelTable(ArrayRef<DwarfAccelTable::Atom>);
|
DwarfAccelTable(ArrayRef<DwarfAccelTable::Atom>);
|
||||||
~DwarfAccelTable();
|
~DwarfAccelTable();
|
||||||
void AddName(StringRef, DIE *, char = 0);
|
void AddName(StringRef, const DIE *, char = 0);
|
||||||
void FinalizeTable(AsmPrinter *, StringRef);
|
void FinalizeTable(AsmPrinter *, StringRef);
|
||||||
void Emit(AsmPrinter *, MCSymbol *, DwarfUnits *);
|
void Emit(AsmPrinter *, MCSymbol *, DwarfUnits *);
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
|
@@ -900,8 +900,13 @@ DIE *CompileUnit::getOrCreateTypeDIE(const MDNode *TyNode) {
|
|||||||
assert(Ty.isDerivedType() && "Unknown kind of DIType");
|
assert(Ty.isDerivedType() && "Unknown kind of DIType");
|
||||||
constructTypeDIE(*TyDIE, DIDerivedType(Ty));
|
constructTypeDIE(*TyDIE, DIDerivedType(Ty));
|
||||||
}
|
}
|
||||||
// If this is a named finished type then include it in the list of types
|
|
||||||
// for the accelerator tables.
|
updateAcceleratorTables(Ty, TyDIE);
|
||||||
|
|
||||||
|
return TyDIE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CompileUnit::updateAcceleratorTables(DIType Ty, const DIE *TyDIE) {
|
||||||
if (!Ty.getName().empty() && !Ty.isForwardDecl()) {
|
if (!Ty.getName().empty() && !Ty.isForwardDecl()) {
|
||||||
bool IsImplementation = 0;
|
bool IsImplementation = 0;
|
||||||
if (Ty.isCompositeType()) {
|
if (Ty.isCompositeType()) {
|
||||||
@@ -913,8 +918,6 @@ DIE *CompileUnit::getOrCreateTypeDIE(const MDNode *TyNode) {
|
|||||||
unsigned Flags = IsImplementation ? dwarf::DW_FLAG_type_implementation : 0;
|
unsigned Flags = IsImplementation ? dwarf::DW_FLAG_type_implementation : 0;
|
||||||
addAccelType(Ty.getName(), std::make_pair(TyDIE, Flags));
|
addAccelType(Ty.getName(), std::make_pair(TyDIE, Flags));
|
||||||
}
|
}
|
||||||
|
|
||||||
return TyDIE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// addType - Add a new type attribute to the specified entity.
|
/// addType - Add a new type attribute to the specified entity.
|
||||||
@@ -946,27 +949,28 @@ void CompileUnit::addType(DIE *Entity, DIType Ty, dwarf::Attribute Attribute) {
|
|||||||
// DIE to the proper table while ensuring that the name that we're going
|
// DIE to the proper table while ensuring that the name that we're going
|
||||||
// to reference is in the string table. We do this since the names we
|
// to reference is in the string table. We do this since the names we
|
||||||
// add may not only be identical to the names in the DIE.
|
// add may not only be identical to the names in the DIE.
|
||||||
void CompileUnit::addAccelName(StringRef Name, DIE *Die) {
|
void CompileUnit::addAccelName(StringRef Name, const DIE *Die) {
|
||||||
DU->getStringPoolEntry(Name);
|
DU->getStringPoolEntry(Name);
|
||||||
std::vector<DIE *> &DIEs = AccelNames[Name];
|
std::vector<const DIE *> &DIEs = AccelNames[Name];
|
||||||
DIEs.push_back(Die);
|
DIEs.push_back(Die);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompileUnit::addAccelObjC(StringRef Name, DIE *Die) {
|
void CompileUnit::addAccelObjC(StringRef Name, const DIE *Die) {
|
||||||
DU->getStringPoolEntry(Name);
|
DU->getStringPoolEntry(Name);
|
||||||
std::vector<DIE *> &DIEs = AccelObjC[Name];
|
std::vector<const DIE *> &DIEs = AccelObjC[Name];
|
||||||
DIEs.push_back(Die);
|
DIEs.push_back(Die);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompileUnit::addAccelNamespace(StringRef Name, DIE *Die) {
|
void CompileUnit::addAccelNamespace(StringRef Name, const DIE *Die) {
|
||||||
DU->getStringPoolEntry(Name);
|
DU->getStringPoolEntry(Name);
|
||||||
std::vector<DIE *> &DIEs = AccelNamespace[Name];
|
std::vector<const DIE *> &DIEs = AccelNamespace[Name];
|
||||||
DIEs.push_back(Die);
|
DIEs.push_back(Die);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompileUnit::addAccelType(StringRef Name, std::pair<DIE *, unsigned> Die) {
|
void CompileUnit::addAccelType(StringRef Name,
|
||||||
|
std::pair<const DIE *, unsigned> Die) {
|
||||||
DU->getStringPoolEntry(Name);
|
DU->getStringPoolEntry(Name);
|
||||||
std::vector<std::pair<DIE *, unsigned> > &DIEs = AccelTypes[Name];
|
std::vector<std::pair<const DIE *, unsigned> > &DIEs = AccelTypes[Name];
|
||||||
DIEs.push_back(Die);
|
DIEs.push_back(Die);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -74,10 +74,10 @@ class CompileUnit {
|
|||||||
|
|
||||||
/// AccelNames - A map of names for the name accelerator table.
|
/// AccelNames - A map of names for the name accelerator table.
|
||||||
///
|
///
|
||||||
StringMap<std::vector<DIE *> > AccelNames;
|
StringMap<std::vector<const DIE *> > AccelNames;
|
||||||
StringMap<std::vector<DIE *> > AccelObjC;
|
StringMap<std::vector<const DIE *> > AccelObjC;
|
||||||
StringMap<std::vector<DIE *> > AccelNamespace;
|
StringMap<std::vector<const DIE *> > AccelNamespace;
|
||||||
StringMap<std::vector<std::pair<DIE *, unsigned> > > AccelTypes;
|
StringMap<std::vector<std::pair<const DIE *, unsigned> > > AccelTypes;
|
||||||
|
|
||||||
/// DIEBlocks - A list of all the DIEBlocks in use.
|
/// DIEBlocks - A list of all the DIEBlocks in use.
|
||||||
std::vector<DIEBlock *> DIEBlocks;
|
std::vector<DIEBlock *> DIEBlocks;
|
||||||
@@ -106,16 +106,16 @@ public:
|
|||||||
const StringMap<DIE *> &getGlobalNames() const { return GlobalNames; }
|
const StringMap<DIE *> &getGlobalNames() const { return GlobalNames; }
|
||||||
const StringMap<DIE *> &getGlobalTypes() const { return GlobalTypes; }
|
const StringMap<DIE *> &getGlobalTypes() const { return GlobalTypes; }
|
||||||
|
|
||||||
const StringMap<std::vector<DIE *> > &getAccelNames() const {
|
const StringMap<std::vector<const DIE *> > &getAccelNames() const {
|
||||||
return AccelNames;
|
return AccelNames;
|
||||||
}
|
}
|
||||||
const StringMap<std::vector<DIE *> > &getAccelObjC() const {
|
const StringMap<std::vector<const DIE *> > &getAccelObjC() const {
|
||||||
return AccelObjC;
|
return AccelObjC;
|
||||||
}
|
}
|
||||||
const StringMap<std::vector<DIE *> > &getAccelNamespace() const {
|
const StringMap<std::vector<const DIE *> > &getAccelNamespace() const {
|
||||||
return AccelNamespace;
|
return AccelNamespace;
|
||||||
}
|
}
|
||||||
const StringMap<std::vector<std::pair<DIE *, unsigned> > > &
|
const StringMap<std::vector<std::pair<const DIE *, unsigned> > > &
|
||||||
getAccelTypes() const {
|
getAccelTypes() const {
|
||||||
return AccelTypes;
|
return AccelTypes;
|
||||||
}
|
}
|
||||||
@@ -143,16 +143,16 @@ public:
|
|||||||
void addPubTypes(DISubprogram SP);
|
void addPubTypes(DISubprogram SP);
|
||||||
|
|
||||||
/// addAccelName - Add a new name to the name accelerator table.
|
/// addAccelName - Add a new name to the name accelerator table.
|
||||||
void addAccelName(StringRef Name, DIE *Die);
|
void addAccelName(StringRef Name, const DIE *Die);
|
||||||
|
|
||||||
/// addAccelObjC - Add a new name to the ObjC accelerator table.
|
/// addAccelObjC - Add a new name to the ObjC accelerator table.
|
||||||
void addAccelObjC(StringRef Name, DIE *Die);
|
void addAccelObjC(StringRef Name, const DIE *Die);
|
||||||
|
|
||||||
/// addAccelNamespace - Add a new name to the namespace accelerator table.
|
/// addAccelNamespace - Add a new name to the namespace accelerator table.
|
||||||
void addAccelNamespace(StringRef Name, DIE *Die);
|
void addAccelNamespace(StringRef Name, const DIE *Die);
|
||||||
|
|
||||||
/// addAccelType - Add a new type to the type accelerator table.
|
/// addAccelType - Add a new type to the type accelerator table.
|
||||||
void addAccelType(StringRef Name, std::pair<DIE *, unsigned> Die);
|
void addAccelType(StringRef Name, std::pair<const DIE *, unsigned> Die);
|
||||||
|
|
||||||
/// getDIE - Returns the debug information entry map slot for the
|
/// getDIE - Returns the debug information entry map slot for the
|
||||||
/// specified debug variable. We delegate the request to DwarfDebug
|
/// specified debug variable. We delegate the request to DwarfDebug
|
||||||
@@ -408,6 +408,10 @@ private:
|
|||||||
template <typename T> T resolve(DIRef<T> Ref) const {
|
template <typename T> T resolve(DIRef<T> Ref) const {
|
||||||
return DD->resolve(Ref);
|
return DD->resolve(Ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// If this is a named finished type then include it in the list of types for
|
||||||
|
/// the accelerator tables.
|
||||||
|
void updateAcceleratorTables(DIType Ty, const DIE *TyDIE);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end llvm namespace
|
} // end llvm namespace
|
||||||
|
@@ -2247,16 +2247,17 @@ void DwarfDebug::emitAccelNames() {
|
|||||||
E = CUMap.end();
|
E = CUMap.end();
|
||||||
I != E; ++I) {
|
I != E; ++I) {
|
||||||
CompileUnit *TheCU = I->second;
|
CompileUnit *TheCU = I->second;
|
||||||
const StringMap<std::vector<DIE *> > &Names = TheCU->getAccelNames();
|
const StringMap<std::vector<const DIE *> > &Names = TheCU->getAccelNames();
|
||||||
for (StringMap<std::vector<DIE *> >::const_iterator GI = Names.begin(),
|
for (StringMap<std::vector<const DIE *> >::const_iterator
|
||||||
GE = Names.end();
|
GI = Names.begin(),
|
||||||
|
GE = Names.end();
|
||||||
GI != GE; ++GI) {
|
GI != GE; ++GI) {
|
||||||
StringRef Name = GI->getKey();
|
StringRef Name = GI->getKey();
|
||||||
const std::vector<DIE *> &Entities = GI->second;
|
const std::vector<const DIE *> &Entities = GI->second;
|
||||||
for (std::vector<DIE *>::const_iterator DI = Entities.begin(),
|
for (std::vector<const DIE *>::const_iterator DI = Entities.begin(),
|
||||||
DE = Entities.end();
|
DE = Entities.end();
|
||||||
DI != DE; ++DI)
|
DI != DE; ++DI)
|
||||||
AT.AddName(Name, (*DI));
|
AT.AddName(Name, *DI);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2279,16 +2280,17 @@ void DwarfDebug::emitAccelObjC() {
|
|||||||
E = CUMap.end();
|
E = CUMap.end();
|
||||||
I != E; ++I) {
|
I != E; ++I) {
|
||||||
CompileUnit *TheCU = I->second;
|
CompileUnit *TheCU = I->second;
|
||||||
const StringMap<std::vector<DIE *> > &Names = TheCU->getAccelObjC();
|
const StringMap<std::vector<const DIE *> > &Names = TheCU->getAccelObjC();
|
||||||
for (StringMap<std::vector<DIE *> >::const_iterator GI = Names.begin(),
|
for (StringMap<std::vector<const DIE *> >::const_iterator
|
||||||
GE = Names.end();
|
GI = Names.begin(),
|
||||||
|
GE = Names.end();
|
||||||
GI != GE; ++GI) {
|
GI != GE; ++GI) {
|
||||||
StringRef Name = GI->getKey();
|
StringRef Name = GI->getKey();
|
||||||
const std::vector<DIE *> &Entities = GI->second;
|
const std::vector<const DIE *> &Entities = GI->second;
|
||||||
for (std::vector<DIE *>::const_iterator DI = Entities.begin(),
|
for (std::vector<const DIE *>::const_iterator DI = Entities.begin(),
|
||||||
DE = Entities.end();
|
DE = Entities.end();
|
||||||
DI != DE; ++DI)
|
DI != DE; ++DI)
|
||||||
AT.AddName(Name, (*DI));
|
AT.AddName(Name, *DI);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2310,16 +2312,18 @@ void DwarfDebug::emitAccelNamespaces() {
|
|||||||
E = CUMap.end();
|
E = CUMap.end();
|
||||||
I != E; ++I) {
|
I != E; ++I) {
|
||||||
CompileUnit *TheCU = I->second;
|
CompileUnit *TheCU = I->second;
|
||||||
const StringMap<std::vector<DIE *> > &Names = TheCU->getAccelNamespace();
|
const StringMap<std::vector<const DIE *> > &Names =
|
||||||
for (StringMap<std::vector<DIE *> >::const_iterator GI = Names.begin(),
|
TheCU->getAccelNamespace();
|
||||||
GE = Names.end();
|
for (StringMap<std::vector<const DIE *> >::const_iterator
|
||||||
|
GI = Names.begin(),
|
||||||
|
GE = Names.end();
|
||||||
GI != GE; ++GI) {
|
GI != GE; ++GI) {
|
||||||
StringRef Name = GI->getKey();
|
StringRef Name = GI->getKey();
|
||||||
const std::vector<DIE *> &Entities = GI->second;
|
const std::vector<const DIE *> &Entities = GI->second;
|
||||||
for (std::vector<DIE *>::const_iterator DI = Entities.begin(),
|
for (std::vector<const DIE *>::const_iterator DI = Entities.begin(),
|
||||||
DE = Entities.end();
|
DE = Entities.end();
|
||||||
DI != DE; ++DI)
|
DI != DE; ++DI)
|
||||||
AT.AddName(Name, (*DI));
|
AT.AddName(Name, *DI);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2347,19 +2351,21 @@ void DwarfDebug::emitAccelTypes() {
|
|||||||
E = CUMap.end();
|
E = CUMap.end();
|
||||||
I != E; ++I) {
|
I != E; ++I) {
|
||||||
CompileUnit *TheCU = I->second;
|
CompileUnit *TheCU = I->second;
|
||||||
const StringMap<std::vector<std::pair<DIE *, unsigned> > > &Names =
|
const StringMap<std::vector<std::pair<const DIE *, unsigned> > > &Names =
|
||||||
TheCU->getAccelTypes();
|
TheCU->getAccelTypes();
|
||||||
for (StringMap<std::vector<std::pair<DIE *, unsigned> > >::const_iterator
|
for (StringMap<
|
||||||
|
std::vector<std::pair<const DIE *, unsigned> > >::const_iterator
|
||||||
GI = Names.begin(),
|
GI = Names.begin(),
|
||||||
GE = Names.end();
|
GE = Names.end();
|
||||||
GI != GE; ++GI) {
|
GI != GE; ++GI) {
|
||||||
StringRef Name = GI->getKey();
|
StringRef Name = GI->getKey();
|
||||||
const std::vector<std::pair<DIE *, unsigned> > &Entities = GI->second;
|
const std::vector<std::pair<const DIE *, unsigned> > &Entities =
|
||||||
for (std::vector<std::pair<DIE *, unsigned> >::const_iterator
|
GI->second;
|
||||||
|
for (std::vector<std::pair<const DIE *, unsigned> >::const_iterator
|
||||||
DI = Entities.begin(),
|
DI = Entities.begin(),
|
||||||
DE = Entities.end();
|
DE = Entities.end();
|
||||||
DI != DE; ++DI)
|
DI != DE; ++DI)
|
||||||
AT.AddName(Name, (*DI).first, (*DI).second);
|
AT.AddName(Name, DI->first, DI->second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user