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,
35 void set(uint64_t New)
const {
38 assert(Old.getType() == DIEValue::isInteger);
42 uint64_t
get()
const {
44 return I->getDIEInteger().getValue();
81 : OrigUnit(OrigUnit), ID(ID), Ranges(RangeAlloc),
82 ClangModuleName(ClangModuleName) {
91 HasODR = CanUseODR && (*Lang == dwarf::DW_LANG_C_plus_plus ||
92 *Lang == dwarf::DW_LANG_C_plus_plus_03 ||
93 *Lang == dwarf::DW_LANG_C_plus_plus_11 ||
94 *Lang == dwarf::DW_LANG_C_plus_plus_14 ||
95 *Lang == dwarf::DW_LANG_ObjC_plus_plus);
105 NewUnit.emplace(OrigUnit.getVersion(), OrigUnit.getAddressByteSize(),
106 OrigUnit.getUnitDIE().getTag());
130 bool hasLabelAt(uint64_t Addr)
const {
return Labels.count(Addr); }
133 return UnitRangeAttribute;
139 return RangeAttributes;
142 const std::vector<std::pair<PatchLocation, int64_t>> &
144 return LocationAttributes;
153 void markEverythingAsKept();
158 uint64_t computeNextUnitOffset();
168 void fixupForwardReferences();
172 void addLabelLowPc(uint64_t LabelLowPc, int64_t PcOffset);
176 void addFunctionRange(uint64_t LowPC, uint64_t HighPC, int64_t PCOffset);
183 void noteLocationAttribute(
PatchLocation Attr, int64_t PcOffset);
190 bool SkipPubnamesSection =
false);
196 bool SkipPubnamesSection =
false);
201 bool ObjcClassImplementation,
221 bool SkipPubSection =
false)
222 : Name(Name), Die(Die), SkipPubSection(SkipPubSection) {}
225 uint32_t QualifiedNameHash,
bool ObjCClassIsImplementation)
226 : Name(Name), Die(Die), QualifiedNameHash(QualifiedNameHash),
227 SkipPubSection(
false),
228 ObjcClassImplementation(ObjCClassIsImplementation) {}
231 const std::vector<AccelInfo> &
getPubnames()
const {
return Pubnames; }
232 const std::vector<AccelInfo> &
getPubtypes()
const {
return Pubtypes; }
234 const std::vector<AccelInfo> &
getObjC()
const {
return ObjC; }
238 if (FileNum >= ResolvedPaths.size())
240 return ResolvedPaths[FileNum];
246 if (ResolvedPaths.size() <= FileNum)
247 ResolvedPaths.resize(FileNum + 1);
248 ResolvedPaths[FileNum] = Path;
257 std::vector<DIEInfo>
Info;
261 uint64_t StartOffset;
262 uint64_t NextUnitOffset;
274 std::tuple<DIE *, const CompileUnit *, DeclContext *, PatchLocation>>
275 ForwardDIEReferences;
290 std::vector<PatchLocation> RangeAttributes;
298 std::vector<std::pair<PatchLocation, int64_t>> LocationAttributes;
303 std::vector<AccelInfo> Pubnames;
304 std::vector<AccelInfo> Pubtypes;
305 std::vector<AccelInfo> Namespaces;
306 std::vector<AccelInfo> ObjC;
313 std::vector<StringRef> ResolvedPaths;
319 bool HasInterestingContent;
325 std::string ClangModuleName;
330 #endif // LLVM_DWARFLINKER_DWARFLINKERCOMPILEUNIT_H A DeclContext is a named program scope that is used for ODR uniquing of types.
MCSymbol * getLabelBegin()
This class represents lattice values for constants.
void setLabelBegin(MCSymbol *S)
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
uint64_t getLowPc() const
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
AccelInfo(DwarfStringPoolEntryRef Name, const DIE *Die, bool SkipPubSection=false)
bool hasLabelAt(uint64_t Addr) const
Stores all information relating to a compile unit, be it in its original instance in the object file ...
bool SkipPubSection
Emit this entry only in the apple_* sections.
uint64_t getNextUnitOffset() const
bool InDebugMap
Was this DIE's entity found in the map?
constexpr char Language[]
Key for Kernel::Metadata::mLanguage.
int64_t AddrAdjust
Address offset to apply to the described entity.
const std::vector< PatchLocation > & getRangesAttributes() const
uint32_t ParentIdx
The index of this DIE's parent.
CompileUnit(DWARFUnit &OrigUnit, unsigned ID, bool CanUseODR, StringRef ClangModuleName)
unsigned getNumDIEs()
Returns the number of DIEs in the unit.
void setHasInterestingContent()
const std::vector< std::pair< PatchLocation, int64_t > > & getLocationAttributes() const
Analysis containing CSE Info
void setResolvedPath(unsigned FileNum, StringRef Path)
Set the fully resolved path for the line-table's file FileNum to Path.
unsigned getUniqueID() const
StringRef getResolvedPath(unsigned FileNum)
Get the full path for file FileNum in the line table.
typename Sizer::Allocator Allocator
A structured debug information entry.
bool Keep
Is the DIE part of the linked output?
DIE * Clone
Cloned version of that DIE.
uint64_t getStartOffset() const
bool isClangModule() const
bool Prune
Is this a pure forward declaration we can strip?
unsigned getLanguage(StringRef LanguageString)
Optional< PatchLocation > getUnitRangesAttribute() const
PatchLocation(DIE::value_iterator I)
uint32_t QualifiedNameHash
Hash of the fully qualified name.
DeclContext * Ctxt
ODR Declaration context.
DWARFDie getUnitDIE(bool ExtractUnitDIEOnly=true)
DIE * getOutputUnitDIE() const
DIEInfo & getInfo(unsigned Idx)
Align max(MaybeAlign Lhs, Align Rhs)
const std::string & getClangModuleName() const
const std::vector< AccelInfo > & getPubnames() const
const std::vector< AccelInfo > & getNamespaces() const
const std::vector< AccelInfo > & getObjC() const
DwarfStringPoolEntryRef Name
Name of the entry.
String pool entry reference.
void setStartOffset(uint64_t DebugInfoSize)
const DIE * Die
DIE this entry describes.
const DIEInfo & getInfo(unsigned Idx) const
IntervalMap< KeyT, ValT, IntervalMapImpl::NodeSizer< KeyT, ValT >::LeafSize, IntervalMapHalfOpenInfo< KeyT > > HalfOpenIntervalMap
const std::vector< AccelInfo > & getPubtypes() const
bool hasInterestingContent()
AccelInfo(DwarfStringPoolEntryRef Name, const DIE *Die, uint32_t QualifiedNameHash, bool ObjCClassIsImplementation)
const FunctionIntervals & getFunctionRanges() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool ObjcClassImplementation
Is this an ObjC class implementation?
bool Incomplete
Does DIE transitively refer an incomplete decl?
uint64_t getHighPc() const
StringRef - Represent a constant reference to a string, i.e.
Information gathered about a DIE in the object file.
Optional< uint64_t > toUnsigned(const Optional< DWARFFormValue > &V)
Take an optional DWARFFormValue and try to extract an unsigned constant.
DWARFUnit & getOrigUnit() const