llvm.org GIT mirror llvm / 33e0758
Sink DwarfUnit::SectionSym into DwarfCompileUnit as it's only needed/used there. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221062 91177308-0d34-0410-b5e6-96231b3b80d8 David Blaikie 5 years ago
4 changed file(s) with 28 addition(s) and 40 deletion(s). Raw diff Collapse all Expand all
3434
3535 /// Skeleton unit associated with this unit.
3636 DwarfCompileUnit *Skeleton;
37
38 /// A label at the start of the non-dwo section related to this unit.
39 MCSymbol *SectionSym;
3740
3841 /// \brief Construct a DIE for the given DbgVariable without initializing the
3942 /// DbgVariable's DIE reference.
155158
156159 /// Set the skeleton unit associated with this unit.
157160 void setSkeleton(DwarfCompileUnit &Skel) { Skeleton = &Skel; }
161
162 MCSymbol *getSectionSym() const {
163 assert(Section);
164 return SectionSym;
165 }
166
167 /// Pass in the SectionSym even though we could recreate it in every compile
168 /// unit (type units will have actually distinct symbols once they're in
169 /// comdat sections).
170 void initSection(const MCSection *Section, MCSymbol *SectionSym) {
171 DwarfUnit::initSection(Section);
172 this->SectionSym = SectionSym;
173 }
174
158175 };
159176
160177 } // end llvm namespace
21502150 NewTU.setTypeSignature(Signature);
21512151
21522152 if (useSplitDwarf())
2153 NewTU.initSection(Asm->getObjFileLowering().getDwarfTypesDWOSection(),
2154 DwarfTypesDWOSectionSym);
2153 NewTU.initSection(Asm->getObjFileLowering().getDwarfTypesDWOSection());
21552154 else {
21562155 CU.applyStmtList(UnitDie);
21572156 NewTU.initSection(
17441744 Asm->EmitInt8(Asm->getDataLayout().getPointerSize());
17451745 }
17461746
1747 void DwarfUnit::initSection(const MCSection *Section) {
1748 assert(!this->Section);
1749 this->Section = Section;
1750 this->LabelBegin =
1751 Asm->GetTempSymbol(Section->getLabelBeginName(), getUniqueID());
1752 this->LabelEnd =
1753 Asm->GetTempSymbol(Section->getLabelEndName(), getUniqueID());
1754 }
1755
17471756 void DwarfTypeUnit::emitHeader(const MCSymbol *ASectionSym) const {
17481757 DwarfUnit::emitHeader(ASectionSym);
17491758 Asm->OutStreamer.AddComment("Type Signature");
17541763 sizeof(Ty->getOffset()));
17551764 }
17561765
1757 void DwarfTypeUnit::initSection(const MCSection *Section) {
1758 assert(!this->Section);
1759 this->Section = Section;
1760 // Since each type unit is contained in its own COMDAT section, the begin
1761 // label and the section label are the same. Using the begin label emission in
1762 // DwarfDebug to emit the section label as well is slightly subtle/sneaky, but
1763 // the only other alternative of lazily constructing start-of-section labels
1764 // and storing a mapping in DwarfDebug (or AsmPrinter).
1765 this->SectionSym = this->LabelBegin =
1766 Asm->GetTempSymbol(Section->getLabelBeginName(), getUniqueID());
1767 this->LabelEnd =
1768 Asm->GetTempSymbol(Section->getLabelEndName(), getUniqueID());
1769 }
128128 /// The section this unit will be emitted in.
129129 const MCSection *Section;
130130
131 /// A label at the start of the non-dwo section related to this unit.
132 MCSymbol *SectionSym;
133
134131 /// The start of the unit within its section.
135132 MCSymbol *LabelBegin;
136133
140137 DwarfUnit(unsigned UID, dwarf::Tag, DICompileUnit CU, AsmPrinter *A,
141138 DwarfDebug *DW, DwarfFile *DWU);
142139
140 void initSection(const MCSection *Section);
143141 public:
144142 virtual ~DwarfUnit();
145
146 /// Pass in the SectionSym even though we could recreate it in every compile
147 /// unit (type units will have actually distinct symbols once they're in
148 /// comdat sections).
149 void initSection(const MCSection *Section, MCSymbol *SectionSym) {
150 assert(!this->Section);
151 this->Section = Section;
152 this->SectionSym = SectionSym;
153 this->LabelBegin =
154 Asm->GetTempSymbol(Section->getLabelBeginName(), getUniqueID());
155 this->LabelEnd =
156 Asm->GetTempSymbol(Section->getLabelEndName(), getUniqueID());
157 }
158143
159144 const MCSection *getSection() const {
160145 assert(Section);
161146 return Section;
162 }
163
164 MCSymbol *getSectionSym() const {
165 assert(Section);
166 return SectionSym;
167147 }
168148
169149 MCSymbol *getLabelBegin() const {
502482 return DwarfUnit::getHeaderSize() + sizeof(uint64_t) + // Type Signature
503483 sizeof(uint32_t); // Type DIE Offset
504484 }
505 void initSection(const MCSection *Section);
506 // Bring in the base function (taking two args, including the section symbol)
507 // for use when building DWO type units (they don't go in unique comdat
508 // sections)
509485 using DwarfUnit::initSection;
510486 DwarfCompileUnit &getCU() override { return CU; }
511487