forked from OSchip/llvm-project
Sink DwarfUnit::SectionSym into DwarfCompileUnit as it's only needed/used there.
llvm-svn: 221062
This commit is contained in:
parent
8104b75c9f
commit
a34568b220
|
@ -36,6 +36,9 @@ class DwarfCompileUnit : public DwarfUnit {
|
||||||
/// Skeleton unit associated with this unit.
|
/// Skeleton unit associated with this unit.
|
||||||
DwarfCompileUnit *Skeleton;
|
DwarfCompileUnit *Skeleton;
|
||||||
|
|
||||||
|
/// A label at the start of the non-dwo section related to this unit.
|
||||||
|
MCSymbol *SectionSym;
|
||||||
|
|
||||||
/// \brief Construct a DIE for the given DbgVariable without initializing the
|
/// \brief Construct a DIE for the given DbgVariable without initializing the
|
||||||
/// DbgVariable's DIE reference.
|
/// DbgVariable's DIE reference.
|
||||||
std::unique_ptr<DIE> constructVariableDIEImpl(const DbgVariable &DV,
|
std::unique_ptr<DIE> constructVariableDIEImpl(const DbgVariable &DV,
|
||||||
|
@ -156,6 +159,20 @@ public:
|
||||||
|
|
||||||
/// Set the skeleton unit associated with this unit.
|
/// Set the skeleton unit associated with this unit.
|
||||||
void setSkeleton(DwarfCompileUnit &Skel) { Skeleton = &Skel; }
|
void setSkeleton(DwarfCompileUnit &Skel) { Skeleton = &Skel; }
|
||||||
|
|
||||||
|
MCSymbol *getSectionSym() const {
|
||||||
|
assert(Section);
|
||||||
|
return SectionSym;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Pass in the SectionSym even though we could recreate it in every compile
|
||||||
|
/// unit (type units will have actually distinct symbols once they're in
|
||||||
|
/// comdat sections).
|
||||||
|
void initSection(const MCSection *Section, MCSymbol *SectionSym) {
|
||||||
|
DwarfUnit::initSection(Section);
|
||||||
|
this->SectionSym = SectionSym;
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end llvm namespace
|
} // end llvm namespace
|
||||||
|
|
|
@ -2151,8 +2151,7 @@ void DwarfDebug::addDwarfTypeUnitType(DwarfCompileUnit &CU,
|
||||||
NewTU.setTypeSignature(Signature);
|
NewTU.setTypeSignature(Signature);
|
||||||
|
|
||||||
if (useSplitDwarf())
|
if (useSplitDwarf())
|
||||||
NewTU.initSection(Asm->getObjFileLowering().getDwarfTypesDWOSection(),
|
NewTU.initSection(Asm->getObjFileLowering().getDwarfTypesDWOSection());
|
||||||
DwarfTypesDWOSectionSym);
|
|
||||||
else {
|
else {
|
||||||
CU.applyStmtList(UnitDie);
|
CU.applyStmtList(UnitDie);
|
||||||
NewTU.initSection(
|
NewTU.initSection(
|
||||||
|
|
|
@ -1745,6 +1745,15 @@ void DwarfUnit::emitHeader(const MCSymbol *ASectionSym) const {
|
||||||
Asm->EmitInt8(Asm->getDataLayout().getPointerSize());
|
Asm->EmitInt8(Asm->getDataLayout().getPointerSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DwarfUnit::initSection(const MCSection *Section) {
|
||||||
|
assert(!this->Section);
|
||||||
|
this->Section = Section;
|
||||||
|
this->LabelBegin =
|
||||||
|
Asm->GetTempSymbol(Section->getLabelBeginName(), getUniqueID());
|
||||||
|
this->LabelEnd =
|
||||||
|
Asm->GetTempSymbol(Section->getLabelEndName(), getUniqueID());
|
||||||
|
}
|
||||||
|
|
||||||
void DwarfTypeUnit::emitHeader(const MCSymbol *ASectionSym) const {
|
void DwarfTypeUnit::emitHeader(const MCSymbol *ASectionSym) const {
|
||||||
DwarfUnit::emitHeader(ASectionSym);
|
DwarfUnit::emitHeader(ASectionSym);
|
||||||
Asm->OutStreamer.AddComment("Type Signature");
|
Asm->OutStreamer.AddComment("Type Signature");
|
||||||
|
@ -1755,16 +1764,3 @@ void DwarfTypeUnit::emitHeader(const MCSymbol *ASectionSym) const {
|
||||||
sizeof(Ty->getOffset()));
|
sizeof(Ty->getOffset()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DwarfTypeUnit::initSection(const MCSection *Section) {
|
|
||||||
assert(!this->Section);
|
|
||||||
this->Section = Section;
|
|
||||||
// Since each type unit is contained in its own COMDAT section, the begin
|
|
||||||
// label and the section label are the same. Using the begin label emission in
|
|
||||||
// DwarfDebug to emit the section label as well is slightly subtle/sneaky, but
|
|
||||||
// the only other alternative of lazily constructing start-of-section labels
|
|
||||||
// and storing a mapping in DwarfDebug (or AsmPrinter).
|
|
||||||
this->SectionSym = this->LabelBegin =
|
|
||||||
Asm->GetTempSymbol(Section->getLabelBeginName(), getUniqueID());
|
|
||||||
this->LabelEnd =
|
|
||||||
Asm->GetTempSymbol(Section->getLabelEndName(), getUniqueID());
|
|
||||||
}
|
|
||||||
|
|
|
@ -129,9 +129,6 @@ protected:
|
||||||
/// The section this unit will be emitted in.
|
/// The section this unit will be emitted in.
|
||||||
const MCSection *Section;
|
const MCSection *Section;
|
||||||
|
|
||||||
/// A label at the start of the non-dwo section related to this unit.
|
|
||||||
MCSymbol *SectionSym;
|
|
||||||
|
|
||||||
/// The start of the unit within its section.
|
/// The start of the unit within its section.
|
||||||
MCSymbol *LabelBegin;
|
MCSymbol *LabelBegin;
|
||||||
|
|
||||||
|
@ -141,32 +138,15 @@ protected:
|
||||||
DwarfUnit(unsigned UID, dwarf::Tag, DICompileUnit CU, AsmPrinter *A,
|
DwarfUnit(unsigned UID, dwarf::Tag, DICompileUnit CU, AsmPrinter *A,
|
||||||
DwarfDebug *DW, DwarfFile *DWU);
|
DwarfDebug *DW, DwarfFile *DWU);
|
||||||
|
|
||||||
|
void initSection(const MCSection *Section);
|
||||||
public:
|
public:
|
||||||
virtual ~DwarfUnit();
|
virtual ~DwarfUnit();
|
||||||
|
|
||||||
/// Pass in the SectionSym even though we could recreate it in every compile
|
|
||||||
/// unit (type units will have actually distinct symbols once they're in
|
|
||||||
/// comdat sections).
|
|
||||||
void initSection(const MCSection *Section, MCSymbol *SectionSym) {
|
|
||||||
assert(!this->Section);
|
|
||||||
this->Section = Section;
|
|
||||||
this->SectionSym = SectionSym;
|
|
||||||
this->LabelBegin =
|
|
||||||
Asm->GetTempSymbol(Section->getLabelBeginName(), getUniqueID());
|
|
||||||
this->LabelEnd =
|
|
||||||
Asm->GetTempSymbol(Section->getLabelEndName(), getUniqueID());
|
|
||||||
}
|
|
||||||
|
|
||||||
const MCSection *getSection() const {
|
const MCSection *getSection() const {
|
||||||
assert(Section);
|
assert(Section);
|
||||||
return Section;
|
return Section;
|
||||||
}
|
}
|
||||||
|
|
||||||
MCSymbol *getSectionSym() const {
|
|
||||||
assert(Section);
|
|
||||||
return SectionSym;
|
|
||||||
}
|
|
||||||
|
|
||||||
MCSymbol *getLabelBegin() const {
|
MCSymbol *getLabelBegin() const {
|
||||||
assert(Section);
|
assert(Section);
|
||||||
return LabelBegin;
|
return LabelBegin;
|
||||||
|
@ -503,10 +483,6 @@ public:
|
||||||
return DwarfUnit::getHeaderSize() + sizeof(uint64_t) + // Type Signature
|
return DwarfUnit::getHeaderSize() + sizeof(uint64_t) + // Type Signature
|
||||||
sizeof(uint32_t); // Type DIE Offset
|
sizeof(uint32_t); // Type DIE Offset
|
||||||
}
|
}
|
||||||
void initSection(const MCSection *Section);
|
|
||||||
// Bring in the base function (taking two args, including the section symbol)
|
|
||||||
// for use when building DWO type units (they don't go in unique comdat
|
|
||||||
// sections)
|
|
||||||
using DwarfUnit::initSection;
|
using DwarfUnit::initSection;
|
||||||
DwarfCompileUnit &getCU() override { return CU; }
|
DwarfCompileUnit &getCU() override { return CU; }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue