mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-01 13:37:55 +00:00
DwarfUnit: Provide a reference to a defining DwarfCompileUnit from DwarfTypeUnit.
Type units need to insert their file strings into the compile unit's line/file table. This is preliminary work to that end. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201196 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a22a1bb8c1
commit
c6c93e96e9
@ -2965,11 +2965,11 @@ DwarfCompileUnit *DwarfDebug::constructSkeletonCU(const DwarfCompileUnit *CU) {
|
|||||||
|
|
||||||
// This DIE has the following attributes: DW_AT_comp_dir, DW_AT_dwo_name,
|
// This DIE has the following attributes: DW_AT_comp_dir, DW_AT_dwo_name,
|
||||||
// DW_AT_addr_base.
|
// DW_AT_addr_base.
|
||||||
DwarfTypeUnit *DwarfDebug::constructSkeletonTU(const DwarfTypeUnit *TU) {
|
DwarfTypeUnit *DwarfDebug::constructSkeletonTU(DwarfTypeUnit *TU) {
|
||||||
|
|
||||||
DIE *Die = new DIE(dwarf::DW_TAG_type_unit);
|
DIE *Die = new DIE(dwarf::DW_TAG_type_unit);
|
||||||
DwarfTypeUnit *NewTU = new DwarfTypeUnit(
|
DwarfTypeUnit *NewTU = new DwarfTypeUnit(
|
||||||
TU->getUniqueID(), Die, TU->getCUNode(), Asm, this, &SkeletonHolder);
|
TU->getUniqueID(), Die, TU->getCU(), Asm, this, &SkeletonHolder);
|
||||||
NewTU->setTypeSignature(TU->getTypeSignature());
|
NewTU->setTypeSignature(TU->getTypeSignature());
|
||||||
NewTU->setType(NULL);
|
NewTU->setType(NULL);
|
||||||
NewTU->initSection(
|
NewTU->initSection(
|
||||||
@ -3007,29 +3007,29 @@ void DwarfDebug::emitDebugStrDWO() {
|
|||||||
OffSec, StrSym);
|
OffSec, StrSym);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DwarfDebug::addDwarfTypeUnitType(DICompileUnit CUNode,
|
void DwarfDebug::addDwarfTypeUnitType(DwarfCompileUnit &CU,
|
||||||
StringRef Identifier, DIE *RefDie,
|
StringRef Identifier, DIE *RefDie,
|
||||||
DICompositeType CTy) {
|
DICompositeType CTy) {
|
||||||
// Flag the type unit reference as a declaration so that if it contains
|
// Flag the type unit reference as a declaration so that if it contains
|
||||||
// members (implicit special members, static data member definitions, member
|
// members (implicit special members, static data member definitions, member
|
||||||
// declarations for definitions in this CU, etc) consumers don't get confused
|
// declarations for definitions in this CU, etc) consumers don't get confused
|
||||||
// and think this is a full definition.
|
// and think this is a full definition.
|
||||||
CUMap.begin()->second->addFlag(RefDie, dwarf::DW_AT_declaration);
|
CU.addFlag(RefDie, dwarf::DW_AT_declaration);
|
||||||
|
|
||||||
const DwarfTypeUnit *&TU = DwarfTypeUnits[CTy];
|
const DwarfTypeUnit *&TU = DwarfTypeUnits[CTy];
|
||||||
if (TU) {
|
if (TU) {
|
||||||
CUMap.begin()->second->addDIETypeSignature(RefDie, *TU);
|
CU.addDIETypeSignature(RefDie, *TU);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DIE *UnitDie = new DIE(dwarf::DW_TAG_type_unit);
|
DIE *UnitDie = new DIE(dwarf::DW_TAG_type_unit);
|
||||||
DwarfTypeUnit *NewTU = new DwarfTypeUnit(
|
DwarfTypeUnit *NewTU = new DwarfTypeUnit(
|
||||||
InfoHolder.getUnits().size(), UnitDie, CUNode, Asm, this, &InfoHolder);
|
InfoHolder.getUnits().size(), UnitDie, CU, Asm, this, &InfoHolder);
|
||||||
TU = NewTU;
|
TU = NewTU;
|
||||||
InfoHolder.addUnit(NewTU);
|
InfoHolder.addUnit(NewTU);
|
||||||
|
|
||||||
NewTU->addUInt(UnitDie, dwarf::DW_AT_language, dwarf::DW_FORM_data2,
|
NewTU->addUInt(UnitDie, dwarf::DW_AT_language, dwarf::DW_FORM_data2,
|
||||||
CUNode.getLanguage());
|
CU.getLanguage());
|
||||||
|
|
||||||
MD5 Hash;
|
MD5 Hash;
|
||||||
Hash.update(Identifier);
|
Hash.update(Identifier);
|
||||||
@ -3050,5 +3050,5 @@ void DwarfDebug::addDwarfTypeUnitType(DICompileUnit CUNode,
|
|||||||
? Asm->getObjFileLowering().getDwarfTypesDWOSection(Signature)
|
? Asm->getObjFileLowering().getDwarfTypesDWOSection(Signature)
|
||||||
: Asm->getObjFileLowering().getDwarfTypesSection(Signature));
|
: Asm->getObjFileLowering().getDwarfTypesSection(Signature));
|
||||||
|
|
||||||
CUMap.begin()->second->addDIETypeSignature(RefDie, *NewTU);
|
CU.addDIETypeSignature(RefDie, *NewTU);
|
||||||
}
|
}
|
||||||
|
@ -606,7 +606,7 @@ class DwarfDebug : public AsmPrinterHandler {
|
|||||||
|
|
||||||
/// \brief Construct the split debug info compile unit for the debug info
|
/// \brief Construct the split debug info compile unit for the debug info
|
||||||
/// section.
|
/// section.
|
||||||
DwarfTypeUnit *constructSkeletonTU(const DwarfTypeUnit *TU);
|
DwarfTypeUnit *constructSkeletonTU(DwarfTypeUnit *TU);
|
||||||
|
|
||||||
/// \brief Emit the debug info dwo section.
|
/// \brief Emit the debug info dwo section.
|
||||||
void emitDebugInfoDWO();
|
void emitDebugInfoDWO();
|
||||||
@ -710,7 +710,7 @@ public:
|
|||||||
|
|
||||||
/// \brief Add a DIE to the set of types that we're going to pull into
|
/// \brief Add a DIE to the set of types that we're going to pull into
|
||||||
/// type units.
|
/// type units.
|
||||||
void addDwarfTypeUnitType(DICompileUnit CUNode, StringRef Identifier,
|
void addDwarfTypeUnitType(DwarfCompileUnit &CU, StringRef Identifier,
|
||||||
DIE *Die, DICompositeType CTy);
|
DIE *Die, DICompositeType CTy);
|
||||||
|
|
||||||
/// \brief Add a label so that arange data can be generated for it.
|
/// \brief Add a label so that arange data can be generated for it.
|
||||||
|
@ -55,9 +55,11 @@ DwarfCompileUnit::DwarfCompileUnit(unsigned UID, DIE *D, DICompileUnit Node,
|
|||||||
insertDIE(Node, D);
|
insertDIE(Node, D);
|
||||||
}
|
}
|
||||||
|
|
||||||
DwarfTypeUnit::DwarfTypeUnit(unsigned UID, DIE *D, DICompileUnit CUNode,
|
DwarfTypeUnit::DwarfTypeUnit(unsigned UID, DIE *D, DwarfCompileUnit &CU,
|
||||||
AsmPrinter *A, DwarfDebug *DW, DwarfFile *DWU)
|
AsmPrinter *A, DwarfDebug *DW, DwarfFile *DWU)
|
||||||
: DwarfUnit(UID, D, CUNode, A, DW, DWU) {}
|
: DwarfUnit(UID, D, CU.getCUNode(), A, DW, DWU), CU(CU) {
|
||||||
|
(void)CU;
|
||||||
|
}
|
||||||
|
|
||||||
/// ~Unit - Destructor for compile unit.
|
/// ~Unit - Destructor for compile unit.
|
||||||
DwarfUnit::~DwarfUnit() {
|
DwarfUnit::~DwarfUnit() {
|
||||||
@ -944,7 +946,7 @@ DIE *DwarfUnit::getOrCreateTypeDIE(const MDNode *TyNode) {
|
|||||||
DICompositeType CTy(Ty);
|
DICompositeType CTy(Ty);
|
||||||
if (GenerateDwarfTypeUnits && !Ty.isForwardDecl())
|
if (GenerateDwarfTypeUnits && !Ty.isForwardDecl())
|
||||||
if (MDString *TypeId = CTy.getIdentifier()) {
|
if (MDString *TypeId = CTy.getIdentifier()) {
|
||||||
DD->addDwarfTypeUnitType(getCUNode(), TypeId->getString(), TyDIE, CTy);
|
DD->addDwarfTypeUnitType(getCU(), TypeId->getString(), TyDIE, CTy);
|
||||||
// Skip updating the accellerator tables since this is not the full type
|
// Skip updating the accellerator tables since this is not the full type
|
||||||
return TyDIE;
|
return TyDIE;
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@ class MachineOperand;
|
|||||||
class ConstantInt;
|
class ConstantInt;
|
||||||
class ConstantFP;
|
class ConstantFP;
|
||||||
class DbgVariable;
|
class DbgVariable;
|
||||||
|
class DwarfCompileUnit;
|
||||||
|
|
||||||
// Data structure to hold a range for range lists.
|
// Data structure to hold a range for range lists.
|
||||||
class RangeSpan {
|
class RangeSpan {
|
||||||
@ -462,6 +463,7 @@ public:
|
|||||||
virtual void emitHeader(const MCSection *ASection,
|
virtual void emitHeader(const MCSection *ASection,
|
||||||
const MCSymbol *ASectionSym) const;
|
const MCSymbol *ASectionSym) const;
|
||||||
|
|
||||||
|
virtual DwarfCompileUnit &getCU() = 0;
|
||||||
protected:
|
protected:
|
||||||
/// getOrCreateStaticMemberDIE - Create new static data member DIE.
|
/// getOrCreateStaticMemberDIE - Create new static data member DIE.
|
||||||
DIE *getOrCreateStaticMemberDIE(DIDerivedType DT);
|
DIE *getOrCreateStaticMemberDIE(DIDerivedType DT);
|
||||||
@ -547,15 +549,20 @@ public:
|
|||||||
/// addLabelAddress - Add a dwarf label attribute data and value using
|
/// addLabelAddress - Add a dwarf label attribute data and value using
|
||||||
/// either DW_FORM_addr or DW_FORM_GNU_addr_index.
|
/// either DW_FORM_addr or DW_FORM_GNU_addr_index.
|
||||||
void addLabelAddress(DIE *Die, dwarf::Attribute Attribute, MCSymbol *Label);
|
void addLabelAddress(DIE *Die, dwarf::Attribute Attribute, MCSymbol *Label);
|
||||||
|
|
||||||
|
DwarfCompileUnit &getCU() LLVM_OVERRIDE {
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class DwarfTypeUnit : public DwarfUnit {
|
class DwarfTypeUnit : public DwarfUnit {
|
||||||
private:
|
private:
|
||||||
uint64_t TypeSignature;
|
uint64_t TypeSignature;
|
||||||
const DIE *Ty;
|
const DIE *Ty;
|
||||||
|
DwarfCompileUnit &CU;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DwarfTypeUnit(unsigned UID, DIE *D, DICompileUnit CUNode, AsmPrinter *A,
|
DwarfTypeUnit(unsigned UID, DIE *D, DwarfCompileUnit &CU, AsmPrinter *A,
|
||||||
DwarfDebug *DW, DwarfFile *DWU);
|
DwarfDebug *DW, DwarfFile *DWU);
|
||||||
virtual ~DwarfTypeUnit() LLVM_OVERRIDE;
|
virtual ~DwarfTypeUnit() LLVM_OVERRIDE;
|
||||||
|
|
||||||
@ -571,6 +578,9 @@ public:
|
|||||||
sizeof(uint32_t); // Type DIE Offset
|
sizeof(uint32_t); // Type DIE Offset
|
||||||
}
|
}
|
||||||
void initSection(const MCSection *Section);
|
void initSection(const MCSection *Section);
|
||||||
|
DwarfCompileUnit &getCU() LLVM_OVERRIDE {
|
||||||
|
return CU;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // end llvm namespace
|
} // end llvm namespace
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user