Go to the documentation of this file.
9 #ifndef LLVM_DWARFLINKER_DWARFLINKERCOMPILEUNIT_H
10 #define LLVM_DWARFLINKER_DWARFLINKERCOMPILEUNIT_H
21 template <
typename KeyT,
typename ValT>
23 IntervalMap<KeyT, ValT, IntervalMapImpl::NodeSizer<KeyT, ValT>::LeafSize,
44 return I->getDIEInteger().getValue();
87 : OrigUnit(OrigUnit),
ID(
ID), Ranges(RangeAlloc),
88 ClangModuleName(ClangModuleName) {
97 HasODR = CanUseODR && (*Lang == dwarf::DW_LANG_C_plus_plus ||
98 *Lang == dwarf::DW_LANG_C_plus_plus_03 ||
99 *Lang == dwarf::DW_LANG_C_plus_plus_11 ||
100 *Lang == dwarf::DW_LANG_C_plus_plus_14 ||
101 *Lang == dwarf::DW_LANG_ObjC_plus_plus);
143 return UnitRangeAttribute;
149 return RangeAttributes;
152 const std::vector<std::pair<PatchLocation, int64_t>> &
154 return LocationAttributes;
197 bool SkipPubnamesSection =
false);
203 bool SkipPubnamesSection =
false);
208 bool ObjcClassImplementation,
238 const std::vector<AccelInfo> &
getPubnames()
const {
return Pubnames; }
239 const std::vector<AccelInfo> &
getPubtypes()
const {
return Pubtypes; }
241 const std::vector<AccelInfo> &
getObjC()
const {
return ObjC; }
249 std::vector<DIEInfo> Info;
266 std::tuple<DIE *, const CompileUnit *, DeclContext *, PatchLocation>>
267 ForwardDIEReferences;
282 std::vector<PatchLocation> RangeAttributes;
290 std::vector<std::pair<PatchLocation, int64_t>> LocationAttributes;
295 std::vector<AccelInfo> Pubnames;
296 std::vector<AccelInfo> Pubtypes;
297 std::vector<AccelInfo> Namespaces;
298 std::vector<AccelInfo> ObjC;
311 std::string ClangModuleName;
316 #endif // LLVM_DWARFLINKER_DWARFLINKERCOMPILEUNIT_H
int64_t AddrAdjust
Address offset to apply to the described entity.
Optional< PatchLocation > getUnitRangesAttribute() const
bool hasLabelAt(uint64_t Addr) const
DWARFUnit & getOrigUnit() const
DeclContext * Ctxt
ODR Declaration context.
This is an optimization pass for GlobalISel generic memory operations.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
DIEInfo & getInfo(unsigned Idx)
A DeclContext is a named program scope that is used for ODR uniquing of types.
uint32_t ParentIdx
The index of this DIE's parent.
const std::vector< PatchLocation > & getRangesAttributes() const
IntervalMap< KeyT, ValT, IntervalMapImpl::NodeSizer< KeyT, ValT >::LeafSize, IntervalMapHalfOpenInfo< KeyT > > HalfOpenIntervalMap
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.
PatchLocation(DIE::value_iterator I)
bool Prune
Is this a pure forward declaration we can strip?
const std::string & getClangModuleName() const
const std::vector< AccelInfo > & getPubtypes() const
MCSymbol * getLabelBegin()
CompileUnit(DWARFUnit &OrigUnit, unsigned ID, bool CanUseODR, StringRef ClangModuleName)
size_type count(const_arg_type_t< KeyT > Val) const
Return 1 if the specified key is in the map, 0 otherwise.
void noteRangeAttribute(const DIE &Die, PatchLocation Attr)
Keep track of a DW_AT_range attribute that we will need to patch up later.
uint64_t getHighPc() const
A structured debug information entry.
Expected< ExpressionValue > max(const ExpressionValue &Lhs, const ExpressionValue &Rhs)
bool InDebugMap
Was this DIE's entity found in the map?
bool SkipPubSection
Emit this entry only in the apple_* sections.
const std::vector< std::pair< PatchLocation, int64_t > > & getLocationAttributes() const
DwarfStringPoolEntryRef: Dwarf string pool entry reference.
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.
static bool isInteger(StringRef Val)
AccelInfo(DwarfStringPoolEntryRef Name, const DIE *Die, uint32_t QualifiedNameHash, bool ObjCClassIsImplementation)
DWARFDie getUnitDIE(bool ExtractUnitDIEOnly=true)
DIE * Clone
Cloned version of that DIE.
unsigned getNumDIEs()
Returns the number of DIEs in the unit.
Information gathered about a DIE in the object file.
DIEInfo & getInfo(const DWARFDie &Die)
const std::vector< AccelInfo > & getNamespaces() const
const FunctionIntervals & getFunctionRanges() const
Hold the input and output of the debug info size in bytes.
unsigned getUniqueID() const
const std::vector< AccelInfo > & getPubnames() const
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
const DIEInfo & getInfo(unsigned Idx) const
typename Sizer::Allocator Allocator
const std::vector< AccelInfo > & getObjC() const
AccelInfo(DwarfStringPoolEntryRef Name, const DIE *Die, bool SkipPubSection=false)
void addLabelLowPc(uint64_t LabelLowPc, int64_t PcOffset)
Add the low_pc of a label that is relocated by applying offset PCOffset.
bool Keep
Is the DIE part of the linked output?
Stores all information relating to a compile unit, be it in its original instance in the object file ...
uint64_t getStartOffset() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
uint64_t getLowPc() const
uint64_t getNextUnitOffset() const
void setStartOffset(uint64_t DebugInfoSize)
void setLabelBegin(MCSymbol *S)
void addFunctionRange(uint64_t LowPC, uint64_t HighPC, int64_t PCOffset)
Add a function range [LowPC, HighPC) that is relocated by applying offset PCOffset.
bool ODRMarkingDone
Is ODR marking done?
DwarfStringPoolEntryRef Name
Name of the entry.
uint32_t QualifiedNameHash
Hash of the fully qualified name.
StringRef - Represent a constant reference to a string, i.e.
void addNameAccelerator(const DIE *Die, DwarfStringPoolEntryRef Name, bool SkipPubnamesSection=false)
Add a name accelerator entry for Die with Name.
void noteLocationAttribute(PatchLocation Attr, int64_t PcOffset)
Keep track of a location attribute pointing to a location list in the debug_loc section.
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
void addNamespaceAccelerator(const DIE *Die, DwarfStringPoolEntryRef Name)
Add a name accelerator entry for Die with Name.
uint64_t computeNextUnitOffset(uint16_t DwarfVersion)
Compute the end offset for this unit.
StringRef getSysRoot()
Return the DW_AT_LLVM_sysroot of the compile unit or an empty StringRef.
void fixupForwardReferences()
Apply all fixups recorded by noteForwardReference().
void set(uint64_t New) const
DIE * getOutputUnitDIE() const
Optional< uint64_t > toUnsigned(const Optional< DWARFFormValue > &V)
Take an optional DWARFFormValue and try to extract an unsigned constant.
bool ObjcClassImplementation
Is this an ObjC class implementation?
dwarf::Tag getTag() const
const DIE * Die
DIE this entry describes.
void noteForwardReference(DIE *Die, const CompileUnit *RefUnit, DeclContext *Ctxt, PatchLocation Attr)
Keep track of a forward reference to DIE Die in RefUnit by Attr.
bool InModuleScope
Is DIE in the clang module scope?
Utility class that carries the DWARF compile/type unit and the debug info entry in an object.
bool Incomplete
Does DIE transitively refer an incomplete decl?
void markEverythingAsKept()
Mark every DIE in this unit as kept.
bool isClangModule() const