Use 12 as the magic number for our abbreviation data and our
die values. A lot of DIEs have 10 attributes in C++ code (example clang), none had more than 12. Seems like a good default. llvm-svn: 178366
This commit is contained in:
parent
6be35037b5
commit
9c8414f84a
|
@ -144,7 +144,7 @@ void DIE::print(raw_ostream &O, unsigned IncIndent) {
|
||||||
O << "Size: " << Size << "\n";
|
O << "Size: " << Size << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
const SmallVector<DIEAbbrevData, 8> &Data = Abbrev.getData();
|
const SmallVector<DIEAbbrevData, 12> &Data = Abbrev.getData();
|
||||||
|
|
||||||
IndentCount += 2;
|
IndentCount += 2;
|
||||||
for (unsigned i = 0, N = Data.size(); i < N; ++i) {
|
for (unsigned i = 0, N = Data.size(); i < N; ++i) {
|
||||||
|
@ -324,7 +324,7 @@ void DIEEntry::print(raw_ostream &O) {
|
||||||
///
|
///
|
||||||
unsigned DIEBlock::ComputeSize(AsmPrinter *AP) {
|
unsigned DIEBlock::ComputeSize(AsmPrinter *AP) {
|
||||||
if (!Size) {
|
if (!Size) {
|
||||||
const SmallVector<DIEAbbrevData, 8> &AbbrevData = Abbrev.getData();
|
const SmallVector<DIEAbbrevData, 12> &AbbrevData = Abbrev.getData();
|
||||||
for (unsigned i = 0, N = Values.size(); i < N; ++i)
|
for (unsigned i = 0, N = Values.size(); i < N; ++i)
|
||||||
Size += Values[i]->SizeOf(AP, AbbrevData[i].getForm());
|
Size += Values[i]->SizeOf(AP, AbbrevData[i].getForm());
|
||||||
}
|
}
|
||||||
|
@ -343,7 +343,7 @@ void DIEBlock::EmitValue(AsmPrinter *Asm, unsigned Form) const {
|
||||||
case dwarf::DW_FORM_block: Asm->EmitULEB128(Size); break;
|
case dwarf::DW_FORM_block: Asm->EmitULEB128(Size); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
const SmallVector<DIEAbbrevData, 8> &AbbrevData = Abbrev.getData();
|
const SmallVector<DIEAbbrevData, 12> &AbbrevData = Abbrev.getData();
|
||||||
for (unsigned i = 0, N = Values.size(); i < N; ++i)
|
for (unsigned i = 0, N = Values.size(); i < N; ++i)
|
||||||
Values[i]->EmitValue(Asm, AbbrevData[i].getForm());
|
Values[i]->EmitValue(Asm, AbbrevData[i].getForm());
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ namespace llvm {
|
||||||
|
|
||||||
/// Data - Raw data bytes for abbreviation.
|
/// Data - Raw data bytes for abbreviation.
|
||||||
///
|
///
|
||||||
SmallVector<DIEAbbrevData, 8> Data;
|
SmallVector<DIEAbbrevData, 12> Data;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DIEAbbrev(uint16_t T, uint16_t C) : Tag(T), ChildrenFlag(C), Data() {}
|
DIEAbbrev(uint16_t T, uint16_t C) : Tag(T), ChildrenFlag(C), Data() {}
|
||||||
|
@ -75,7 +75,7 @@ namespace llvm {
|
||||||
uint16_t getTag() const { return Tag; }
|
uint16_t getTag() const { return Tag; }
|
||||||
unsigned getNumber() const { return Number; }
|
unsigned getNumber() const { return Number; }
|
||||||
uint16_t getChildrenFlag() const { return ChildrenFlag; }
|
uint16_t getChildrenFlag() const { return ChildrenFlag; }
|
||||||
const SmallVector<DIEAbbrevData, 8> &getData() const { return Data; }
|
const SmallVector<DIEAbbrevData, 12> &getData() const { return Data; }
|
||||||
void setTag(uint16_t T) { Tag = T; }
|
void setTag(uint16_t T) { Tag = T; }
|
||||||
void setChildrenFlag(uint16_t CF) { ChildrenFlag = CF; }
|
void setChildrenFlag(uint16_t CF) { ChildrenFlag = CF; }
|
||||||
void setNumber(unsigned N) { Number = N; }
|
void setNumber(unsigned N) { Number = N; }
|
||||||
|
@ -133,7 +133,7 @@ namespace llvm {
|
||||||
|
|
||||||
/// Attribute values.
|
/// Attribute values.
|
||||||
///
|
///
|
||||||
SmallVector<DIEValue*, 32> Values;
|
SmallVector<DIEValue*, 12> Values;
|
||||||
|
|
||||||
// Private data for print()
|
// Private data for print()
|
||||||
mutable unsigned IndentCount;
|
mutable unsigned IndentCount;
|
||||||
|
@ -150,7 +150,7 @@ namespace llvm {
|
||||||
unsigned getOffset() const { return Offset; }
|
unsigned getOffset() const { return Offset; }
|
||||||
unsigned getSize() const { return Size; }
|
unsigned getSize() const { return Size; }
|
||||||
const std::vector<DIE *> &getChildren() const { return Children; }
|
const std::vector<DIE *> &getChildren() const { return Children; }
|
||||||
const SmallVector<DIEValue*, 32> &getValues() const { return Values; }
|
const SmallVector<DIEValue*, 12> &getValues() const { return Values; }
|
||||||
DIE *getParent() const { return Parent; }
|
DIE *getParent() const { return Parent; }
|
||||||
/// Climb up the parent chain to get the compile unit DIE this DIE belongs
|
/// Climb up the parent chain to get the compile unit DIE this DIE belongs
|
||||||
/// to.
|
/// to.
|
||||||
|
|
|
@ -1672,8 +1672,8 @@ DwarfUnits::computeSizeAndOffset(DIE *Die, unsigned Offset) {
|
||||||
// Start the size with the size of abbreviation code.
|
// Start the size with the size of abbreviation code.
|
||||||
Offset += MCAsmInfo::getULEB128Size(AbbrevNumber);
|
Offset += MCAsmInfo::getULEB128Size(AbbrevNumber);
|
||||||
|
|
||||||
const SmallVector<DIEValue*, 32> &Values = Die->getValues();
|
const SmallVector<DIEValue*, 12> &Values = Die->getValues();
|
||||||
const SmallVector<DIEAbbrevData, 8> &AbbrevData = Abbrev->getData();
|
const SmallVector<DIEAbbrevData, 12> &AbbrevData = Abbrev->getData();
|
||||||
|
|
||||||
// Size the DIE attribute values.
|
// Size the DIE attribute values.
|
||||||
for (unsigned i = 0, N = Values.size(); i < N; ++i)
|
for (unsigned i = 0, N = Values.size(); i < N; ++i)
|
||||||
|
@ -1767,8 +1767,8 @@ void DwarfDebug::emitDIE(DIE *Die, std::vector<DIEAbbrev *> *Abbrevs) {
|
||||||
dwarf::TagString(Abbrev->getTag()));
|
dwarf::TagString(Abbrev->getTag()));
|
||||||
Asm->EmitULEB128(AbbrevNumber);
|
Asm->EmitULEB128(AbbrevNumber);
|
||||||
|
|
||||||
const SmallVector<DIEValue*, 32> &Values = Die->getValues();
|
const SmallVector<DIEValue*, 12> &Values = Die->getValues();
|
||||||
const SmallVector<DIEAbbrevData, 8> &AbbrevData = Abbrev->getData();
|
const SmallVector<DIEAbbrevData, 12> &AbbrevData = Abbrev->getData();
|
||||||
|
|
||||||
// Emit the DIE attribute values.
|
// Emit the DIE attribute values.
|
||||||
for (unsigned i = 0, N = Values.size(); i < N; ++i) {
|
for (unsigned i = 0, N = Values.size(); i < N; ++i) {
|
||||||
|
|
Loading…
Reference in New Issue