14 #define DEBUG_TYPE "dwarfdebug"
38 : UniqueID(UID), Node(Node), CUDie(D),
Asm(A),
DD(DW), DU(DWU),
39 IndexTyDie(0), DebugInfoOffset(0) {
40 DIEIntegerOne =
new (DIEValueAllocator)
DIEInteger(1);
46 for (
unsigned j = 0, M = DIEBlocks.size(); j < M; ++j)
59 int64_t CompileUnit::getDefaultLowerBound()
const {
82 if (dwarf::DWARF_VERSION >= 4)
93 if (dwarf::DWARF_VERSION >= 4)
116 return MDNodeToDieMap.lookup(D);
127 MDNodeToDieMap.insert(std::make_pair(Desc, D));
133 Die->
addValue(Attribute, dwarf::DW_FORM_flag_present, DIEIntegerOne);
135 Die->
addValue(Attribute, dwarf::DW_FORM_flag, DIEIntegerOne);
144 DIEValue *Value = Integer == 1 ? DIEIntegerOne :
new (DIEValueAllocator)
146 Die->
addValue(Attribute, *Form, Value);
150 addUInt(Block, (dwarf::Attribute)0, Form, Integer);
160 Die->
addValue(Attribute, *Form, Value);
165 addSInt(Die, (dwarf::Attribute)0, Form, Integer);
180 Value =
new (DIEValueAllocator)
DIELabel(Symb);
183 Value =
new (DIEValueAllocator)
DIEDelta(Symb, StringPool);
185 Form = dwarf::DW_FORM_strp;
188 Value =
new (DIEValueAllocator)
DIEInteger(idx);
189 Form = dwarf::DW_FORM_GNU_str_index;
192 Die->
addValue(Attribute, Form, Str);
202 Value =
new (DIEValueAllocator)
DIELabel(Symb);
205 Value =
new (DIEValueAllocator)
DIEDelta(Symb, StringPool);
207 Die->
addValue(Attribute, dwarf::DW_FORM_strp, Value);
214 Die->
addValue((dwarf::Attribute)0, Form, Value);
220 dwarf::Form Form,
const MCSymbol *Label) {
222 Die->
addValue(Attribute, Form, Value);
227 addLabel(Die, (dwarf::Attribute)0, Form, Label);
241 Die->
addValue(Attribute, dwarf::DW_FORM_addr, Value);
244 Die->
addValue(Attribute, dwarf::DW_FORM_addr, Value);
249 Die->
addValue(Attribute, dwarf::DW_FORM_GNU_addr_index, Value);
260 addLabel(Die, dwarf::DW_FORM_udata, Sym);
273 Die->
addValue(Attribute, Form, Value);
280 addDIEEntry(Die, Attribute, createDIEEntry(Entry));
292 Die->
addValue(Attribute, EntryCU == DieCU ? dwarf::DW_FORM_ref4
293 : dwarf::DW_FORM_ref_addr,
312 DIEBlocks.push_back(Block);
329 assert(FileID &&
"Invalid file id");
330 addUInt(Die, dwarf::DW_AT_decl_file,
None, FileID);
346 assert(FileID &&
"Invalid file id");
347 addUInt(Die, dwarf::DW_AT_decl_file,
None, FileID);
365 assert(FileID &&
"Invalid file id");
366 addUInt(Die, dwarf::DW_AT_decl_file,
None, FileID);
382 assert(FileID &&
"Invalid file id");
383 addUInt(Die, dwarf::DW_AT_decl_file,
None, FileID);
400 assert(FileID &&
"Invalid file id");
401 addUInt(Die, dwarf::DW_AT_decl_file,
None, FileID);
419 assert(FileID &&
"Invalid file id");
420 addUInt(Die, dwarf::DW_AT_decl_file,
None, FileID);
433 addAddress(Die, dwarf::DW_AT_location, Location,
445 addUInt(TheDie, dwarf::DW_FORM_udata, DWReg);
462 addUInt(TheDie, dwarf::DW_FORM_udata, DWReg);
464 addSInt(TheDie, dwarf::DW_FORM_sdata, Offset);
473 if (Location.
isReg() && !Indirect)
477 if (Indirect && !Location.
isReg()) {
497 if (Location.
isReg()) {
514 if (!Location.
isReg())
589 uint16_t Tag = Ty.
getTag();
590 bool isPointer =
false;
594 if (Tag == dwarf::DW_TAG_pointer_type) {
611 if (fieldName ==
"__forwarding")
612 forwardingField = DT;
613 else if (fieldName == varName)
618 unsigned forwardingFieldOffset = forwardingField.
getOffsetInBits() >> 3;
625 if (Location.
isReg())
638 if (forwardingFieldOffset > 0) {
640 addUInt(Block, dwarf::DW_FORM_udata, forwardingFieldOffset);
650 if (varFieldOffset > 0) {
652 addUInt(Block, dwarf::DW_FORM_udata, varFieldOffset);
692 unsigned Tag = Ty.
getTag();
694 if (Tag != dwarf::DW_TAG_member && Tag != dwarf::DW_TAG_typedef &&
695 Tag != dwarf::DW_TAG_const_type && Tag != dwarf::DW_TAG_volatile_type &&
696 Tag != dwarf::DW_TAG_restrict_type)
708 if (BaseType.
getTag() == dwarf::DW_TAG_reference_type ||
709 BaseType.
getTag() == dwarf::DW_TAG_rvalue_reference_type)
724 assert(MO.
isImm() &&
"Invalid machine operand!");
726 bool SignedConstant =
isTypeSigned(DD, Ty, &SizeInBits);
730 if (SignedConstant) {
731 addSInt(Die, dwarf::DW_AT_const_value, dwarf::DW_FORM_sdata, MO.
getImm());
736 switch (SizeInBits) {
738 Form = dwarf::DW_FORM_data1;
741 Form = dwarf::DW_FORM_data2;
744 Form = dwarf::DW_FORM_data4;
747 Form = dwarf::DW_FORM_data8;
750 Form = dwarf::DW_FORM_udata;
759 assert(MO.
isFPImm() &&
"Invalid machine operand!");
765 const char *FltPtr = (
const char *)FltVal.
getRawData();
769 int Incr = (LittleEndian ? 1 : -1);
770 int Start = (LittleEndian ? 0 : NumBytes - 1);
771 int Stop = (LittleEndian ? NumBytes : -1);
774 for (; Start != Stop; Start += Incr)
775 addUInt(Block, dwarf::DW_FORM_data1, (
unsigned char)0xFF & FltPtr[Start]);
777 addBlock(Die, dwarf::DW_AT_const_value, Block);
795 if (CIBitWidth <= 64) {
798 addSInt(Die, dwarf::DW_AT_const_value, dwarf::DW_FORM_sdata,
805 switch (CIBitWidth) {
807 Form = dwarf::DW_FORM_data1;
810 Form = dwarf::DW_FORM_data2;
813 Form = dwarf::DW_FORM_data4;
816 Form = dwarf::DW_FORM_data8;
819 addUInt(Die, dwarf::DW_AT_const_value, dwarf::DW_FORM_udata,
836 for (
int i = 0; i < NumBytes; i++) {
839 c = Ptr64[i / 8] >> (8 * (i & 7));
841 c = Ptr64[(NumBytes - 1 - i) / 8] >> (8 * ((NumBytes - 1 - i) & 7));
842 addUInt(Block, dwarf::DW_FORM_data1, c);
845 addBlock(Die, dwarf::DW_AT_const_value, Block);
854 constructTemplateTypeParameterDIE(Buffer,
857 constructTemplateValueParameterDIE(Buffer,
864 if (!Context || Context.
isFile())
907 bool IsImplementation = 0;
923 assert(Ty &&
"Trying to add a type that doesn't exist?");
937 Entry = createDIEEntry(Buffer);
938 insertDIEEntry(Ty, Entry);
952 std::vector<DIE *> &DIEs = AccelNames[
Name];
958 std::vector<DIE *> &DIEs = AccelObjC[
Name];
964 std::vector<DIE *> &DIEs = AccelNamespace[
Name];
970 std::vector<std::pair<DIE *, unsigned> > &DIEs = AccelTypes[
Name];
977 GlobalNames[FullName] = Die;
987 if (
DIEEntry *Entry = getDIEEntry(Ty)) {
988 std::string FullName =
990 GlobalTypes[FullName] = Entry->getEntry();
1026 if (!Name.
empty()) {
1037 uint16_t SPTag = SPTy.
getTag();
1038 if (SPTag != dwarf::DW_TAG_subroutine_type)
1051 void CompileUnit::constructTypeDIE(
DIE &Buffer,
DIBasicType BTy) {
1056 addString(&Buffer, dwarf::DW_AT_name, Name);
1059 if (BTy.
getTag() == dwarf::DW_TAG_unspecified_type)
1062 addUInt(&Buffer, dwarf::DW_AT_encoding, dwarf::DW_FORM_data1,
1066 addUInt(&Buffer, dwarf::DW_AT_byte_size,
None, Size);
1074 uint16_t Tag = Buffer.
getTag();
1083 addString(&Buffer, dwarf::DW_AT_name, Name);
1086 if (Size && Tag != dwarf::DW_TAG_pointer_type)
1087 addUInt(&Buffer, dwarf::DW_AT_byte_size,
None, Size);
1089 if (Tag == dwarf::DW_TAG_ptr_to_member_type)
1090 addDIEEntry(&Buffer, dwarf::DW_AT_containing_type,
1112 uint16_t Tag = CTy.
getTag();
1115 case dwarf::DW_TAG_structure_type:
1116 case dwarf::DW_TAG_union_type:
1117 case dwarf::DW_TAG_enumeration_type:
1118 case dwarf::DW_TAG_class_type:
1134 uint16_t Tag = Buffer.
getTag();
1137 case dwarf::DW_TAG_array_type:
1138 constructArrayTypeDIE(Buffer, CTy);
1140 case dwarf::DW_TAG_enumeration_type:
1141 constructEnumTypeDIE(Buffer, CTy);
1143 case dwarf::DW_TAG_subroutine_type: {
1150 bool isPrototyped =
true;
1156 isPrototyped =
false;
1160 if (
DIType(Ty).isArtificial())
1161 addFlag(Arg, dwarf::DW_AT_artificial);
1170 addFlag(&Buffer, dwarf::DW_AT_prototyped);
1172 case dwarf::DW_TAG_structure_type:
1173 case dwarf::DW_TAG_union_type:
1174 case dwarf::DW_TAG_class_type: {
1179 DIE *ElemDie = NULL;
1183 if (SP.isProtected())
1184 addUInt(ElemDie, dwarf::DW_AT_accessibility, dwarf::DW_FORM_data1,
1186 else if (SP.isPrivate())
1187 addUInt(ElemDie, dwarf::DW_AT_accessibility, dwarf::DW_FORM_data1,
1190 addUInt(ElemDie, dwarf::DW_AT_accessibility, dwarf::DW_FORM_data1,
1192 if (SP.isExplicit())
1193 addFlag(ElemDie, dwarf::DW_AT_explicit);
1196 if (DDTy.getTag() == dwarf::DW_TAG_friend) {
1198 addType(ElemDie, resolve(DDTy.getTypeDerivedFrom()),
1199 dwarf::DW_AT_friend);
1200 }
else if (DDTy.isStaticMember()) {
1201 getOrCreateStaticMemberDIE(DDTy);
1203 constructMemberDIE(Buffer, DDTy);
1208 StringRef PropertyName = Property.getObjCPropertyName();
1209 addString(ElemDie, dwarf::DW_AT_APPLE_property_name, PropertyName);
1210 addType(ElemDie, Property.getType());
1212 StringRef GetterName = Property.getObjCPropertyGetterName();
1213 if (!GetterName.
empty())
1214 addString(ElemDie, dwarf::DW_AT_APPLE_property_getter, GetterName);
1215 StringRef SetterName = Property.getObjCPropertySetterName();
1216 if (!SetterName.
empty())
1217 addString(ElemDie, dwarf::DW_AT_APPLE_property_setter, SetterName);
1218 unsigned PropertyAttributes = 0;
1219 if (Property.isReadOnlyObjCProperty())
1221 if (Property.isReadWriteObjCProperty())
1223 if (Property.isAssignObjCProperty())
1225 if (Property.isRetainObjCProperty())
1227 if (Property.isCopyObjCProperty())
1229 if (Property.isNonAtomicObjCProperty())
1231 if (PropertyAttributes)
1232 addUInt(ElemDie, dwarf::DW_AT_APPLE_property_attribute,
None,
1233 PropertyAttributes);
1235 DIEEntry *Entry = getDIEEntry(Element);
1237 Entry = createDIEEntry(ElemDie);
1238 insertDIEEntry(Element, Entry);
1245 addFlag(&Buffer, dwarf::DW_AT_APPLE_block);
1249 addDIEEntry(&Buffer, dwarf::DW_AT_containing_type,
1253 addFlag(&Buffer, dwarf::DW_AT_APPLE_objc_complete_type);
1257 if (Tag == dwarf::DW_TAG_class_type ||
1258 Tag == dwarf::DW_TAG_structure_type || Tag == dwarf::DW_TAG_union_type)
1269 addString(&Buffer, dwarf::DW_AT_name, Name);
1271 if (Tag == dwarf::DW_TAG_enumeration_type ||
1272 Tag == dwarf::DW_TAG_class_type || Tag == dwarf::DW_TAG_structure_type ||
1273 Tag == dwarf::DW_TAG_union_type) {
1277 addUInt(&Buffer, dwarf::DW_AT_byte_size,
None, Size);
1280 addUInt(&Buffer, dwarf::DW_AT_byte_size,
None, 0);
1284 addFlag(&Buffer, dwarf::DW_AT_declaration);
1293 addUInt(&Buffer, dwarf::DW_AT_APPLE_runtime_class, dwarf::DW_FORM_data1,
1305 CompileUnit::constructTemplateTypeParameterDIE(
DIE &Buffer,
1319 CompileUnit::constructTemplateValueParameterDIE(
DIE &Buffer,
1325 if (VP.
getTag() == dwarf::DW_TAG_template_value_parameter)
1333 else if (
GlobalValue *GV = dyn_cast<GlobalValue>(Val)) {
1341 addBlock(ParamDIE, dwarf::DW_AT_location, Block);
1342 }
else if (VP.
getTag() == dwarf::DW_TAG_GNU_template_template_param) {
1343 assert(isa<MDString>(Val));
1344 addString(ParamDIE, dwarf::DW_AT_GNU_template_name,
1345 cast<MDString>(Val)->getString());
1346 }
else if (VP.
getTag() == dwarf::DW_TAG_GNU_template_parameter_pack) {
1347 assert(isa<MDNode>(Val));
1389 ContextDIE = CUDie.get();
1394 DIE *DeclDie = NULL;
1405 addDIEEntry(SPDie, dwarf::DW_AT_specification, DeclDie);
1412 if (!LinkageName.
empty())
1413 addString(SPDie, dwarf::DW_AT_MIPS_linkage_name,
1428 addFlag(SPDie, dwarf::DW_AT_prototyped);
1431 assert(SPTy.
getTag() == dwarf::DW_TAG_subroutine_type &&
1432 "the type of a subprogram should be a subroutine");
1437 if (Args.getElement(0))
1442 addUInt(SPDie, dwarf::DW_AT_virtuality, dwarf::DW_FORM_data1, VK);
1446 addBlock(SPDie, dwarf::DW_AT_vtable_elem_location, Block);
1447 ContainingTypeMap.insert(
1452 addFlag(SPDie, dwarf::DW_AT_declaration);
1456 for (
unsigned i = 1, N = Args.getNumElements(); i <
N; ++i) {
1458 DIType ATy(Args.getElement(i));
1460 if (ATy.isArtificial())
1461 addFlag(Arg, dwarf::DW_AT_artificial);
1466 addFlag(SPDie, dwarf::DW_AT_artificial);
1469 addFlag(SPDie, dwarf::DW_AT_external);
1472 addFlag(SPDie, dwarf::DW_AT_APPLE_optimized);
1475 addUInt(SPDie, dwarf::DW_AT_APPLE_isa, dwarf::DW_FORM_flag,
isa);
1485 const ConstantExpr *CE = dyn_cast_or_null<ConstantExpr>(V);
1487 CE->
getOpcode() != Instruction::GetElementPtr)
1492 if (!isa<GlobalValue>(Ptr) ||
1493 !isa<StructType>(cast<PointerType>(Ptr->
getType())->getElementType()))
1498 if (!CI || !CI->
isZero())
1523 DIE *VariableDIE = NULL;
1524 bool IsStaticMember =
false;
1527 assert(SDMDecl.
isStaticMember() &&
"Expected static member decl");
1529 VariableDIE = getOrCreateStaticMemberDIE(SDMDecl);
1530 IsStaticMember =
true;
1549 addFlag(VariableDIE, dwarf::DW_AT_external);
1556 bool addToAccelTable =
false;
1557 DIE *VariableSpecDIE = NULL;
1558 bool isGlobalVariable = GV.
getGlobal() != NULL;
1559 if (isGlobalVariable) {
1560 addToAccelTable =
true;
1566 assert((PointerSize == 4 || PointerSize == 8) &&
1567 "Add support for other sizes if necessary");
1573 addUInt(Block, dwarf::DW_FORM_data1,
1577 addExpr(Block, dwarf::DW_FORM_udata, Expr);
1592 addDIEEntry(VariableSpecDIE, dwarf::DW_AT_specification, VariableDIE);
1593 addBlock(VariableSpecDIE, dwarf::DW_AT_location, Block);
1596 addFlag(VariableDIE, dwarf::DW_AT_declaration);
1598 addBlock(VariableDIE, dwarf::DW_AT_location, Block);
1602 if (!LinkageName.
empty())
1606 addString(IsStaticMember && VariableSpecDIE ? VariableSpecDIE
1608 dwarf::DW_AT_MIPS_linkage_name,
1611 dyn_cast_or_null<ConstantInt>(GV.
getConstant())) {
1615 if (!IsStaticMember)
1618 addToAccelTable =
true;
1621 Value *Ptr = CE->getOperand(0);
1625 addUInt(Block, dwarf::DW_FORM_udata,
1628 addBlock(VariableDIE, dwarf::DW_AT_location, Block);
1631 if (addToAccelTable) {
1632 DIE *AddrDIE = VariableSpecDIE ? VariableSpecDIE : VariableDIE;
1647 void CompileUnit::constructSubrangeDIE(
DIE &Buffer,
DISubrange SR,
1650 addDIEEntry(DW_Subrange, dwarf::DW_AT_type, IndexTy);
1658 int64_t LowerBound = SR.
getLo();
1659 int64_t DefaultLowerBound = getDefaultLowerBound();
1662 if (DefaultLowerBound == -1 || LowerBound != DefaultLowerBound)
1663 addUInt(DW_Subrange, dwarf::DW_AT_lower_bound,
None, LowerBound);
1665 if (Count != -1 && Count != 0)
1668 addUInt(DW_Subrange, dwarf::DW_AT_upper_bound,
None,
1669 LowerBound + Count - 1);
1675 addFlag(&Buffer, dwarf::DW_AT_GNU_vector);
1683 DIE *IdxTy = getIndexTyDie();
1687 addString(IdxTy, dwarf::DW_AT_name,
"int");
1688 addUInt(IdxTy, dwarf::DW_AT_byte_size,
None,
sizeof(int32_t));
1689 addUInt(IdxTy, dwarf::DW_AT_encoding, dwarf::DW_FORM_data1,
1691 setIndexTyDie(IdxTy);
1698 if (Element.
getTag() == dwarf::DW_TAG_subrange_type)
1699 constructSubrangeDIE(Buffer,
DISubrange(Element), IdxTy);
1710 if (Enum.isEnumerator()) {
1713 addString(Enumerator, dwarf::DW_AT_name, Name);
1714 int64_t Value = Enum.getEnumValue();
1715 addSInt(Enumerator, dwarf::DW_AT_const_value, dwarf::DW_FORM_sdata, Value);
1721 addFlag(&Buffer, dwarf::DW_AT_enum_class);
1729 CE = ContainingTypeMap.end();
1731 DIE *SPDie = CI->first;
1738 addDIEEntry(SPDie, dwarf::DW_AT_containing_type, NDie);
1749 DIE *AbsDIE = AbsVar ? AbsVar->getDIE() : NULL;
1751 addDIEEntry(VariableDie, dwarf::DW_AT_abstract_origin, AbsDIE);
1754 addString(VariableDie, dwarf::DW_AT_name, Name);
1760 addFlag(VariableDie, dwarf::DW_AT_artificial);
1762 if (isScopeAbstract) {
1770 if (Offset != ~0U) {
1771 addLabel(VariableDie, dwarf::DW_AT_location,
1773 : dwarf::DW_FORM_data4,
1781 assert(DVInsn->getNumOperands() == 3);
1782 if (DVInsn->getOperand(0).isReg()) {
1785 if (DVInsn->getOperand(1).isImm()) {
1787 DVInsn->getOperand(1).getImm());
1789 }
else if (RegOp.
getReg())
1791 }
else if (DVInsn->getOperand(0).isImm())
1793 else if (DVInsn->getOperand(0).isFPImm())
1795 else if (DVInsn->getOperand(0).isCImm())
1805 unsigned FrameReg = 0;
1822 addString(MemberDie, dwarf::DW_AT_name, Name);
1846 addBlock(MemberDie, dwarf::DW_AT_data_member_location, VBaseLocationDie);
1850 uint64_t OffsetInBytes;
1852 if (Size != FieldSize) {
1860 uint64_t HiMark = (Offset + FieldSize) & AlignMask;
1861 uint64_t FieldOffset = (HiMark - FieldSize);
1862 Offset -= FieldOffset;
1866 Offset = FieldSize - (Offset + Size);
1867 addUInt(MemberDie, dwarf::DW_AT_bit_offset,
None, Offset);
1871 OffsetInBytes = FieldOffset >> 3;
1875 addUInt(MemberDie, dwarf::DW_AT_data_member_location,
None, OffsetInBytes);
1879 addUInt(MemberDie, dwarf::DW_AT_accessibility, dwarf::DW_FORM_data1,
1882 addUInt(MemberDie, dwarf::DW_AT_accessibility, dwarf::DW_FORM_data1,
1886 addUInt(MemberDie, dwarf::DW_AT_accessibility, dwarf::DW_FORM_data1,
1889 addUInt(MemberDie, dwarf::DW_AT_virtuality, dwarf::DW_FORM_data1,
1894 if (
DIEEntry *PropertyDie = getDIEEntry(PNode))
1895 MemberDie->
addValue(dwarf::DW_AT_APPLE_property, dwarf::DW_FORM_ref4,
1899 addFlag(MemberDie, dwarf::DW_AT_artificial);
1911 "Static member should belong to a type.");
1914 if (StaticMemberDIE)
1915 return StaticMemberDIE;
1924 addFlag(StaticMemberDIE, dwarf::DW_AT_external);
1925 addFlag(StaticMemberDIE, dwarf::DW_AT_declaration);
1930 addUInt(StaticMemberDIE, dwarf::DW_AT_accessibility, dwarf::DW_FORM_data1,
1933 addUInt(StaticMemberDIE, dwarf::DW_AT_accessibility, dwarf::DW_FORM_data1,
1936 addUInt(StaticMemberDIE, dwarf::DW_AT_accessibility, dwarf::DW_FORM_data1,
1944 return StaticMemberDIE;
unsigned isLocalToUnit() const
StringRef getName() const
static bool isShareableAcrossCUs(DIDescriptor D)
Check whether the DIE for this MDNode can be shared across CUs.
unsigned isLocalToUnit() const
std::reverse_iterator< iterator > reverse_iterator
void push_back(const T &Elt)
DITemplateTypeParameter - This is a wrapper for template type parameter.
DbgVariable * getAbstractVariable() const
int getDwarfRegNum(unsigned RegNum, bool isEH) const
Map a target register to an equivalent dwarf register number. Returns -1 if there is no equivalent va...
virtual void AddComment(const Twine &T)
GlobalVariable * getGlobal() const
const MachineInstr * getMInsn() const
bool isArtificial() const
uint64_t getZExtValue() const
Get zero extended value.
MCSymbol * getSymbol(const GlobalValue *GV) const
StringRef getDirectory() const
bool isVariable() const
isVariable - Return true if the specified tag is legal for DIVariable.
DIE * getOrCreateSubprogramDIE(DISubprogram SP)
getOrCreateSubprogramDIE - Create new DIE using SP.
bool isSubprogram() const
static bool isUnsignedDIType(DwarfDebug *DD, DIType Ty)
Return true if type encoding is unsigned.
void emitHeader(const MCSection *ASection, const MCSymbol *ASectionSym)
Emit the header for this unit, not including the initial length field.
const ConstantFP * getFPImm() const
const DataLayout & getDataLayout() const
getDataLayout - Return information about data layout.
void EmitInt8(int Value) const
DIScopeRef getContext() const
unsigned getLineNumber() const
unsigned getPointerSize(unsigned AS=0) const
unsigned getNumOperands() const
DITypeRef getType() const
uint64_t getAlignInBits() const
unsigned isDefinition() const
Collects and handles dwarf debug information.
const MachineFunction * MF
The current machine function.
Collects and handles information specific to a particular collection of units.
DIE * getDIE(const MDNode *TypeMD)
bool isUnspecifiedParameter() const
DIE * getOrCreateNameSpace(DINameSpace NS)
getOrCreateNameSpace - Create a DIE for DINameSpace.
std::string str() const
str - Get the contents as an std::string.
DIArray getTemplateParams() const
MDNode * getObjCProperty() const
getObjCProperty - Return property node, if this ivar is associated with one.
virtual std::string getLabelBeginName() const =0
MDNode - a tuple of other values.
unsigned getRunTimeLang() const
StringRef getName() const
const DIE * getCompileUnitOrNull() const
void addPubTypes(DISubprogram SP)
addPubTypes - Add a set of types from the subprogram to the global types.
unsigned getOpcode() const
getOpcode - Return the opcode at the root of this constant expression
DICompositeType getType() const
bool isObjCProperty() const
isObjCProperty - Return true if the specified tag is DW_TAG_APPLE_property.
Constant * getConstant() const
unsigned getLineNumber() const
DIE * constructVariableDIE(DbgVariable &DV, bool isScopeAbstract)
constructVariableDIE - Construct a DIE for the given DbgVariable.
uint16_t getLanguage() const
DIArray - This descriptor holds an array of descriptors.
unsigned isArtificial() const
DIScopeRef getContext() const
void addArangeLabel(SymbolCU SCU)
Add a label so that arange data can be generated for it.
void addAccelType(StringRef Name, std::pair< DIE *, unsigned > Die)
addAccelType - Add a new type to the type accelerator table.
const APInt & getValue() const
Return the constant's value.
void addLabel(DIE *Die, dwarf::Attribute Attribute, dwarf::Form Form, const MCSymbol *Label)
DIScope getContext() const
bool isThreadLocal() const
If the value is "Thread Local", its value isn't shared by the threads.
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
#define llvm_unreachable(msg)
DISubrange - This is used to represent ranges, for array bounds.
static bool isTypeSigned(DwarfDebug *DD, DIType Ty, int *SizeInBits)
isTypeSigned - Return true if the type is signed.
bool isArtificial() const
Return true if DbgVariable is artificial.
bool isIndirect() const
Return true if this variable is represented as a pointer.
uint64_t getIndexedOffset(Type *Ty, ArrayRef< Value * > Indices) const
bool isAppleBlockExtension() const
void addExpr(DIEBlock *Die, dwarf::Form Form, const MCExpr *Expr)
virtual unsigned getFrameRegister(const MachineFunction &MF) const =0
Debug information queries.
bool Verify() const
Verify - Verify that a derived type descriptor is well formed.
int getFrameIndex() const
static bool shouldCreateTypeUnit(DICompositeType CTy, const DwarfDebug *DD)
Return true if the type should be split out into a type unit.
DISubprogram - This is a wrapper for a subprogram (e.g. a function).
void addValue(dwarf::Attribute Attribute, dwarf::Form Form, DIEValue *Value)
void addAccelNamespace(StringRef Name, DIE *Die)
addAccelNamespace - Add a new name to the namespace accelerator table.
void createGlobalVariableDIE(DIGlobalVariable GV)
createGlobalVariableDIE - create global variable DIE.
StringRef getDirectory() const
This class is used to track local variable information.
unsigned getOrCreateSourceID(StringRef DirName, StringRef FullName, unsigned CUID)
Look up the source id with the given directory and source file names. If none currently exists...
DIVariable getVariable() const
void EmitInt16(int Value) const
bool isPrototyped() const
isPrototyped - Return true if this subprogram is prototyped.
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...
bool isLittleEndian() const
Layout endianness...
void addTemplateParams(DIE &Buffer, DIArray TParams)
addTemplateParams - Add template parameters in buffer.
unsigned getLineNumber() const
CompileUnit(unsigned UID, DIE *D, DICompileUnit CU, AsmPrinter *A, DwarfDebug *DW, DwarfUnits *DWU)
CompileUnit - Compile unit constructor.
StringRef getName() const
unsigned isOptimized() const
DIFile - This is a wrapper for a file.
dwarf::Tag getTag() const
static const ConstantExpr * getMergedGlobalExpr(const Value *V)
DIE * getOrCreateTypeDIE(const MDNode *N)
void addUInt(DIE *Die, dwarf::Attribute Attribute, Optional< dwarf::Form > Form, uint64_t Integer)
virtual int getFrameIndexReference(const MachineFunction &MF, int FI, unsigned &FrameReg) const
DIScopeRef getContext() const
bool isTemplateTypeParameter() const
unsigned getDotDebugLocOffset() const
void addString(DIE *Die, dwarf::Attribute Attribute, const StringRef Str)
bool isType() const
isType - Return true if the specified tag is legal for DIType.
void addOpAddress(DIEBlock *Die, const MCSymbol *Label)
A self-contained host- and target-independent arbitrary-precision floating-point software implementat...
void addLocalString(DIE *Die, dwarf::Attribute Attribute, const StringRef Str)
unsigned isDefinition() const
DITypeRef getContainingType() const
DITemplateValueParameter - This is a wrapper for template value parameter.
DITypeRef getContainingType() const
bool isTemplateValueParameter() const
StringRef getFilename() const
StringRef getName() const
If the scope node has a name, return that, else return an empty string.
DIE * getOrCreateContextDIE(DIScope Context)
getOrCreateContextDIE - Get context owner's DIE.
DIDescriptor getElement(unsigned Idx) const
void addBlockByrefAddress(const DbgVariable &DV, DIE *Die, dwarf::Attribute Attribute, const MachineLocation &Location)
unsigned getUniqueID() const
unsigned getNumAddrElements() const
int64_t getSExtValue() const
Get sign extended value.
void addBlock(DIE *Die, dwarf::Attribute Attribute, DIEBlock *Block)
void addDelta(DIE *Die, dwarf::Attribute Attribute, dwarf::Form Form, const MCSymbol *Hi, const MCSymbol *Lo)
static dwarf::Form BestForm(bool IsSigned, uint64_t Int)
bool variableHasComplexAddress() const
void addConstantFPValue(DIE *Die, const MachineOperand &MO)
addConstantFPValue - Add constant value entry in variable DIE.
DIEExpr - An expression DIE.
This file declares a class to represent arbitrary precision floating point values and provide a varie...
DIGlobalVariable - This is a wrapper for a global variable.
unsigned getBitWidth() const
Return the number of bits in the APInt.
void addAccelName(StringRef Name, DIE *Die)
addAccelName - Add a new name to the name accelerator table.
void addConstantValue(DIE *Die, const MachineOperand &MO, DIType Ty)
addConstantValue - Add constant value entry in variable DIE.
Value * getOperand(unsigned i) const
StringRef getLinkageName() const
unsigned getEncoding() const
static bool isTypeUnitScoped(DIType Ty, const DwarfDebug *DD)
uint64_t getOffsetInBits() const
unsigned getNumElements() const
Helper used to pair up a symbol and its DWARF compile unit.
virtual const TargetFrameLowering * getFrameLowering() const
void addChild(DIE *Child)
DIE * getDIE(DIDescriptor D) const
std::string getParentContextString(DIScope Context) const
DIArray getTemplateParams() const
unsigned getLineNumber() const
DIScope - A base class for various scopes.
void constructContainingTypeDIEs()
StringRef getName() const
void addSourceLine(DIE *Die, DIVariable V)
StringRef getDisplayName() const
void insertDIE(DIDescriptor Desc, DIE *D)
void addAddress(DIE *Die, dwarf::Attribute Attribute, const MachineLocation &Location, bool Indirect=false)
DIE * createAndAddDIE(unsigned Tag, DIE &Parent, DIDescriptor N=DIDescriptor())
unsigned getLineNumber() const
Class for constant integers.
DINameSpace - A wrapper for a C++ style name space.
StringRef getName() const
bool needsRelocationsForDwarfStringPool() const
unsigned getStringPoolIndex(StringRef Str)
Returns the index into the string pool with the given string text.
bool isSubprogramContext(const MDNode *Context)
void EmitSectionOffset(const MCSymbol *Label, const MCSymbol *SectionLabel) const
bool isGlobalVariable() const
T resolve(DIRef< T > Ref) const
Find the MDNode for the given reference.
StringRef getName() const
void addGlobalName(StringRef Name, DIE *Die, DIScope Context)
addGlobalName - Add a new global name to the compile unit.
DIArray getTypeArray() const
void addVariableAddress(const DbgVariable &DV, DIE *Die, MachineLocation Location)
DIDerivedType getStaticDataMemberDeclaration() const
DISubprogram getFunctionDeclaration() const
bool isFPImm() const
isFPImm - Tests if this is a MO_FPImmediate operand.
DIScope getContext() const
Class for arbitrary precision integers.
~CompileUnit()
~CompileUnit - Destructor for compile unit.
bool isForwardDecl() const
bool isStaticMember() const
StringRef getName() const
APInt bitcastToAPInt() const
uint64_t getAddrElement(unsigned i) const
unsigned getVirtualIndex() const
void addRegisterOp(DIEBlock *TheDie, unsigned Reg)
addRegisterOp - Add register operand.
bool isNameSpace() const
isNameSpace - Return true if the specified tag is DW_TAG_namespace.
MCSymbol * getStringPoolSym()
Returns the entry into the start of the pool.
DITypeRef getClassType() const
static StringRef getRealLinkageName(StringRef Name)
dwarf::Form BestForm() const
const uint64_t * getRawData() const
unsigned getAddrPoolIndex(const MCExpr *Sym)
Returns the index into the address pool with the given label/symbol.
void addGlobalType(DIType Ty)
void insertDIE(const MDNode *TypeMD, DIE *Die)
MCSymbol * getStringPoolEntry(StringRef Str)
Returns an entry into the string pool with the given string text.
uint64_t getSizeInBits() const
void addComplexAddress(const DbgVariable &DV, DIE *Die, dwarf::Attribute Attribute, const MachineLocation &Location)
bool isCompositeType() const
virtual const TargetRegisterInfo * getRegisterInfo() const
void addSInt(DIE *Die, dwarf::Attribute Attribute, Optional< dwarf::Form > Form, int64_t Integer)
virtual unsigned getISAEncoding()
bool isBlockByrefVariable() const
bool useSplitDwarf()
Returns whether or not to change the current debug info for the split dwarf proposal support...
bool isObjcClassComplete() const
unsigned ComputeSize(AsmPrinter *AP)
const APFloat & getValueAPF() const
void addFlag(DIE *Die, dwarf::Attribute Attribute)
addFlag - Add a flag that is true to the DIE.
unsigned getReg() const
getReg - Returns the register number.
const TargetLoweringObjectFile & getObjFileLowering() const
getObjFileLowering - Return information about object file lowering.
reverse_iterator rbegin()
void addType(DIE *Entity, DIType Ty, dwarf::Attribute Attribute=dwarf::DW_AT_type)
addType - Add a new type attribute to the specified entity.
LLVM Value Representation.
StringRef getFilename() const
Constant * getConstant() const
DIScope getContext() const
DITypeRef getTypeDerivedFrom() const
void addDIEEntry(DIE *Die, dwarf::Attribute Attribute, DIE *Entry)
void addLabelAddress(DIE *Die, dwarf::Attribute Attribute, MCSymbol *Label)
bool Verify() const
Verify - Verify that a namespace descriptor is well formed.
unsigned getLineNumber() const
bool isDerivedType() const
isDerivedType - Return true if the specified tag is legal for DIDerivedType.
bool isCompileUnit() const
isCompileUnit - Return true if the specified tag is DW_TAG_compile_unit.
MCSymbol * GetTempSymbol(StringRef Name, unsigned ID) const
DIEBlock - A block of values. Primarily used for location expressions.
DICompileUnit - A wrapper for a compile unit.
unsigned getDwarfVersion() const
Returns the Dwarf Version.
StringRef getLinkageName() const
void addTypeUnitType(DIE *Die)
Add a DIE to the set of types that we're going to pull into type units.
void addRegisterOffset(DIEBlock *TheDie, unsigned Reg, int64_t Offset)
addRegisterOffset - Add register offset.
DITypeRef getType() const
bool isFile() const
isFile - Return true if the specified tag is DW_TAG_file_type.
void addAccelObjC(StringRef Name, DIE *Die)
addAccelObjC - Add a new name to the ObjC accelerator table.
unsigned getVirtuality() const
bool empty() const
empty - Check if the string is empty.
DIBasicType - A basic type, like 'int' or 'float'.
static uint64_t getBaseTypeSize(DwarfDebug *DD, DIDerivedType Ty)
If this type is derived from a base type then return base type size.