summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp
diff options
context:
space:
mode:
authorEric Christopher <echristo@apple.com>2012-01-06 04:35:23 +0000
committerEric Christopher <echristo@apple.com>2012-01-06 04:35:23 +0000
commit21bde87bf369a121a5111ea90983188694b6ae34 (patch)
treed56c979423f95a5678e2641809bf54047108e48f /llvm/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp
parent4817cf72f68324ba1a0683fbe4e7973793c40b95 (diff)
downloadbcm5719-llvm-21bde87bf369a121a5111ea90983188694b6ae34.tar.gz
bcm5719-llvm-21bde87bf369a121a5111ea90983188694b6ae34.zip
As part of the ongoing work in finalizing the accelerator tables, extend
the debug type accelerator tables to contain the tag and a flag stating whether or not a compound type is a complete type. rdar://10652330 llvm-svn: 147651
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp44
1 files changed, 29 insertions, 15 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp
index 6c77a631a92..940592ed26b 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp
@@ -42,16 +42,22 @@ DwarfAccelTable::DwarfAccelTable(DwarfAccelTable::Atom atom) :
HeaderData(atom) {
}
+// The length of the header data is always going to be 4 + 4 + 4*NumAtoms.
+DwarfAccelTable::DwarfAccelTable(std::vector<DwarfAccelTable::Atom> &atomList) :
+ Header(8 + (atomList.size() * 4)),
+ HeaderData(atomList) {
+}
+
DwarfAccelTable::~DwarfAccelTable() {
- for (size_t i = 0, e = Data.size() ; i < e; ++i)
+ for (size_t i = 0, e = Data.size(); i < e; ++i)
delete Data[i];
}
-void DwarfAccelTable::AddName(StringRef Name, DIE* die) {
+void DwarfAccelTable::AddName(StringRef Name, DIE* die, char Flags) {
// If the string is in the list already then add this die to the list
// otherwise add a new one.
- DIEArray &DIEs = Entries[Name];
- DIEs.push_back(die);
+ DataArray &DIEs = Entries[Name];
+ DIEs.push_back(new HashDataContents(die, Flags));
}
void DwarfAccelTable::ComputeBucketCount(void) {
@@ -76,15 +82,16 @@ void DwarfAccelTable::ComputeBucketCount(void) {
namespace {
// DIESorter - comparison predicate that sorts DIEs by their offset.
struct DIESorter {
- bool operator()(DIE *A, DIE *B) const {
- return A->getOffset() < B->getOffset();
+ bool operator()(const struct DwarfAccelTable::HashDataContents *A,
+ const struct DwarfAccelTable::HashDataContents *B) const {
+ return A->Die->getOffset() < B->Die->getOffset();
}
};
}
void DwarfAccelTable::FinalizeTable(AsmPrinter *Asm, const char *Prefix) {
// Create the individual hash data outputs.
- for (StringMap<DIEArray>::iterator
+ for (StringMap<DataArray>::iterator
EI = Entries.begin(), EE = Entries.end(); EI != EE; ++EI) {
struct HashData *Entry = new HashData((*EI).getKeyData());
@@ -93,10 +100,10 @@ void DwarfAccelTable::FinalizeTable(AsmPrinter *Asm, const char *Prefix) {
(*EI).second.erase(std::unique((*EI).second.begin(), (*EI).second.end()),
(*EI).second.end());
- for (DIEArray::const_iterator DI = (*EI).second.begin(),
+ for (DataArray::const_iterator DI = (*EI).second.begin(),
DE = (*EI).second.end();
DI != DE; ++DI)
- Entry->addOffset((*DI)->getOffset());
+ Entry->addData((*DI));
Data.push_back(Entry);
}
@@ -202,11 +209,18 @@ void DwarfAccelTable::EmitData(AsmPrinter *Asm, DwarfDebug *D) {
Asm->EmitSectionOffset(D->getStringPoolEntry((*HI)->Str),
D->getStringPool());
Asm->OutStreamer.AddComment("Num DIEs");
- Asm->EmitInt32((*HI)->DIEOffsets.size());
- for (std::vector<uint32_t>::const_iterator
- DI = (*HI)->DIEOffsets.begin(), DE = (*HI)->DIEOffsets.end();
+ Asm->EmitInt32((*HI)->Data.size());
+ for (std::vector<struct HashDataContents*>::const_iterator
+ DI = (*HI)->Data.begin(), DE = (*HI)->Data.end();
DI != DE; ++DI) {
- Asm->EmitInt32((*DI));
+ // Emit the DIE offset
+ Asm->EmitInt32((*DI)->Die->getOffset());
+ // If we have multiple Atoms emit that info too.
+ // FIXME: A bit of a hack, we either emit only one atom or all info.
+ if (HeaderData.Atoms.size() > 1) {
+ Asm->EmitInt16((*DI)->Die->getTag());
+ Asm->EmitInt8((*DI)->Flags);
+ }
}
// Emit a 0 to terminate the data unless we have a hash collision.
if (PrevHash != (*HI)->HashValue)
@@ -242,10 +256,10 @@ void DwarfAccelTable::print(raw_ostream &O) {
HeaderData.print(O);
O << "Entries: \n";
- for (StringMap<DIEArray>::const_iterator
+ for (StringMap<DataArray>::const_iterator
EI = Entries.begin(), EE = Entries.end(); EI != EE; ++EI) {
O << "Name: " << (*EI).getKeyData() << "\n";
- for (DIEArray::const_iterator DI = (*EI).second.begin(),
+ for (DataArray::const_iterator DI = (*EI).second.begin(),
DE = (*EI).second.end();
DI != DE; ++DI)
(*DI)->print(O);
OpenPOWER on IntegriCloud