63 return dwarf::DW_TAG_skeleton_unit;
65 return dwarf::DW_TAG_compile_unit;
90 : dwarf::DW_FORM_GNU_addr_index,
143 DeclContext = SDMDecl->getScope();
144 assert(SDMDecl->isStaticMember() &&
"Expected static member decl");
148 addDIEEntry(*VariableDIE, dwarf::DW_AT_specification, *VariableSpecDIE);
151 if (GTy != SDMDecl->getBaseType())
161 addFlag(*VariableDIE, dwarf::DW_AT_external);
168 addFlag(*VariableDIE, dwarf::DW_AT_declaration);
173 addUInt(*VariableDIE, dwarf::DW_AT_alignment, dwarf::DW_FORM_udata,
187 bool addToAccelTable =
false;
190 std::unique_ptr<DIEDwarfExpression> DwarfExpr;
191 for (
const auto &
GE : GlobalExprs) {
198 if (GlobalExprs.size() == 1 && Expr && Expr->
isConstant()) {
199 addToAccelTable =
true;
210 if (!Global && (!Expr || !Expr->
isConstant()))
218 addToAccelTable =
true;
220 DwarfExpr = std::make_unique<DIEDwarfExpression>(*
Asm, *
this, *Loc);
230 unsigned LocalNVPTXAddressSpace;
234 if (NewExpr != Expr) {
236 NVPTXAddressSpace = LocalNVPTXAddressSpace;
239 DwarfExpr->addFragmentOffset(Expr);
250 assert((PointerSize == 4 || PointerSize == 8) &&
251 "Add support for other sizes if necessary");
255 addUInt(*Loc, dwarf::DW_FORM_data1,
256 PointerSize == 4 ? dwarf::DW_OP_const4u
257 : dwarf::DW_OP_const8u);
260 addExpr(*Loc, dwarf::DW_FORM_udata,
263 addUInt(*Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_GNU_const_index);
264 addUInt(*Loc, dwarf::DW_FORM_udata,
268 addUInt(*Loc, dwarf::DW_FORM_data1,
270 : dwarf::DW_OP_form_tls_address);
281 if (DwarfExpr->isUnknownLocation())
282 DwarfExpr->setMemoryLocationKind();
283 DwarfExpr->addExpression(Expr);
290 const unsigned NVPTX_ADDR_global_space = 5;
291 addUInt(*VariableDIE, dwarf::DW_AT_address_class, dwarf::DW_FORM_data1,
292 NVPTXAddressSpace ? *NVPTXAddressSpace : NVPTX_ADDR_global_space);
295 addBlock(*VariableDIE, dwarf::DW_AT_location, DwarfExpr->finalize());
300 if (addToAccelTable) {
321 addString(NDie, dwarf::DW_AT_name, Name);
337 if (CURanges.empty() || !SameAsPrevCU ||
338 (&CURanges.back().End->getSection() !=
340 CURanges.push_back(Range);
344 CURanges.back().End = Range.
End;
377 assert(Begin &&
"Begin label should not be null!");
378 assert(End &&
"End label should not be null!");
399 addFlag(*SPDie, dwarf::DW_AT_APPLE_omit_frame_ptr);
405 addUInt(*Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_call_frame_cfa);
406 addBlock(*SPDie, dwarf::DW_AT_frame_base, Loc);
411 addAddress(*SPDie, dwarf::DW_AT_frame_base, Location);
431 "Only handle inlined subprograms here, use " 432 "constructSubprogramScopeDIE for non-inlined " 452 bool HasNonScopeChildren =
false;
460 if (!HasNonScopeChildren) {
461 FinalChildren.
insert(FinalChildren.
end(),
462 std::make_move_iterator(Children.begin()),
463 std::make_move_iterator(Children.end()));
467 assert(ScopeDIE &&
"Scope DIE should not be null.");
471 for (
auto &
I : Children)
474 FinalChildren.
push_back(std::move(ScopeDIE));
480 HasRangeLists =
true;
485 ->
addRange(*(Skeleton ? Skeleton :
this), std::move(Range));
488 auto &
List = *IndexAndList.second;
496 addUInt(ScopeDIE, dwarf::DW_AT_ranges, dwarf::DW_FORM_rnglistx, Index);
538 DIE *OriginDIE = getAbstractSPDies()[InlinedSP];
539 assert(OriginDIE &&
"Unable to find original DIE for an inlined subprogram.");
542 addDIEEntry(*ScopeDIE, dwarf::DW_AT_abstract_origin, *OriginDIE);
550 addUInt(*ScopeDIE, dwarf::DW_AT_call_line,
None, IA->getLine());
552 addUInt(*ScopeDIE, dwarf::DW_AT_call_column,
None, IA->getColumn());
554 addUInt(*ScopeDIE, dwarf::DW_AT_GNU_discriminator,
None,
555 IA->getDiscriminator());
581 auto D = constructVariableDIEImpl(DV, Abstract);
598 DIE *DwarfCompileUnit::constructVariableDIEImpl(
const DbgVariable &DV,
616 addUInt(*VariableDie, dwarf::DW_AT_LLVM_tag_offset, dwarf::DW_FORM_data1,
623 if (DVal->isLocation())
625 else if (DVal->isInt()) {
627 if (Expr && Expr->getNumElements()) {
636 addUInt(*VariableDie, dwarf::DW_AT_LLVM_tag_offset,
637 dwarf::DW_FORM_data1, *DwarfExpr.
TagOffset);
641 }
else if (DVal->isConstantFP()) {
643 }
else if (DVal->isConstantInt()) {
657 unsigned FrameReg = 0;
670 unsigned LocalNVPTXAddressSpace;
674 if (NewExpr != Expr) {
676 NVPTXAddressSpace = LocalNVPTXAddressSpace;
695 const unsigned NVPTX_ADDR_local_space = 6;
696 addUInt(*VariableDie, dwarf::DW_AT_address_class, dwarf::DW_FORM_data1,
697 NVPTXAddressSpace ? *NVPTXAddressSpace : NVPTX_ADDR_local_space);
701 addUInt(*VariableDie, dwarf::DW_AT_LLVM_tag_offset, dwarf::DW_FORM_data1,
709 DIE *&ObjectPointer) {
720 if (!Array || Array->getTag() != dwarf::DW_TAG_array_type)
722 for (
auto *El : Array->getElements()) {
723 if (
auto *Subrange = dyn_cast<DISubrange>(El)) {
724 auto Count = Subrange->getCount();
725 if (
auto *Dependency = Count.dyn_cast<
DIVariable *>())
746 for (
auto Var :
reverse(Input)) {
747 DbgVar.
insert({Var->getVariable(), Var});
752 while (!WorkList.
empty()) {
753 auto Item = WorkList.
back();
755 bool visitedAllDependencies = Item.getInt();
763 if (Visited.
count(Var))
767 if (visitedAllDependencies) {
774 auto Res = Visiting.
insert(Var);
776 assert(
false &&
"dependency cycle in local variables");
784 auto Dep = dyn_cast_or_null<const DILocalVariable>(Dependency);
793 bool *HasNonScopeChildren) {
795 DIE *ObjectPointer =
nullptr;
799 for (
auto &DV : Vars.Args)
815 if (HasNonScopeChildren)
816 *HasNonScopeChildren = !Children.
empty();
824 return ObjectPointer;
838 addDIEEntry(ScopeDIE, dwarf::DW_AT_object_pointer, *ObjectPointer);
847 if (FnArgs.
size() > 1 && !FnArgs[FnArgs.
size() - 1] &&
862 for (
auto &
I : Children)
865 return ObjectPointer;
885 else if (
auto *SPDecl =
SP->getDeclaration()) {
893 ContextCU =
DD->
lookupCU(ContextDIE->getUnitDie());
898 AbsDef = &ContextCU->
createAndAddDIE(dwarf::DW_TAG_subprogram, *ContextDIE,
nullptr);
904 ContextCU->
addDIEEntry(*AbsDef, dwarf::DW_AT_object_pointer, *ObjectPointer);
916 case dwarf::DW_TAG_call_site:
917 return dwarf::DW_TAG_GNU_call_site;
918 case dwarf::DW_TAG_call_site_parameter:
919 return dwarf::DW_TAG_GNU_call_site_parameter;
930 case dwarf::DW_AT_call_all_calls:
931 return dwarf::DW_AT_GNU_all_call_sites;
932 case dwarf::DW_AT_call_target:
933 return dwarf::DW_AT_GNU_call_site_target;
934 case dwarf::DW_AT_call_origin:
935 return dwarf::DW_AT_abstract_origin;
936 case dwarf::DW_AT_call_pc:
937 return dwarf::DW_AT_low_pc;
938 case dwarf::DW_AT_call_value:
939 return dwarf::DW_AT_GNU_call_site_value;
940 case dwarf::DW_AT_call_tail_call:
941 return dwarf::DW_AT_GNU_tail_call;
952 case dwarf::DW_OP_entry_value:
953 return dwarf::DW_OP_GNU_entry_value;
961 const MCSymbol *PCAddr,
const MCExpr *PCOffset,
unsigned CallReg) {
972 assert(CalleeDIE &&
"Could not create DIE for call site entry origin");
984 assert(PCAddr &&
"Missing PC information for a call");
987 assert(PCOffset &&
"Missing return PC information for a call");
988 addAddressExpr(CallSiteDIE, dwarf::DW_AT_call_return_pc, PCOffset);
996 for (
const auto &Param : Params) {
997 unsigned Register = Param.getRegister();
998 auto CallSiteDieParam =
1002 addAddress(*CallSiteDieParam, dwarf::DW_AT_location,
1014 CallSiteDIE.
addChild(CallSiteDieParam);
1024 if (
auto *NS = dyn_cast<DINamespace>(Entity))
1026 else if (
auto *M = dyn_cast<DIModule>(Entity))
1028 else if (
auto *
SP = dyn_cast<DISubprogram>(Entity))
1030 else if (
auto *
T = dyn_cast<DIType>(Entity))
1032 else if (
auto *GV = dyn_cast<DIGlobalVariable>(Entity))
1035 EntityDie =
getDIE(Entity);
1038 addDIEEntry(*IMDie, dwarf::DW_AT_import, *EntityDie);
1041 addString(*IMDie, dwarf::DW_AT_name, Name);
1048 if (
DIE *AbsSPDIE = getAbstractSPDies().
lookup(SP)) {
1051 addDIEEntry(*D, dwarf::DW_AT_abstract_origin, *AbsSPDIE);
1063 auto *Die = Entity->
getDIE();
1067 if (AbsEntity && AbsEntity->
getDIE()) {
1071 if (
const DbgVariable *Var = dyn_cast<const DbgVariable>(Entity))
1073 else if ((Label = dyn_cast<const DbgLabel>(Entity)))
1080 if (
const auto *Sym = Label->
getSymbol())
1085 auto &AbstractEntities = getAbstractEntities();
1086 auto I = AbstractEntities.find(Node);
1087 if (
I != AbstractEntities.end())
1088 return I->second.get();
1095 auto &Entity = getAbstractEntities()[Node];
1096 if (isa<const DILocalVariable>(Node)) {
1097 Entity = std::make_unique<DbgVariable>(
1098 cast<const DILocalVariable>(Node),
nullptr );;
1100 }
else if (isa<const DILabel>(Node)) {
1101 Entity = std::make_unique<DbgLabel>(
1102 cast<const DILabel>(Node),
nullptr );
1116 : dwarf::DW_UT_compile;
1145 GlobalNames[FullName] = &Die;
1157 GlobalNames.insert(std::make_pair(std::move(FullName), &
getUnitDie()));
1166 GlobalTypes[FullName] = &Die;
1178 GlobalTypes.insert(std::make_pair(std::move(FullName), &
getUnitDie()));
1186 addAddress(Die, dwarf::DW_AT_location, Location);
1207 addUInt(Die, dwarf::DW_AT_LLVM_tag_offset, dwarf::DW_FORM_data1,
1241 addUInt(Die, dwarf::DW_AT_LLVM_tag_offset, dwarf::DW_FORM_data1,
1250 Form =dwarf::DW_FORM_sec_offset;
1252 Form =dwarf::DW_FORM_loclistx;
1260 addString(VariableDie, dwarf::DW_AT_name, Name);
1263 if (
uint32_t AlignInBytes = DIVar->getAlignInBytes())
1264 addUInt(VariableDie, dwarf::DW_AT_alignment, dwarf::DW_FORM_udata,
1270 addFlag(VariableDie, dwarf::DW_AT_artificial);
1277 addString(LabelDie, dwarf::DW_AT_name, Name);
1296 auto *SPDecl = SP->getDeclaration();
1302 bool DwarfCompileUnit::isDwoUnit()
const {
1320 : dwarf::DW_AT_GNU_addr_base,
1341 addUInt(Die, dwarf::DW_AT_encoding, dwarf::DW_FORM_data1, Btr.Encoding);
1342 addUInt(Die, dwarf::DW_AT_byte_size,
None, Btr.BitSize / 8);
Scope
Defines the scope in which this symbol should be visible: Default – Visible in the public interface ...
const DICompileUnit * getCUNode() const
static void appendOffset(SmallVectorImpl< uint64_t > &Ops, int64_t Offset)
Append Ops with operations to apply the Offset.
A DeclContext is a named program scope that is used for ODR uniquing of types.
const TargetLoweringObjectFile & getObjFileLowering() const
Return information about object file lowering.
void emitInt64(uint64_t Value) const
Emit a long long directive and value.
DIE::value_iterator addSectionDelta(DIE &Die, dwarf::Attribute Attribute, const MCSymbol *Hi, const MCSymbol *Lo)
addSectionDelta - Add a label delta attribute data and value.
const DILocalScope * getScopeNode() const
bool isConstant() const
Determine whether this represents a standalone constant value.
std::vector< BaseTypeRef > ExprRefedBaseTypes
void addFlag(DIE &Die, dwarf::Attribute Attribute)
Add a flag that is true to the DIE.
bool isEntryValue() const
Check if the expression consists of exactly one entry value operand.
bool supportDebugThreadLocalLocation() const
Target supports TLS offset relocation in debug section?
LLVM_NODISCARD std::string str() const
str - Get the contents as an std::string.
bool isDefinition() const
unsigned getDebugLocListIndex() const
void addLabelDelta(DIE &Die, dwarf::Attribute Attribute, const MCSymbol *Hi, const MCSymbol *Lo)
Add a label delta attribute data and value.
std::unique_ptr< MCStreamer > OutStreamer
This is the MCStreamer object for the file we are generating.
DIELoc - Represents an expression location.
This class represents lattice values for constants.
bool isAbstractScope() const
MCSection * getDwarfLineSection() const
void addUnsignedConstant(uint64_t Value)
Emit an unsigned constant.
DIE * getOrCreateStaticMemberDIE(const DIDerivedType *DT)
Create new static data member DIE.
void addOpAddress(DIELoc &Die, const MCSymbol *Sym)
Add a dwarf op address data and value using the form given and an op of either DW_FORM_addr or DW_FOR...
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
A Module instance is used to store all the information related to an LLVM module. ...
void setMemoryLocationKind()
Lock this down to become a memory location description.
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
virtual int getFrameIndexReference(const MachineFunction &MF, int FI, unsigned &FrameReg) const
getFrameIndexReference - This method should return the base register and offset used to reference a f...
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
void addGlobalName(StringRef Name, const DIE &Die, const DIScope *Context) override
Add a new global name to the compile unit.
void applyLabelAttributes(const DbgLabel &Label, DIE &LabelDie)
const DIType * getType() const
void push_back(const T &Elt)
AccelTableKind getAccelTableKind() const
Returns what kind (if any) of accelerator tables to emit.
static bool isPhysicalRegister(unsigned Reg)
Return true if the specified register number is in the physical register namespace.
void insertDIE(const DINode *Desc, DIE *D)
Insert DIE into the map.
StringRef toStringRef(SmallVectorImpl< char > &Out) const
This returns the twine as a single StringRef if it can be represented as such.
Collects and handles dwarf debug information.
static bool lookup(const GsymReader &GR, DataExtractor &Data, uint64_t &Offset, uint64_t BaseAddr, uint64_t Addr, SourceLocations &SrcLocs, llvm::Error &Err)
A Lookup helper functions.
void beginEntryValueExpression(DIExpressionCursor &ExprCursor)
Begin emission of an entry value dwarf operation.
bool useGNUTLSOpcode() const
Returns whether to use DW_OP_GNU_push_tls_address, instead of the standard DW_OP_form_tls_address opc...
SmallVectorImpl< InsnRange > & getRanges()
This class is defined as the common parent of DbgVariable and DbgLabel such that it could levarage po...
void addRange(RangeSpan Range)
addRange - Add an address range to the list of ranges for this unit.
bool hasDLLImportStorageClass() const
void attachLowHighPC(DIE &D, const MCSymbol *Begin, const MCSymbol *End)
unsigned const TargetRegisterInfo * TRI
MachineFunction * MF
The current machine function.
dwarf::Tag getDwarf5OrGNUTag(dwarf::Tag Tag) const
This takes a DWARF 5 tag and returns it or a GNU analog.
DwarfCompileUnit & getCU() override
void reserve(size_type N)
Represents a pointer to a location list in the debug_loc section.
LexicalScope - This class is used to track scope information.
void addType(DIE &Entity, const DIType *Ty, dwarf::Attribute Attribute=dwarf::DW_AT_type)
Add a new type attribute to the specified entity.
DIE::value_iterator addSectionLabel(DIE &Die, dwarf::Attribute Attribute, const MCSymbol *Label, const MCSymbol *Sec)
Add a Dwarf section label attribute data and value.
const MachineFunction * getCurrentFunction() const
StringRef getName() const
AsmPrinter * Asm
Target of Dwarf emission.
Tagged DWARF-like metadata node.
void constructTypeDIE(DIE &Buffer, const DICompositeType *CTy)
bool useSplitDwarf() const
Returns whether or not to change the current debug info for the split dwarf proposal support...
const MCSymbol * getSymbol() const
DIE * getDIE(const DINode *D) const
Returns the DIE map slot for the specified debug variable.
DwarfCompileUnit(unsigned UID, const DICompileUnit *Node, AsmPrinter *A, DwarfDebug *DW, DwarfFile *DWU, UnitKind Kind=UnitKind::Full)
DbgEntity * getExistingAbstractEntity(const DINode *Node)
dwarf::LocationAtom getDwarf5OrGNULocationAtom(dwarf::LocationAtom Loc) const
This takes a DWARF 5 location atom and either returns it or a GNU analog.
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
void attachRangesOrLowHighPC(DIE &D, SmallVector< RangeSpan, 2 > Ranges)
StringRef getName() const
void addArangeLabel(SymbolCU SCU)
Add a label so that arange data can be generated for it.
StringRef getName() const
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
bool isDebugDirectivesOnly() const
DIE * getOrCreateCommonBlock(const DICommonBlock *CB, ArrayRef< GlobalExpr > GlobalExprs)
SmallVectorImpl< LexicalScope * > & getChildren()
void addComplexAddress(const DbgVariable &DV, DIE &Die, dwarf::Attribute Attribute, const MachineLocation &Location)
Start with the address based on the location provided, and generate the DWARF information necessary t...
LexicalScope * getParent() const
DIE & addChildFront(DIE *Child)
bool isObjectPointer() const
void constructCallSiteParmEntryDIEs(DIE &CallSiteDIE, SmallVector< DbgCallSiteParam, 4 > &Params)
Construct call site parameter DIEs for the CallSiteDIE.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
StringRef getName() const
Base class for the full range of assembler expressions which are needed for parsing.
void addSubprogramNames(const DICompileUnit &CU, const DISubprogram *SP, DIE &Die)
void addConstantFPValue(DIE &Die, const MachineOperand &MO)
Add constant value entry in variable DIE.
void emitHeader(bool UseOffsets) override
Emit the header for this unit, not including the initial length field.
void addGlobalTypeUnitType(const DIType *Ty, const DIScope *Context)
Add a new global type present in a type unit to this compile unit.
void setCallSiteParamValueFlag()
Lock this down to become a call site parameter location.
bool isLexicalScopeDIENull(LexicalScope *Scope)
A helper function to check whether the DIE for a given Scope is going to be null. ...
DIE & constructCallSiteEntryDIE(DIE &ScopeDIE, const DISubprogram *CalleeSP, bool IsTail, const MCSymbol *PCAddr, const MCExpr *PCOffset, unsigned CallReg)
Construct a call site entry DIE describing a call within Scope to a callee described by CalleeSP...
void addAccelName(const DICompileUnit &CU, StringRef Name, const DIE &Die)
DenseMap< LexicalScope *, ScopeVars > & getScopeVariables()
Holds a DIExpression and keeps track of how many operands have been consumed so far.
DISubprogram * getDISubprogram(const MDNode *Scope)
Find subprogram that is enclosing this scope.
static bool useGNUAnalogForDwarf5Feature(DwarfDebug *DD)
Whether to use the GNU analog for a DWARF5 tag, attribute, or location atom.
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
StringRef getFilename() const
DIE * getOrCreateTypeDIE(const MDNode *TyNode)
Find existing DIE or create new DIE for the given type.
void addBlock(DIE &Die, dwarf::Attribute Attribute, DIELoc *Loc)
Add block data.
void createAbstractEntity(const DINode *Node, LexicalScope *Scope)
static Optional< DebugNameTableKind > getNameTableKind(StringRef Str)
void addString(DIE &Die, dwarf::Attribute Attribute, StringRef Str)
Add a string attribute data and value.
DIE * constructInlinedScopeDIE(LexicalScope *Scope)
This scope represents inlined body of a function.
auto reverse(ContainerTy &&C, typename std::enable_if< has_rbegin< ContainerTy >::value >::type *=nullptr) -> decltype(make_range(C.rbegin(), C.rend()))
AddressPool & getAddressPool()
bool isLocalToUnit() const
unsigned getUniqueID() const
DIScope * getScope() const
const DIExpression * getSingleExpression() const
MCSymbol * getFunctionBegin() const
uint64_t getDWOId() const
This class is used to track local variable information.
bool DisableFramePointerElim(const MachineFunction &MF) const
DisableFramePointerElim - This returns true if frame pointer elimination optimization should be disab...
void addAddrTableBase()
Add the DW_AT_addr_base attribute to the unit DIE.
const DILocalVariable * getVariable() const
DIE * constructVariableDIE(DbgVariable &DV, bool Abstract=false)
constructVariableDIE - Construct a DIE for the given DbgVariable.
void addAddressExpr(DIE &Die, dwarf::Attribute Attribute, const MCExpr *Expr)
Add an attribute containing an address expression to Die.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
.apple_names, .apple_namespaces, .apple_types, .apple_objc.
void addGlobalNameForTypeUnit(StringRef Name, const DIScope *Context)
Add a new global name present in a type unit to this compile unit.
DIE * getOrCreateNameSpace(const DINamespace *NS)
DIE & addChild(DIE *Child)
Add a child to the DIE.
DIScope * getScope() const
void addExpr(DIELoc &Die, dwarf::Form Form, const MCExpr *Expr)
Add a Dwarf expression attribute data and value.
const DwarfCompileUnit * getPrevCU() const
Returns the previous CU that was being updated.
bool hasComplexAddress() const
This class is used to track label information.
void addConstantValue(DIE &Die, const MachineOperand &MO, const DIType *Ty)
Add constant value entry in variable DIE.
dwarf::Attribute getDwarf5OrGNUAttr(dwarf::Attribute Attr) const
This takes a DWARF 5 attribute and returns it or a GNU analog.
bool useEmulatedTLS() const
Returns true if this target uses emulated TLS.
static DIE * get(BumpPtrAllocator &Alloc, dwarf::Tag Tag)
void applySubprogramAttributes(const DISubprogram *SP, DIE &SPDie, bool SkipSPAttributes=false)
void addSourceLine(DIE &Die, unsigned Line, const DIFile *File)
Add location information to specified debug information entry.
This dwarf writer support class manages information associated with a source file.
void addLocationList(DIE &Die, dwarf::Attribute Attribute, unsigned Index)
Add a Dwarf loclistptr attribute data and value.
StringRef AttributeEncodingString(unsigned Encoding)
MCSection * getDwarfAddrSection() const
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
const DILocation * getInlinedAt() const
Instrumentation for Order File
unsigned getPointerSize(unsigned AS=0) const
Layout pointer size FIXME: The defaults need to be removed once all of the backends/clients are updat...
A structured debug information entry.
std::pair< iterator, bool > insert(const ValueT &V)
void setEntryValueFlag()
Lock this down to become an entry value location.
TargetMachine & TM
Target machine description.
This class is intended to be used as a driving class for all asm writers.
unsigned getOrCreateSourceID(const DIFile *File) override
Look up the source ID for the given file.
DIE * createScopeChildrenDIE(LexicalScope *Scope, SmallVectorImpl< DIE *> &Children, bool *HasNonScopeChildren=nullptr)
A helper function to create children of a Scope DIE.
void finishEntityDefinition(const DbgEntity *Entity)
MDTuple * getTemplateParams() const
DIDerivedType * getStaticDataMemberDeclaration() const
void emitCommonHeader(bool UseOffsets, dwarf::UnitType UT)
Emit the common part of the header for this unit.
static dwarf::Tag GetCompileUnitType(UnitKind Kind, DwarfDebug *DW)
void addAddress(DIE &Die, dwarf::Attribute Attribute, const MachineLocation &Location)
Add an address attribute to a die based on the location provided.
DIE * getOrCreateSubprogramDIE(const DISubprogram *SP, bool Minimal=false)
const Triple & getTargetTriple() const
bool hasFrameIndexExprs() const
Base class for variables.
DIE * createAndAddScopeChildren(LexicalScope *Scope, DIE &ScopeDIE)
const DILabel * getLabel() const
Accessors.
bool addScopeVariable(LexicalScope *LS, DbgVariable *Var)
void addLabelAddress(DIE &Die, dwarf::Attribute Attribute, const MCSymbol *Label)
addLabelAddress - Add a dwarf label attribute data and value using either DW_FORM_addr or DW_FORM_GNU...
dwarf::Tag getTag() const
Helper used to pair up a symbol and its DWARF compile unit.
DIScope * getScope() const
StringRef getDirectory() const
bool useAllLinkageNames() const
Returns whether we should emit all DW_AT_[MIPS_]linkage_name.
MCSymbol * getLabelAfterInsn(const MachineInstr *MI)
Return Label immediately following the instruction.
bool hasDwarfPubSections() const
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
element_iterator elements_end() const
void addScopeRangeList(DIE &ScopeDIE, SmallVector< RangeSpan, 2 > Range)
A helper function to construct a RangeSpanList for a given lexical scope.
uint64_t getElement(unsigned I) const
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
ArrayRef< FrameIndexExpr > getFrameIndexExprs() const
Get the FI entries, sorted by fragment offset.
An imported module (C++ using directive or similar).
Base class for scope-like contexts.
DIE * constructImportedEntityDIE(const DIImportedEntity *Module)
Construct import_module DIE.
std::string getParentContextString(const DIScope *Context) const
Get string containing language specific context for a global name.
UnitType
Constants for unit types in DWARF v5.
void addExpression(DIExpressionCursor &&Expr, unsigned FragmentOffsetInBits=0)
Emit all remaining operations in the DIExpressionCursor.
DIE * constructLabelDIE(DbgLabel &DL, const LexicalScope &Scope)
Construct a DIE for the given DbgLabel.
void constructAbstractSubprogramScopeDIE(LexicalScope *Scope)
void addScopeLabel(LexicalScope *LS, DbgLabel *Label)
bool useSectionsAsReferences() const
Returns whether to use sections as labels rather than temp symbols.
DenseMap< LexicalScope *, LabelList > & getScopeLabels()
StringRef getName() const
void setPrevCU(const DwarfCompileUnit *PrevCU)
static Optional< DebugEmissionKind > getEmissionKind(StringRef Str)
StringRef getName() const
MCSymbol * getSymbol(const GlobalValue *GV) const
DwarfCompileUnit * lookupCU(const DIE *Die)
Find the matching DwarfCompileUnit for the given CU DIE.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
virtual Register getFrameRegister(const MachineFunction &MF) const =0
Debug information queries.
Information about stack frame layout on the target.
void addLinkageName(DIE &Die, StringRef LinkageName)
Add a linkage name, if it isn't empty.
void applySubprogramAttributesToDefinition(const DISubprogram *SP, DIE &SPDie)
Optional< MD5::MD5Result > getMD5AsBytes(const DIFile *File) const
If the File has an MD5 checksum, return it as an MD5Result allocated in the MCContext.
MCSymbol * getBeginSymbol()
void finishSubprogramDefinition(const DISubprogram *SP)
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
bool useAppleExtensionAttributes() const
MCSymbol * getFunctionEnd() const
static SmallVector< const DIVariable *, 2 > dependencies(DbgVariable *Var)
Return all DIVariables that appear in count: expressions.
StringRef getDisplayName() const
void addTemplateParams(DIE &Buffer, DINodeArray TParams)
Add template parameters in buffer.
Implements a dense probed hash-table based set with some number of buckets stored inline...
StringRef getLinkageName() const
DIE & constructSubprogramScopeDIE(const DISubprogram *Sub, LexicalScope *Scope)
Construct a DIE for this subprogram scope.
This file contains constants used for implementing Dwarf debug support.
bool isDefined() const
isDefined - Check if this symbol is defined (i.e., it has an address).
StringRef getName() const
MCSection & getSection() const
Get the section associated with a defined, non-absolute symbol.
Optional< uint8_t > TagOffset
virtual const MCSymbol * getFunctionFrameSymbol() const
Return symbol for the function pseudo stack if the stack frame is not a register based.
void addDIEEntry(DIE &Die, dwarf::Attribute Attribute, DIE &Entry)
Add a DIE attribute data and value.
iterator insert(iterator I, T &&Elt)
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
void createBaseTypeDIEs()
DIE * getOrCreateContextDIE(const DIScope *Context)
Get context owner's DIE.
dwarf::Tag getTag() const
Translate tag to proper Dwarf tag.
DIE * getOrCreateGlobalVariableDIE(const DIGlobalVariable *GV, ArrayRef< GlobalExpr > GlobalExprs)
Get or create global variable DIE.
DIE & createAndAddDIE(unsigned Tag, DIE &Parent, const DINode *N=nullptr)
Create a DIE with the given Tag, add the DIE to its parent, and call insertDIE if MD is not null...
LLVM_NODISCARD bool empty() const
bool useRangesSection() const
Returns whether ranges section should be emitted.
void addVariableAddress(const DbgVariable &DV, DIE &Die, MachineLocation Location)
Add DW_AT_location attribute for a DbgVariable based on provided MachineLocation. ...
DIGlobalVariable * getDecl() const
void addGlobalType(const DIType *Ty, const DIE &Die, const DIScope *Context) override
Add a new global type to the compile unit.
virtual const TargetFrameLowering * getFrameLowering() const
void applyVariableAttributes(const DbgVariable &Var, DIE &VariableDie)
Optional< StringRef > getSource() const
element_iterator elements_begin() const
DIE * getOrCreateModule(const DIModule *M)
static SmallVector< DbgVariable *, 8 > sortLocalVars(SmallVectorImpl< DbgVariable *> &Input)
Sort local variables so that variables appearing inside of helper expressions come first...
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
void addBaseTypeRef(DIEValueList &Die, int64_t Idx)
bool includeMinimalInlineScopes() const
size_type count(const_arg_type_t< ValueT > V) const
Return 1 if the specified key is in the set, 0 otherwise.
const DICompileUnit * CUNode
MDNode for the compile unit.
const LLVMTargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
DwarfExpression implementation for singular DW_AT_location.
uint16_t getDwarfVersion() const
void addFragmentOffset(const DIExpression *Expr)
If applicable, emit an empty DW_OP_piece / DW_OP_bit_piece to advance to the fragment described by Ex...
MCSymbol * getLabelBeforeInsn(const MachineInstr *MI)
Return Label preceding the instruction.
BumpPtrAllocator DIEValueAllocator
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Optional< uint8_t > getDebugLocListTagOffset() const
DINode * getEntity() const
uint32_t getAlignInBytes() const
void addLocalLabelAddress(DIE &Die, dwarf::Attribute Attribute, const MCSymbol *Label)
addLocalLabelAddress - Add a dwarf label attribute data and value using DW_FORM_addr only...
uint16_t getDwarfVersion() const
Returns the Dwarf Version.
DIE & updateSubprogramScopeDIE(const DISubprogram *SP)
Find DIE for the given subprogram and attach appropriate DW_AT_low_pc and DW_AT_high_pc attributes...
void constructScopeDIE(LexicalScope *Scope, SmallVectorImpl< DIE *> &FinalChildren)
void addUInt(DIEValueList &Die, dwarf::Attribute Attribute, Optional< dwarf::Form > Form, uint64_t Integer)
Add an unsigned integer attribute data and value.
const DataLayout & getDataLayout() const
Return information about data layout.
bool isThreadLocal() const
If the value is "Thread Local", its value isn't shared by the threads.
const DINode * getEntity() const
Accessors.
bool isNVPTX() const
Tests whether the target is NVPTX (32- or 64-bit).
unsigned getLineNo() const
StringRef - Represent a constant reference to a string, i.e.
const DbgValueLoc * getValueLoc() const
MCSection * getDwarfRangesSection() const
void addLocationAttribute(DIE *ToDIE, const DIGlobalVariable *GV, ArrayRef< GlobalExpr > GlobalExprs)
virtual const MCExpr * getDebugThreadLocalSymbol(const MCSymbol *Sym) const
Create a symbol reference to describe the given TLS variable when emitting the address in debug info...
static void emitDebugLocValue(const AsmPrinter &AP, const DIBasicType *BT, const DbgValueLoc &Value, DwarfExpression &DwarfExpr)
void applyStmtList(DIE &D)
Apply the DW_AT_stmt_list from this compile unit to the specified DIE.
MCSymbol * createTempSymbol(const Twine &Name) const
bool addMachineRegExpression(const TargetRegisterInfo &TRI, DIExpressionCursor &Expr, unsigned MachineReg, unsigned FragmentOffsetInBits=0)
Emit a machine register location.
bool isArtificial() const
Return true if DbgVariable is artificial.
value_iterator addValue(BumpPtrAllocator &Alloc, const DIEValue &V)
std::pair< const MachineInstr *, const MachineInstr * > InsnRange
InsnRange - This is used to track range of instructions with identical lexical scope.
Wrapper class representing virtual and physical registers.
static const DIExpression * extractAddressClass(const DIExpression *Expr, unsigned &AddrClass)
Checks if the last 4 elements of the expression are DW_OP_constu <DWARF address="" space>=""> DW_OP_s...
DIE * constructLexicalScopeDIE(LexicalScope *Scope)
Construct new DW_TAG_lexical_block for this scope and attach DW_AT_low_pc/DW_AT_high_pc labels...
unsigned getIndex(const MCSymbol *Sym, bool TLS=false)
Returns the index into the address pool with the given label/symbol.