9#ifndef LLVM_DWARFLINKER_DWARFLINKERCOMPILEUNIT_H
10#define LLVM_DWARFLINKER_DWARFLINKERCOMPILEUNIT_H
46 assert(Old.getType() == DIEValue::isInteger);
52 return I->getDIEInteger().getValue();
98#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
105 : OrigUnit(OrigUnit),
ID(
ID), ClangModuleName(ClangModuleName) {
114 HasODR = CanUseODR && (*Lang == dwarf::DW_LANG_C_plus_plus ||
115 *Lang == dwarf::DW_LANG_C_plus_plus_03 ||
116 *Lang == dwarf::DW_LANG_C_plus_plus_11 ||
117 *Lang == dwarf::DW_LANG_C_plus_plus_14 ||
118 *Lang == dwarf::DW_LANG_ObjC_plus_plus);
155 std::optional<uint64_t>
getLowPc()
const {
return LowPc; }
164 return UnitRangeAttribute;
168 return LocationAttributes;
211 bool SkipPubnamesSection =
false);
217 bool SkipPubnamesSection =
false);
222 bool ObjcClassImplementation,
252 const std::vector<AccelInfo> &
getPubnames()
const {
return Pubnames; }
253 const std::vector<AccelInfo> &
getPubtypes()
const {
return Pubtypes; }
255 const std::vector<AccelInfo> &
getObjC()
const {
return ObjC; }
263 std::vector<DIEInfo> Info;
264 std::optional<BasicDIEUnit> NewUnit;
270 std::optional<uint64_t> LowPc;
280 std::tuple<DIE *, const CompileUnit *, DeclContext *, PatchLocation>>
281 ForwardDIEReferences;
295 std::optional<PatchLocation> UnitRangeAttribute;
308 std::vector<AccelInfo> Pubnames;
309 std::vector<AccelInfo> Pubtypes;
310 std::vector<AccelInfo> Namespaces;
311 std::vector<AccelInfo> ObjC;
324 std::string ClangModuleName;
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
This file defines the DenseMap class.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
AddressRangesMap class maps values to the address ranges.
Stores all information relating to a compile unit, be it in its original instance in the object file ...
void fixupForwardReferences()
Apply all fixups recorded by noteForwardReference().
bool isClangModule() const
const DIEInfo & getInfo(unsigned Idx) const
DIEInfo & getInfo(const DWARFDie &Die)
void noteForwardReference(DIE *Die, const CompileUnit *RefUnit, DeclContext *Ctxt, PatchLocation Attr)
Keep track of a forward reference to DIE Die in RefUnit by Attr.
void noteLocationAttribute(PatchLocation Attr)
Keep track of a location attribute pointing to a location list in the debug_loc section.
bool hasLabelAt(uint64_t Addr) const
const std::vector< AccelInfo > & getPubnames() const
const LocListAttributesTy & getLocationAttributes() const
const std::string & getClangModuleName() const
const RngListAttributesTy & getRangesAttributes()
void addNameAccelerator(const DIE *Die, DwarfStringPoolEntryRef Name, bool SkipPubnamesSection=false)
Add a name accelerator entry for Die with Name.
MCSymbol * getLabelBegin()
unsigned getUniqueID() const
void addNamespaceAccelerator(const DIE *Die, DwarfStringPoolEntryRef Name)
Add a name accelerator entry for Die with Name.
DIEInfo & getInfo(unsigned Idx)
const std::vector< AccelInfo > & getObjC() const
DIE * getOutputUnitDIE() const
DWARFUnit & getOrigUnit() const
StringRef getSysRoot()
Return the DW_AT_LLVM_sysroot of the compile unit or an empty StringRef.
void setLabelBegin(MCSymbol *S)
const RangesTy & getFunctionRanges() const
void noteRangeAttribute(const DIE &Die, PatchLocation Attr)
Keep track of a DW_AT_range attribute that we will need to patch up later.
void addFunctionRange(uint64_t LowPC, uint64_t HighPC, int64_t PCOffset)
Add a function range [LowPC, HighPC) that is relocated by applying offset PCOffset.
void addObjCAccelerator(const DIE *Die, DwarfStringPoolEntryRef Name, bool SkipPubnamesSection=false)
Add various accelerator entries for Die with Name which is stored in the string table at Offset.
const std::vector< AccelInfo > & getPubtypes() const
uint64_t getNextUnitOffset() const
void addTypeAccelerator(const DIE *Die, DwarfStringPoolEntryRef Name, bool ObjcClassImplementation, uint32_t QualifiedNameHash)
Add a type accelerator entry for Die with Name which is stored in the string table at Offset.
uint64_t getStartOffset() const
const std::vector< AccelInfo > & getNamespaces() const
uint64_t computeNextUnitOffset(uint16_t DwarfVersion)
Compute the end offset for this unit.
std::optional< uint64_t > getLowPc() const
CompileUnit(DWARFUnit &OrigUnit, unsigned ID, bool CanUseODR, StringRef ClangModuleName)
std::optional< PatchLocation > getUnitRangesAttribute() const
void addLabelLowPc(uint64_t LabelLowPc, int64_t PcOffset)
Add the low_pc of a label that is relocated by applying offset PCOffset.
void markEverythingAsKept()
Mark every DIE in this unit as kept.
uint64_t getHighPc() const
void setStartOffset(uint64_t DebugInfoSize)
A structured debug information entry.
Utility class that carries the DWARF compile/type unit and the debug info entry in an object.
dwarf::Tag getTag() const
unsigned getNumDIEs()
Returns the number of DIEs in the unit.
DWARFDie getUnitDIE(bool ExtractUnitDIEOnly=true)
uint32_t getDIEIndex(const DWARFDebugInfoEntry *Die) const
Return the index of a Die entry inside the unit's DIE vector.
A DeclContext is a named program scope that is used for ODR uniquing of types.
size_type count(const_arg_type_t< KeyT > Val) const
Return 1 if the specified key is in the map, 0 otherwise.
DwarfStringPoolEntryRef: Dwarf string pool entry reference.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
StringRef - Represent a constant reference to a string, i.e.
std::optional< uint64_t > toUnsigned(const std::optional< DWARFFormValue > &V)
Take an optional DWARFFormValue and try to extract an unsigned constant.
This is an optimization pass for GlobalISel generic memory operations.
const DIE * Die
DIE this entry describes.
DwarfStringPoolEntryRef Name
Name of the entry.
bool ObjcClassImplementation
Is this an ObjC class implementation?
uint32_t QualifiedNameHash
Hash of the fully qualified name.
AccelInfo(DwarfStringPoolEntryRef Name, const DIE *Die, bool SkipPubSection=false)
bool SkipPubSection
Emit this entry only in the apple_* sections.
AccelInfo(DwarfStringPoolEntryRef Name, const DIE *Die, uint32_t QualifiedNameHash, bool ObjCClassIsImplementation)
Information gathered about a DIE in the object file.
DeclContext * Ctxt
ODR Declaration context.
LLVM_DUMP_METHOD void dump()
bool InModuleScope
Is DIE in the clang module scope?
DIE * Clone
Cloned version of that DIE.
int64_t AddrAdjust
Address offset to apply to the described entity.
uint32_t ParentIdx
The index of this DIE's parent.
bool UnclonedReference
Is this a reference to a DIE that hasn't been cloned yet?
bool ODRMarkingDone
Is ODR marking done?
bool InDebugMap
Was this DIE's entity found in the map?
bool Prune
Is this a pure forward declaration we can strip?
bool Keep
Is the DIE part of the linked output?
bool Incomplete
Does DIE transitively refer an incomplete decl?
Hold the input and output of the debug info size in bytes.
PatchLocation(DIE::value_iterator I)
PatchLocation(DIE::value_iterator I, int64_t Reloc)
void set(uint64_t New) const