9#ifndef LLVM_DWARFLINKER_CLASSIC_DWARFLINKERCOMPILEUNIT_H
10#define LLVM_DWARFLINKER_CLASSIC_DWARFLINKERCOMPILEUNIT_H
49 assert(Old.getType() == DIEValue::isInteger);
55 return I->getDIEInteger().getValue();
105#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
112 : OrigUnit(OrigUnit), ID(ID), ClangModuleName(ClangModuleName) {
113 Info.resize(OrigUnit.getNumDIEs());
115 auto CUDie = OrigUnit.getUnitDIE(
false);
121 HasODR = CanUseODR && (*Lang == dwarf::DW_LANG_C_plus_plus ||
122 *Lang == dwarf::DW_LANG_C_plus_plus_03 ||
123 *Lang == dwarf::DW_LANG_C_plus_plus_11 ||
124 *Lang == dwarf::DW_LANG_C_plus_plus_14 ||
125 *Lang == dwarf::DW_LANG_ObjC_plus_plus);
164 std::optional<uint64_t>
getLowPc()
const {
return LowPc; }
173 return UnitRangeAttribute;
177 return LocationAttributes;
183 return StmtSeqListAttributes;
232 bool SkipPubnamesSection =
false);
238 bool SkipPubnamesSection =
false);
243 bool ObjcClassImplementation,
273 const std::vector<AccelInfo> &
getPubnames()
const {
return Pubnames; }
274 const std::vector<AccelInfo> &
getPubtypes()
const {
return Pubtypes; }
276 const std::vector<AccelInfo> &
getObjC()
const {
return ObjC; }
284 std::vector<DIEInfo>
Info;
285 std::optional<BasicDIEUnit> NewUnit;
291 std::optional<uint64_t> LowPc;
301 std::tuple<DIE *, const CompileUnit *, DeclContext *, PatchLocation>>
302 ForwardDIEReferences;
316 std::optional<PatchLocation> UnitRangeAttribute;
335 std::vector<AccelInfo> Pubnames;
336 std::vector<AccelInfo> Pubtypes;
337 std::vector<AccelInfo> Namespaces;
338 std::vector<AccelInfo> ObjC;
351 std::string ClangModuleName;
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
Analysis containing CSE Info
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
This file defines the DenseMap class.
AddressRangesMap class maps values to the address ranges.
A structured debug information entry.
Utility class that carries the DWARF compile/type unit and the debug info entry in an object.
uint32_t getDIEIndex(const DWARFDebugInfoEntry *Die) const
Return the index of a Die entry inside the unit's DIE vector.
DwarfStringPoolEntryRef: Dwarf string pool entry reference.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
Stores all information relating to a compile unit, be it in its original instance in the object file ...
const std::vector< AccelInfo > & getNamespaces() const
const std::vector< AccelInfo > & getPubnames() const
LLVM_ABI void addFunctionRange(uint64_t LowPC, uint64_t HighPC, int64_t PCOffset)
Add a function range [LowPC, HighPC) that is relocated by applying offset PCOffset.
LLVM_ABI void noteStmtSeqListAttribute(PatchLocation Attr)
const std::vector< AccelInfo > & getPubtypes() const
const std::vector< AccelInfo > & getObjC() const
LLVM_ABI void fixupForwardReferences()
Apply all fixups recorded by noteForwardReference().
const DIEInfo & getInfo(unsigned Idx) const
LLVM_ABI void noteForwardReference(DIE *Die, const CompileUnit *RefUnit, DeclContext *Ctxt, PatchLocation Attr)
Keep track of a forward reference to DIE Die in RefUnit by Attr.
LLVM_ABI void noteLocationAttribute(PatchLocation Attr)
Keep track of a location attribute pointing to a location list in the debug_loc section.
std::optional< uint64_t > getLowPc() const
LLVM_ABI void addNameAccelerator(const DIE *Die, DwarfStringPoolEntryRef Name, bool SkipPubnamesSection=false)
Add a name accelerator entry for Die with Name.
const StmtSeqListAttributesTy & getStmtSeqListAttributes() const
LLVM_ABI void addNamespaceAccelerator(const DIE *Die, DwarfStringPoolEntryRef Name)
Add a name accelerator entry for Die with Name.
uint64_t getStartOffset() const
DIEInfo & getInfo(const DWARFDie &Die)
DIE * getOutputUnitDIE() const
uint64_t getNextUnitOffset() const
LLVM_ABI uint16_t getLanguage()
uint64_t getHighPc() const
LLVM_ABI StringRef getSysRoot()
Return the DW_AT_LLVM_sysroot of the compile unit or an empty StringRef.
DIEInfo & getInfo(unsigned Idx)
std::optional< PatchLocation > getUnitRangesAttribute() const
void setStartOffset(uint64_t DebugInfoSize)
LLVM_ABI void noteRangeAttribute(const DIE &Die, PatchLocation Attr)
Keep track of a DW_AT_range attribute that we will need to patch up later.
void setLabelBegin(MCSymbol *S)
LLVM_ABI 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.
bool hasLabelAt(uint64_t Addr) const
LLVM_ABI 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.
DWARFUnit & getOrigUnit() const
const LocListAttributesTy & getLocationAttributes() const
bool isClangModule() const
LLVM_ABI uint64_t computeNextUnitOffset(uint16_t DwarfVersion)
Compute the end offset for this unit.
MCSymbol * getLabelBegin()
const RangesTy & getFunctionRanges() const
LLVM_ABI void addLabelLowPc(uint64_t LabelLowPc, int64_t PcOffset)
Add the low_pc of a label that is relocated by applying offset PCOffset.
LLVM_ABI void markEverythingAsKept()
Mark every DIE in this unit as kept.
CompileUnit(DWARFUnit &OrigUnit, unsigned ID, bool CanUseODR, StringRef ClangModuleName)
unsigned getUniqueID() const
const RngListAttributesTy & getRangesAttributes()
dwarf::Tag getTag() const
const std::string & getClangModuleName() const
A DeclContext is a named program scope that is used for ODR uniquing of types.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
SmallVector< PatchLocation > RngListAttributesTy
SmallVector< PatchLocation > StmtSeqListAttributesTy
AddressRangesMap RangesTy
Mapped value in the address map is the offset to apply to the linked address.
SmallVector< PatchLocation > LocListAttributesTy
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.
Hold the input and output of the debug info size in bytes.
AccelInfo(DwarfStringPoolEntryRef Name, const DIE *Die, uint32_t QualifiedNameHash, bool ObjCClassIsImplementation)
AccelInfo(DwarfStringPoolEntryRef Name, const DIE *Die, bool SkipPubSection=false)
DwarfStringPoolEntryRef Name
Name of the entry.
uint32_t QualifiedNameHash
Hash of the fully qualified name.
bool ObjcClassImplementation
Is this an ObjC class implementation?
bool SkipPubSection
Emit this entry only in the apple_* sections.
const DIE * Die
DIE this entry describes.
Information gathered about a DIE in the object file.
uint32_t ParentIdx
The index of this DIE's parent.
bool Prune
Is this a pure forward declaration we can strip?
bool ODRMarkingDone
Is ODR marking done?
int64_t AddrAdjust
Address offset to apply to the described entity.
bool HasLocationExpressionAddr
Is this a variable with a location attribute referencing address?
bool InDebugMap
Was this DIE's entity found in the map?
DIE * Clone
Cloned version of that DIE.
LLVM_DUMP_METHOD void dump()
bool UnclonedReference
Is this a reference to a DIE that hasn't been cloned yet?
bool InModuleScope
Is DIE in the clang module scope?
bool Incomplete
Does DIE transitively refer an incomplete decl?
DeclContext * Ctxt
ODR Declaration context.
bool Keep
Is the DIE part of the linked output?
void set(uint64_t New) const
PatchLocation(DIE::value_iterator I, int64_t Reloc)
PatchLocation(DIE::value_iterator I)