mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-28 22:00:30 +00:00
Return DIE by reference instead of pointer from DwarfUnit::getUnitDie
llvm-svn: 207255
This commit is contained in:
parent
e361bbbc0f
commit
ad6109fd52
@ -322,7 +322,7 @@ DIE *DwarfDebug::updateSubprogramScopeDIE(DwarfCompileUnit &SPCU,
|
||||
// concrete DIE twice.
|
||||
if (DIE *AbsSPDIE = AbstractSPDies.lookup(SP)) {
|
||||
// Pick up abstract subprogram DIE.
|
||||
SPDie = SPCU.createAndAddDIE(dwarf::DW_TAG_subprogram, *SPCU.getUnitDie());
|
||||
SPDie = SPCU.createAndAddDIE(dwarf::DW_TAG_subprogram, SPCU.getUnitDie());
|
||||
SPCU.addDIEEntry(*SPDie, dwarf::DW_AT_abstract_origin, AbsSPDIE);
|
||||
} else {
|
||||
DISubprogram SPDecl = SP.getFunctionDeclaration();
|
||||
@ -345,7 +345,7 @@ DIE *DwarfDebug::updateSubprogramScopeDIE(DwarfCompileUnit &SPCU,
|
||||
SPCU.constructSubprogramArguments(*SPDie, Args);
|
||||
DIE *SPDeclDie = SPDie;
|
||||
SPDie =
|
||||
SPCU.createAndAddDIE(dwarf::DW_TAG_subprogram, *SPCU.getUnitDie());
|
||||
SPCU.createAndAddDIE(dwarf::DW_TAG_subprogram, SPCU.getUnitDie());
|
||||
SPCU.addDIEEntry(*SPDie, dwarf::DW_AT_specification, SPDeclDie);
|
||||
}
|
||||
}
|
||||
@ -885,27 +885,27 @@ void DwarfDebug::finalizeModuleInfo() {
|
||||
TheU->constructContainingTypeDIEs();
|
||||
|
||||
// Add CU specific attributes if we need to add any.
|
||||
if (TheU->getUnitDie()->getTag() == dwarf::DW_TAG_compile_unit) {
|
||||
if (TheU->getUnitDie().getTag() == dwarf::DW_TAG_compile_unit) {
|
||||
// If we're splitting the dwarf out now that we've got the entire
|
||||
// CU then add the dwo id to it.
|
||||
DwarfCompileUnit *SkCU =
|
||||
static_cast<DwarfCompileUnit *>(TheU->getSkeleton());
|
||||
if (useSplitDwarf()) {
|
||||
// Emit a unique identifier for this CU.
|
||||
uint64_t ID = DIEHash(Asm).computeCUSignature(*TheU->getUnitDie());
|
||||
TheU->addUInt(*TheU->getUnitDie(), dwarf::DW_AT_GNU_dwo_id,
|
||||
uint64_t ID = DIEHash(Asm).computeCUSignature(TheU->getUnitDie());
|
||||
TheU->addUInt(TheU->getUnitDie(), dwarf::DW_AT_GNU_dwo_id,
|
||||
dwarf::DW_FORM_data8, ID);
|
||||
SkCU->addUInt(*SkCU->getUnitDie(), dwarf::DW_AT_GNU_dwo_id,
|
||||
SkCU->addUInt(SkCU->getUnitDie(), dwarf::DW_AT_GNU_dwo_id,
|
||||
dwarf::DW_FORM_data8, ID);
|
||||
|
||||
// We don't keep track of which addresses are used in which CU so this
|
||||
// is a bit pessimistic under LTO.
|
||||
if (!AddrPool.isEmpty())
|
||||
addSectionLabel(*Asm, *SkCU, *SkCU->getUnitDie(),
|
||||
addSectionLabel(*Asm, *SkCU, SkCU->getUnitDie(),
|
||||
dwarf::DW_AT_GNU_addr_base, DwarfAddrSectionSym,
|
||||
DwarfAddrSectionSym);
|
||||
if (!TheU->getRangeLists().empty())
|
||||
addSectionLabel(*Asm, *SkCU, *SkCU->getUnitDie(),
|
||||
addSectionLabel(*Asm, *SkCU, SkCU->getUnitDie(),
|
||||
dwarf::DW_AT_GNU_ranges_base,
|
||||
DwarfDebugRangeSectionSym, DwarfDebugRangeSectionSym);
|
||||
}
|
||||
@ -921,7 +921,7 @@ void DwarfDebug::finalizeModuleInfo() {
|
||||
unsigned NumRanges = TheU->getRanges().size();
|
||||
if (NumRanges) {
|
||||
if (NumRanges > 1) {
|
||||
addSectionLabel(*Asm, U, *U.getUnitDie(), dwarf::DW_AT_ranges,
|
||||
addSectionLabel(*Asm, U, U.getUnitDie(), dwarf::DW_AT_ranges,
|
||||
Asm->GetTempSymbol("cu_ranges", U.getUniqueID()),
|
||||
DwarfDebugRangeSectionSym);
|
||||
|
||||
@ -929,13 +929,13 @@ void DwarfDebug::finalizeModuleInfo() {
|
||||
// DW_AT_ranges to specify the default base address for use in
|
||||
// location lists (see Section 2.6.2) and range lists (see Section
|
||||
// 2.17.3).
|
||||
U.addUInt(*U.getUnitDie(), dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr,
|
||||
U.addUInt(U.getUnitDie(), dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr,
|
||||
0);
|
||||
} else {
|
||||
RangeSpan &Range = TheU->getRanges().back();
|
||||
U.addLocalLabelAddress(*U.getUnitDie(), dwarf::DW_AT_low_pc,
|
||||
U.addLocalLabelAddress(U.getUnitDie(), dwarf::DW_AT_low_pc,
|
||||
Range.getStart());
|
||||
U.addLabelDelta(*U.getUnitDie(), dwarf::DW_AT_high_pc, Range.getEnd(),
|
||||
U.addLabelDelta(U.getUnitDie(), dwarf::DW_AT_high_pc, Range.getEnd(),
|
||||
Range.getStart());
|
||||
}
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ void DwarfFile::addUnit(std::unique_ptr<DwarfUnit> U) {
|
||||
// the abbreviations going into ASection.
|
||||
void DwarfFile::emitUnits(DwarfDebug *DD, const MCSymbol *ASectionSym) {
|
||||
for (const auto &TheU : CUs) {
|
||||
DIE *Die = TheU->getUnitDie();
|
||||
DIE &Die = TheU->getUnitDie();
|
||||
const MCSection *USection = TheU->getSection();
|
||||
Asm->OutStreamer.SwitchSection(USection);
|
||||
|
||||
@ -84,11 +84,11 @@ void DwarfFile::emitUnits(DwarfDebug *DD, const MCSymbol *ASectionSym) {
|
||||
|
||||
// Emit size of content not including length itself
|
||||
Asm->OutStreamer.AddComment("Length of Unit");
|
||||
Asm->EmitInt32(TheU->getHeaderSize() + Die->getSize());
|
||||
Asm->EmitInt32(TheU->getHeaderSize() + Die.getSize());
|
||||
|
||||
TheU->emitHeader(ASectionSym);
|
||||
|
||||
DD->emitDIE(*Die);
|
||||
DD->emitDIE(Die);
|
||||
Asm->OutStreamer.EmitLabel(TheU->getLabelEnd());
|
||||
}
|
||||
}
|
||||
@ -108,7 +108,7 @@ void DwarfFile::computeSizeAndOffsets() {
|
||||
|
||||
// EndOffset here is CU-relative, after laying out
|
||||
// all of the CU DIE.
|
||||
unsigned EndOffset = computeSizeAndOffset(*TheU->getUnitDie(), Offset);
|
||||
unsigned EndOffset = computeSizeAndOffset(TheU->getUnitDie(), Offset);
|
||||
SecOffset += EndOffset;
|
||||
}
|
||||
}
|
||||
|
@ -370,9 +370,9 @@ void DwarfUnit::addDIEEntry(DIE &Die, dwarf::Attribute Attribute,
|
||||
const DIE *EntryCU = Entry->getEntry()->getUnitOrNull();
|
||||
if (!DieCU)
|
||||
// We assume that Die belongs to this CU, if it is not linked to any CU yet.
|
||||
DieCU = getUnitDie();
|
||||
DieCU = &getUnitDie();
|
||||
if (!EntryCU)
|
||||
EntryCU = getUnitDie();
|
||||
EntryCU = &getUnitDie();
|
||||
Die.addValue(Attribute,
|
||||
EntryCU == DieCU ? dwarf::DW_FORM_ref4 : dwarf::DW_FORM_ref_addr,
|
||||
Entry);
|
||||
@ -944,7 +944,7 @@ void DwarfUnit::addTemplateParams(DIE &Buffer, DIArray TParams) {
|
||||
/// getOrCreateContextDIE - Get context owner's DIE.
|
||||
DIE *DwarfUnit::getOrCreateContextDIE(DIScope Context) {
|
||||
if (!Context || Context.isFile())
|
||||
return getUnitDie();
|
||||
return &getUnitDie();
|
||||
if (Context.isType())
|
||||
return getOrCreateTypeDIE(DIType(Context));
|
||||
if (Context.isNameSpace())
|
||||
|
@ -215,7 +215,7 @@ public:
|
||||
unsigned getUniqueID() const { return UniqueID; }
|
||||
uint16_t getLanguage() const { return CUNode.getLanguage(); }
|
||||
DICompileUnit getCUNode() const { return CUNode; }
|
||||
DIE *getUnitDie() const { return UnitDie.get(); }
|
||||
DIE &getUnitDie() const { return *UnitDie; }
|
||||
const StringMap<const DIE *> &getGlobalNames() const { return GlobalNames; }
|
||||
const StringMap<const DIE *> &getGlobalTypes() const { return GlobalTypes; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user