40 #define DEBUG_TYPE "dwarfdebug"
44 cl::desc(
"Generate DWARF4 type units."),
50 AP.getDwarfDebug()->getDwarfVersion()),
51 AP(AP), DU(DU), DIE(DIE) {}
69 : UniqueID(UID), CUNode(Node),
70 UnitDie(*
DIE::get(DIEValueAllocator, UnitTag)), DebugInfoOffset(0),
71 Asm(A), DD(DW), DU(DWU), IndexTyDie(nullptr),
Section(nullptr) {
72 assert(UnitTag == dwarf::DW_TAG_compile_unit ||
73 UnitTag == dwarf::DW_TAG_type_unit);
79 :
DwarfUnit(UID, dwarf::DW_TAG_type_unit, CU.getCUNode(), A, DW, DWU),
80 CU(CU), SplitLineTable(SplitLineTable) {
86 for (
unsigned j = 0, M =
DIEBlocks.size(); j < M; ++j)
88 for (
unsigned j = 0, M =
DIELocs.size(); j < M; ++j)
92 int64_t DwarfUnit::getDefaultLowerBound()
const {
97 case dwarf::DW_LANG_C89:
98 case dwarf::DW_LANG_C99:
99 case dwarf::DW_LANG_C:
100 case dwarf::DW_LANG_C_plus_plus:
101 case dwarf::DW_LANG_ObjC:
102 case dwarf::DW_LANG_ObjC_plus_plus:
105 case dwarf::DW_LANG_Fortran77:
106 case dwarf::DW_LANG_Fortran90:
107 case dwarf::DW_LANG_Fortran95:
111 case dwarf::DW_LANG_Java:
112 case dwarf::DW_LANG_Python:
113 case dwarf::DW_LANG_UPC:
114 case dwarf::DW_LANG_D:
119 case dwarf::DW_LANG_Ada83:
120 case dwarf::DW_LANG_Ada95:
121 case dwarf::DW_LANG_Cobol74:
122 case dwarf::DW_LANG_Cobol85:
123 case dwarf::DW_LANG_Modula2:
124 case dwarf::DW_LANG_Pascal83:
125 case dwarf::DW_LANG_PLI:
131 case dwarf::DW_LANG_OpenCL:
132 case dwarf::DW_LANG_Go:
133 case dwarf::DW_LANG_Haskell:
134 case dwarf::DW_LANG_C_plus_plus_03:
135 case dwarf::DW_LANG_C_plus_plus_11:
136 case dwarf::DW_LANG_OCaml:
137 case dwarf::DW_LANG_Rust:
138 case dwarf::DW_LANG_C11:
139 case dwarf::DW_LANG_Swift:
140 case dwarf::DW_LANG_Dylan:
141 case dwarf::DW_LANG_C_plus_plus_14:
146 case dwarf::DW_LANG_Modula3:
147 case dwarf::DW_LANG_Julia:
148 case dwarf::DW_LANG_Fortran03:
149 case dwarf::DW_LANG_Fortran08:
167 return (isa<DIType>(D) ||
168 (isa<DISubprogram>(D) && !cast<DISubprogram>(D)->isDefinition())) &&
244 return SplitLineTable ? SplitLineTable->
getFile(DirName, FileName)
295 assert(Tag != dwarf::DW_TAG_auto_variable &&
296 Tag != dwarf::DW_TAG_arg_variable);
323 assert(FileID &&
"Invalid file id");
364 unsigned SizeInBits,
unsigned OffsetInBits) {
436 bool isPointer =
false;
440 if (Tag == dwarf::DW_TAG_pointer_type) {
441 auto *DTy = cast<DIDerivedType>(Ty);
442 TmpTy =
resolve(DTy->getBaseType());
448 DINodeArray Fields = cast<DICompositeTypeBase>(TmpTy)->getElements();
452 for (
unsigned i = 0,
N = Fields.size(); i <
N; ++i) {
453 auto *DT = cast<DIDerivedType>(Fields[i]);
455 if (fieldName ==
"__forwarding")
456 forwardingField = DT;
457 else if (fieldName == varName)
462 unsigned forwardingFieldOffset = forwardingField->
getOffsetInBits() >> 3;
470 if (Location.
isReg())
486 if (forwardingFieldOffset > 0) {
498 if (varFieldOffset > 0) {
509 if (
auto *DTy = dyn_cast<DIDerivedTypeBase>(Ty)) {
518 if (T == dwarf::DW_TAG_array_type ||
519 T == dwarf::DW_TAG_class_type ||
520 T == dwarf::DW_TAG_pointer_type ||
521 T == dwarf::DW_TAG_ptr_to_member_type ||
522 T == dwarf::DW_TAG_reference_type ||
523 T == dwarf::DW_TAG_rvalue_reference_type ||
524 T == dwarf::DW_TAG_structure_type ||
525 T == dwarf::DW_TAG_union_type)
527 assert(T == dwarf::DW_TAG_typedef || T == dwarf::DW_TAG_const_type ||
528 T == dwarf::DW_TAG_volatile_type ||
529 T == dwarf::DW_TAG_restrict_type ||
530 T == dwarf::DW_TAG_enumeration_type);
531 if (
DITypeRef Deriv = DTy->getBaseType())
535 assert(DTy->getTag() == dwarf::DW_TAG_enumeration_type);
539 auto *BTy = cast<DIBasicType>(Ty);
540 unsigned Encoding = BTy->getEncoding();
541 assert((Encoding == dwarf::DW_ATE_unsigned ||
542 Encoding == dwarf::DW_ATE_unsigned_char ||
543 Encoding == dwarf::DW_ATE_signed ||
544 Encoding == dwarf::DW_ATE_signed_char ||
545 Encoding == dwarf::DW_ATE_float || Encoding == dwarf::DW_ATE_UTF ||
546 Encoding == dwarf::DW_ATE_boolean ||
547 (Ty->
getTag() == dwarf::DW_TAG_unspecified_type &&
548 Ty->
getName() ==
"decltype(nullptr)")) &&
549 "Unsupported encoding");
550 return Encoding == dwarf::DW_ATE_unsigned ||
551 Encoding == dwarf::DW_ATE_unsigned_char ||
552 Encoding == dwarf::DW_ATE_UTF || Encoding == dwarf::DW_ATE_boolean ||
553 Ty->
getTag() == dwarf::DW_TAG_unspecified_type;
560 if (Tag != dwarf::DW_TAG_member && Tag != dwarf::DW_TAG_typedef &&
561 Tag != dwarf::DW_TAG_const_type && Tag != dwarf::DW_TAG_volatile_type &&
562 Tag != dwarf::DW_TAG_restrict_type)
567 assert(BaseType &&
"Unexpected invalid base type");
572 if (BaseType->getTag() == dwarf::DW_TAG_reference_type ||
573 BaseType->getTag() == dwarf::DW_TAG_rvalue_reference_type)
576 if (
auto *DT = dyn_cast<DIDerivedType>(BaseType))
579 return BaseType->getSizeInBits();
583 assert(MO.
isFPImm() &&
"Invalid machine operand!");
589 const char *FltPtr = (
const char *)FltVal.
getRawData();
593 int Incr = (LittleEndian ? 1 : -1);
594 int Start = (LittleEndian ? 0 : NumBytes - 1);
595 int Stop = (LittleEndian ? NumBytes : -1);
598 for (; Start != Stop; Start += Incr)
616 assert(MO.
isImm() &&
"Invalid machine operand!");
634 if (CIBitWidth <= 64) {
649 for (
int i = 0; i < NumBytes; i++) {
652 c = Ptr64[i / 8] >> (8 * (i & 7));
654 c = Ptr64[(NumBytes - 1 - i) / 8] >> (8 * ((NumBytes - 1 - i) & 7));
662 if (!LinkageName.
empty())
671 for (
const auto *Element : TParams) {
672 if (
auto *TTP = dyn_cast<DITemplateTypeParameter>(Element))
673 constructTemplateTypeParameterDIE(Buffer, TTP);
674 else if (
auto *TVP = dyn_cast<DITemplateValueParameter>(Element))
675 constructTemplateValueParameterDIE(Buffer, TVP);
680 if (!Context || isa<DIFile>(Context))
682 if (
auto *
T = dyn_cast<DIType>(Context))
684 if (
auto *NS = dyn_cast<DINamespace>(Context))
686 if (
auto *
SP = dyn_cast<DISubprogram>(Context))
703 updateAcceleratorTables(Context, Ty, TyDIE);
711 auto *Ty = cast<DIType>(TyNode);
712 assert(Ty ==
resolve(Ty->getRef()) &&
713 "type was not uniqued, possible ODR violation.");
721 auto *Context =
resolve(Ty->getScope());
731 updateAcceleratorTables(Context, Ty, TyDIE);
733 if (
auto *
BT = dyn_cast<DIBasicType>(Ty))
735 else if (
auto *STy = dyn_cast<DISubroutineType>(Ty))
737 else if (
auto *CTy = dyn_cast<DICompositeType>(Ty)) {
739 if (
MDString *TypeId = CTy->getRawIdentifier()) {
752 void DwarfUnit::updateAcceleratorTables(
const DIScope *Context,
755 bool IsImplementation = 0;
756 if (
auto *CT = dyn_cast<DICompositeTypeBase>(Ty)) {
759 IsImplementation = CT->getRuntimeLang() == 0 || CT->isObjcClassComplete();
764 if (!Context || isa<DICompileUnit>(Context) || isa<DIFile>(Context) ||
765 isa<DINamespace>(Context))
772 assert(Ty &&
"Trying to add a type that doesn't exist?");
786 while (!isa<DICompileUnit>(Context)) {
798 for (
auto I = Parents.
rbegin(), E = Parents.
rend();
I != E; ++
I) {
801 if (Name.
empty() && isa<DINamespace>(Ctx))
802 Name =
"(anonymous namespace)";
819 if (BTy->
getTag() == dwarf::DW_TAG_unspecified_type)
845 if (Size && Tag != dwarf::DW_TAG_pointer_type
846 && Tag != dwarf::DW_TAG_ptr_to_member_type)
849 if (Tag == dwarf::DW_TAG_ptr_to_member_type)
859 for (
unsigned i = 1,
N = Args.
size(); i <
N; ++i) {
862 assert(i == N-1 &&
"Unspecified parameter must be the last argument");
875 auto Elements = cast<DISubroutineType>(CTy)->getTypeArray();
877 if (
auto RTy =
resolve(Elements[0]))
880 bool isPrototyped =
true;
881 if (Elements.size() == 2 && !Elements[1])
882 isPrototyped =
false;
890 (Language == dwarf::DW_LANG_C89 || Language == dwarf::DW_LANG_C99 ||
891 Language == dwarf::DW_LANG_ObjC))
906 uint16_t Tag = Buffer.
getTag();
909 case dwarf::DW_TAG_array_type:
910 constructArrayTypeDIE(Buffer, CTy);
912 case dwarf::DW_TAG_enumeration_type:
913 constructEnumTypeDIE(Buffer, CTy);
915 case dwarf::DW_TAG_structure_type:
916 case dwarf::DW_TAG_union_type:
917 case dwarf::DW_TAG_class_type: {
920 for (
const auto *Element : Elements) {
923 if (
auto *
SP = dyn_cast<DISubprogram>(Element))
925 else if (
auto *DDTy = dyn_cast<DIDerivedType>(Element)) {
926 if (DDTy->getTag() == dwarf::DW_TAG_friend) {
929 }
else if (DDTy->isStaticMember()) {
932 constructMemberDIE(Buffer, DDTy);
934 }
else if (
auto *Property = dyn_cast<DIObjCProperty>(Element)) {
936 StringRef PropertyName = Property->getName();
938 if (Property->getType())
941 StringRef GetterName = Property->getGetterName();
942 if (!GetterName.
empty())
944 StringRef SetterName = Property->getSetterName();
945 if (!SetterName.
empty())
947 if (
unsigned PropertyAttributes = Property->getAttributes())
958 if (
auto *ContainingType =
968 if (Tag == dwarf::DW_TAG_class_type ||
969 Tag == dwarf::DW_TAG_structure_type || Tag == dwarf::DW_TAG_union_type)
982 if (Tag == dwarf::DW_TAG_enumeration_type ||
983 Tag == dwarf::DW_TAG_class_type || Tag == dwarf::DW_TAG_structure_type ||
984 Tag == dwarf::DW_TAG_union_type) {
1009 void DwarfUnit::constructTemplateTypeParameterDIE(
1020 void DwarfUnit::constructTemplateValueParameterDIE(
1026 if (VP->
getTag() == dwarf::DW_TAG_template_value_parameter)
1031 if (
ConstantInt *CI = mdconst::dyn_extract<ConstantInt>(Val))
1033 else if (
GlobalValue *GV = mdconst::dyn_extract<GlobalValue>(Val)) {
1042 }
else if (VP->
getTag() == dwarf::DW_TAG_GNU_template_template_param) {
1043 assert(isa<MDString>(Val));
1046 }
else if (VP->
getTag() == dwarf::DW_TAG_GNU_template_parameter_pack) {
1065 Name =
"(anonymous namespace)";
1106 if (
auto *SPDecl = SP->getDeclaration()) {
1120 if (SP->isDefinition())
1129 DIE *DeclDie =
nullptr;
1131 if (
auto *SPDecl = SP->getDeclaration()) {
1132 DeclDie =
getDIE(SPDecl);
1133 assert(DeclDie &&
"This DIE should've already been constructed when the "
1134 "definition DIE was created in "
1135 "getOrCreateSubprogramDIE");
1136 DeclLinkageName = SPDecl->getLinkageName();
1144 assert(((LinkageName.empty() || DeclLinkageName.
empty()) ||
1145 LinkageName == DeclLinkageName) &&
1146 "decl has a linkage name and it is different");
1147 if (DeclLinkageName.
empty())
1178 if (SP->isPrototyped() &&
1179 (Language == dwarf::DW_LANG_C89 || Language == dwarf::DW_LANG_C99 ||
1180 Language == dwarf::DW_LANG_ObjC))
1184 assert(SPTy->
getTag() == dwarf::DW_TAG_subroutine_type &&
1185 "the type of a subprogram should be a subroutine");
1191 if (
auto Ty =
resolve(Args[0]))
1194 unsigned VK = SP->getVirtuality();
1202 std::make_pair(&SPDie,
resolve(SP->getContainingType())));
1205 if (!SP->isDefinition()) {
1213 if (SP->isArtificial())
1216 if (!SP->isLocalToUnit())
1219 if (SP->isOptimized())
1225 if (SP->isLValueReference())
1228 if (SP->isRValueReference())
1231 if (SP->isProtected())
1234 else if (SP->isPrivate())
1237 else if (SP->isPublic())
1241 if (SP->isExplicit())
1245 void DwarfUnit::constructSubrangeDIE(
DIE &Buffer,
const DISubrange *SR,
1255 int64_t DefaultLowerBound = getDefaultLowerBound();
1258 if (DefaultLowerBound == -1 || LowerBound != DefaultLowerBound)
1267 DIE *DwarfUnit::getIndexTyDie() {
1275 dwarf::DW_ATE_unsigned);
1289 DIE *IdxTy = getIndexTyDie();
1293 for (
unsigned i = 0,
N = Elements.size(); i <
N; ++i) {
1295 if (
auto *Element = dyn_cast_or_null<DINode>(Elements[i]))
1296 if (Element->getTag() == dwarf::DW_TAG_subrange_type)
1297 constructSubrangeDIE(Buffer, cast<DISubrange>(Element), IdxTy);
1305 for (
unsigned i = 0, N = Elements.size(); i <
N; ++i) {
1306 auto *
Enum = dyn_cast_or_null<DIEnumerator>(Elements[i]);
1326 DIE &SPDie = *CI->first;
1327 const DINode *D = CI->second;
1366 uint64_t OffsetInBytes;
1368 if (FieldSize && Size != FieldSize) {
1396 uint64_t AlignMask = ~(Align - 1);
1398 uint64_t StartBitOffset = Offset - (Offset & AlignMask);
1405 OffsetInBytes = (Offset - StartBitOffset) / 8;
1433 dwarf::DW_VIRTUALITY_virtual);
1436 if (
DINode *PNode = DT->getObjCProperty())
1453 "Static member should belong to a type.");
1456 return StaticMemberDIE;
1480 if (
const ConstantInt *CI = dyn_cast_or_null<ConstantInt>(DT->getConstant()))
1482 if (
const ConstantFP *CFP = dyn_cast_or_null<ConstantFP>(DT->getConstant()))
1485 return &StaticMemberDIE;
1509 assert(!this->Section);
1516 Asm->
OutStreamer->EmitIntValue(TypeSignature,
sizeof(TypeSignature));
1520 sizeof(Ty->getOffset()));
1523 bool DwarfTypeUnit::isDwoUnit()
const {
StringRef getName() const
Instances of this class represent a uniqued identifier for a section in the current translation unit...
void push_back(const T &Elt)
static bool isUnsignedDIType(DwarfDebug *DD, const DIType *Ty)
Return true if type encoding is unsigned.
void addFlag(DIE &Die, dwarf::Attribute Attribute)
Add a flag that is true to the DIE.
StringRef getName() const
MCSection * Section
The section this unit will be emitted in.
bool isArtificial() const
uint64_t getZExtValue() const
Get zero extended value.
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.
MCSymbol * getSymbol(const GlobalValue *GV) const
std::vector< DIELoc * > DIELocs
A list of all the DIELocs in use.
DIELoc - Represents an expression location.
DITypeRef getType() const
DIE * getOrCreateStaticMemberDIE(const DIDerivedType *DT)
Create new static data member DIE.
const ConstantFP * getFPImm() const
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
const DataLayout & getDataLayout() const
Return information about data layout.
void EmitInt8(int Value) const
Emit a byte directive and value.
static bool isShareableAcrossCUs(const DINode *D)
Check whether the DIE for this MDNode can be shared across CUs.
DILocalScope * getScope() const
Get the local scope for this variable.
bool isRValueReference() const
virtual void addGlobalType(const DIType *Ty, const DIE &Die, const DIScope *Context)
Add a new global type to the compile unit.
void insertDIE(const DINode *Desc, DIE *D)
Insert DIE into the map.
uint64_t getAlignInBits() const
Collects and handles dwarf debug information.
const MachineFunction * MF
The current machine function.
Base class containing the logic for constructing DWARF expressions independently of whether they are ...
StringRef getDirectory() const
void EmitSigned(int64_t Value) override
Emit a raw signed value.
dwarf::Form BestForm(unsigned DwarfVersion) const
BestForm - Choose the best form for data.
StringRef getName() const
void EmitInt32(int Value) const
Emit a long directive and value.
DINodeArray getElements() const
Get the elements of the composite type.
StringRef getName() const
void initSection(MCSection *Section)
void addType(DIE &Entity, const DIType *Ty, dwarf::Attribute Attribute=dwarf::DW_AT_type)
Add a new type attribute to the specified entity.
virtual DwarfCompileUnit & getCU()=0
AsmPrinter * Asm
Target of Dwarf emission.
Tagged DWARF-like metadata node.
DIE * getOrCreateTypeDIE(const MDNode *N)
Find existing DIE or create new DIE for the given type.
void addAccelNamespace(StringRef Name, const DIE &Die)
void constructTypeDIE(DIE &Buffer, const DICompositeType *CTy)
virtual void addGlobalName(StringRef Name, DIE &Die, const DIScope *Context)
Add a new global name to the compile unit.
void addBlock(DIE &Die, dwarf::Attribute Attribute, DIELoc *Block)
Add block data.
virtual void emitHeader(bool UseOffsets)
Emit the header for this unit, not including the initial length field.
DIScope * getScope() const
StringRef getName() const
A signature reference to a type unit.
const APInt & getValue() const
Return the constant as an APInt value reference.
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
void addSInt(DIE &Die, dwarf::Attribute Attribute, Optional< dwarf::Form > Form, int64_t Integer)
Add an signed integer attribute data and value.
virtual unsigned getOrCreateSourceID(StringRef File, StringRef Directory)=0
Look up the source ID with the given directory and source file names.
T * resolve(TypedDINodeRef< T > Ref) const
Look in the DwarfDebug map for the MDNode that corresponds to the reference.
static cl::opt< bool > GenerateDwarfTypeUnits("generate-type-units", cl::Hidden, cl::desc("Generate DWARF4 type units."), cl::init(false))
void addConstantFPValue(DIE &Die, const MachineOperand &MO)
Add constant value entry in variable DIE.
Reg
All possible values of the reg field in the ModR/M byte.
value_iterator addValue(BumpPtrAllocator &Alloc, DIEValue Value)
addValue - Add a value and attributes to a DIE.
bool addRegisterOffset(DIELoc &TheDie, unsigned Reg, int64_t Offset)
Add register offset.
void EmitOp(uint8_t Op, const char *Comment=nullptr) override
Output a dwarf operand and an optional assembler comment.
StringRef getFilename() const
bool isAppleBlockExtension() const
void constructContainingTypeDIEs()
Construct DIEs for types that contain vtables.
Pointer union between a subclass of DINode and MDString.
virtual unsigned getFrameRegister(const MachineFunction &MF) const =0
Debug information queries.
DITypeRefArray getTypeArray() const
DenseMap< DIE *, const DINode * > ContainingTypeMap
This map is used to keep track of subprogram DIEs that need DW_AT_containing_type attribute...
void addString(DIE &Die, dwarf::Attribute Attribute, StringRef Str)
Add a string attribute data and value.
AddressPool & getAddressPool()
DITemplateParameterArray getTemplateParams() const
This class is used to track local variable information.
void emitDwarfSymbolReference(const MCSymbol *Label, bool ForceOffset=false) const
Emit a reference to a symbol for use in dwarf.
void EmitInt16(int Value) const
Emit a short directive and value.
DwarfCompileUnit & getCU() override
bool isLittleEndian() const
Layout endianness...
DIScopeRef getScope() const
virtual unsigned getHeaderSize() const
Compute the size of a header for this unit, not including the initial length field.
DITypeRef getVTableHolder() const
StringRef getConfigurationMacros() const
DIE * getOrCreateNameSpace(const DINamespace *NS)
bool addRegisterOpPiece(DIELoc &TheDie, unsigned Reg, unsigned SizeInBits=0, unsigned OffsetInBits=0)
Add register operand.
DIE & addChild(DIE *Child)
Add a child to the DIE.
dwarf::Tag getTag() const
DIScopeRef getScope() const
StringRef getDirectory() const
void addConstantValue(DIE &Die, const MachineOperand &MO, const DIType *Ty)
Add constant value entry in variable DIE.
static DIE * get(BumpPtrAllocator &Alloc, dwarf::Tag Tag)
bool useSplitDwarf() const
Returns whether or not to change the current debug info for the split dwarf proposal support...
A self-contained host- and target-independent arbitrary-precision floating-point software implementat...
StringRef getIncludePath() const
This dwarf writer support class manages information associated with a source file.
DIEDwarfExpression(const AsmPrinter &AP, DwarfUnit &DU, DIELoc &DIE)
DwarfStringPool & getStringPool()
Returns the string pool.
initializer< Ty > init(const Ty &Val)
unsigned getFile(StringRef Directory, StringRef FileName)
const DIType * getType() const
bool applySubprogramDefinitionAttributes(const DISubprogram *SP, DIE &SPDie)
StringRef getName() const
The instances of the Type class are immutable: once they are created, they are never changed...
void EmitUnsigned(uint64_t Value) override
Emit a raw unsigned value.
void addSourceLine(DIE &Die, unsigned Line, StringRef File, StringRef Directory)
Add location information to specified debug information entry.
const DIE * getUnitOrNull() const
Similar to getUnit, returns null when DIE is not added to an owner yet.
int64_t getSExtValue() const
Get sign extended value.
This file contains the declarations for the subclasses of Constant, which represent the different fla...
DIE - A structured debug information entry.
DIELoc * getDIELoc()
Returns a fresh newly allocated DIELoc.
ConstantFP - Floating Point Values [float, double].
static dwarf::Form BestForm(bool IsSigned, uint64_t Int)
BestForm - Choose the best form for integer.
This class is intended to be used as a driving class for all asm writers.
void addDwarfTypeUnitType(DwarfCompileUnit &CU, StringRef Identifier, DIE &Die, const DICompositeType *CTy)
Add a DIE to the set of types that we're going to pull into type units.
This file declares a class to represent arbitrary precision floating point values and provide a varie...
DenseMap< const MDNode *, DIE * > MDNodeToDieMap
Tracks the mapping of unit level debug information variables to debug information entries...
DIScope * getScope() const
T * resolve(TypedDINodeRef< T > Ref) const
Find the MDNode for the given reference.
unsigned getBitWidth() const
Return the number of bits in the APInt.
void addAccelType(StringRef Name, const DIE &Die, char Flags)
DIE * getOrCreateSubprogramDIE(const DISubprogram *SP, bool Minimal=false)
Metadata * getValue() const
LLVM_ATTRIBUTE_UNUSED_RESULT bool isa(const Y &Val)
unsigned getEncoding() const
uint64_t getOffsetInBits() const
DITypeRef getBaseType() const
bool isLValueReference() const
DIEString - A container for string values.
static uint64_t getBaseTypeSize(DwarfDebug *DD, const DIDerivedType *Ty)
If this type is derived from a base type then return base type size.
DIE * IndexTyDie
An anonymous type for index type. Owned by UnitDie.
DIE * getDIE(const DINode *D) const
Returns the DIE map slot for the specified debug variable.
Base class for scope-like contexts.
DIEDelta - A simple label difference DIE.
void insertDIE(const MDNode *TypeMD, DIE *Die)
StringRef getDirectory() const
StringRef getFilename() const
StringRef getISysRoot() const
unsigned getOrCreateSourceID(StringRef FileName, StringRef DirName) override
Look up the source ID with the given directory and source file names.
bool AddMachineRegIndirect(unsigned MachineReg, int Offset=0)
Emit an indirect dwarf register operation for the given machine register.
This is the shared class of boolean and integer constants.
uint16_t getLanguage() const
MachineOperand class - Representation of each machine instruction operand.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
void addLinkageName(DIE &Die, StringRef LinkageName)
Add a linkage name, if it isn't empty.
MCSymbol * getBeginSymbol()
static cl::opt< AlignMode > Align(cl::desc("Load/store alignment support"), cl::Hidden, cl::init(NoStrictAlign), cl::values(clEnumValN(StrictAlign,"aarch64-strict-align","Disallow all unaligned memory accesses"), clEnumValN(NoStrictAlign,"aarch64-no-strict-align","Allow unaligned memory accesses"), clEnumValEnd))
void addTemplateParams(DIE &Buffer, DINodeArray TParams)
Add template parameters in buffer.
StringRef getFilename() const
bool isFPImm() const
isFPImm - Tests if this is a MO_FPImmediate operand.
Class for arbitrary precision integers.
A (clang) module that has been imported by the compile unit.
bool isForwardDecl() const
APInt bitcastToAPInt() const
std::string getParentContextString(const DIScope *Context) const
Get string containing language specific context for a global name.
void addDIEEntry(DIE &Die, dwarf::Attribute Attribute, DIE &Entry)
Add a DIE attribute data and value.
DIE::value_iterator addLabel(DIE &Die, dwarf::Attribute Attribute, dwarf::Form Form, const MCSymbol *Label)
Add a Dwarf label attribute data and value.
DIE * getOrCreateContextDIE(const DIScope *Context)
Get context owner's DIE.
Type array for a subprogram.
unsigned getRuntimeLang() const
DIEInteger - An integer value DIE.
static StringRef getRealLinkageName(StringRef Name)
If special LLVM prefix that is used to inform the asm printer to not emit usual symbol prefix before ...
dwarf::Form BestForm() const
BestForm - Choose the best form for data.
EntryRef getEntry(AsmPrinter &Asm, StringRef Str)
Get a reference to an entry in the string pool.
const uint64_t * getRawData() const
This function returns a pointer to the internal storage of the APInt.
DwarfTypeUnit(unsigned UID, DwarfCompileUnit &CU, AsmPrinter *A, DwarfDebug *DW, DwarfFile *DWU, MCDwarfDwoLineTable *SplitLineTable=nullptr)
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...
DwarfUnit(unsigned UID, dwarf::Tag, const DICompileUnit *CU, AsmPrinter *A, DwarfDebug *DW, DwarfFile *DWU)
DIE * getDIE(const MDNode *TypeMD)
void emitHeader(bool UseOffsets) override
Emit the header for this unit, not including the initial length field.
DIE * getOrCreateModule(const DIModule *M)
uint64_t getSizeInBits() const
void addBlockByrefAddress(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...
DIE * createTypeDIE(const DICompositeType *Ty)
Get context owner's DIE.
virtual unsigned getISAEncoding()
Get the value for DW_AT_APPLE_isa. Zero if no isa encoding specified.
void addSectionOffset(DIE &Die, dwarf::Attribute Attribute, uint64_t Integer)
Add an offset into a section attribute data and value.
DwarfExpression implementation for singular DW_AT_location.
bool isObjcClassComplete() const
const APFloat & getValueAPF() const
bool isFrameRegister(unsigned MachineReg) override
Return whether the given machine register is the frame register in the current function.
const TargetLoweringObjectFile & getObjFileLowering() const
Return information about object file lowering.
reverse_iterator rbegin()
BumpPtrAllocator DIEValueAllocator
void addDIETypeSignature(DIE &Die, const DwarfTypeUnit &Type)
unsigned ComputeSize(const AsmPrinter *AP) const
ComputeSize - Calculate the size of the location expression.
LLVM Value Representation.
DIE & UnitDie
Unit debug information entry.
uint64_t OffsetToAlignment(uint64_t Value, uint64_t Align)
Returns the offset to the next integer (mod 2**64) that is greater than or equal to Value and is a mu...
std::vector< DIEBlock * > DIEBlocks
A list of all the DIEBlocks in use.
unsigned ComputeSize(const AsmPrinter *AP) const
ComputeSize - Calculate the size of the location expression.
void addOpAddress(DIELoc &Die, const MCSymbol *Label)
Add a dwarf op address data and value using the form given and an op of either DW_FORM_addr or DW_FOR...
StringRef - Represent a constant reference to a string, i.e.
int64_t getLowerBound() const
DIEBlock - Represents a block of values.
MCSection * getDwarfAbbrevSection() const
unsigned getPointerSize(unsigned AS=0) const
Layout pointer size FIXME: The defaults need to be removed once all of the backends/clients are updat...
void applySubprogramAttributes(const DISubprogram *SP, DIE &SPDie, bool Minimal=false)
void constructSubprogramArguments(DIE &Buffer, DITypeRefArray Args)
Construct function argument DIEs.
unsigned getDwarfVersion() const
Returns the Dwarf Version.
void addUInt(DIE &Die, dwarf::Attribute Attribute, Optional< dwarf::Form > Form, uint64_t Integer)
Add an unsigned integer attribute data and value.
const TargetRegisterInfo & TRI
bool AddMachineRegPiece(unsigned MachineReg, unsigned PieceSizeInBits=0, unsigned PieceOffsetInBits=0)
Emit a partial DWARF register operation.
bool empty() const
empty - Check if the string is empty.
Basic type, like 'int' or 'float'.
unsigned getIndex(const MCSymbol *Sym, bool TLS=false)
Returns the index into the address pool with the given label/symbol.