llvm.org GIT mirror llvm / f8a01a9
1. Support standard dwarf format (was bootstrapping in Apple format.) 2. Add vector support. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28807 91177308-0d34-0410-b5e6-96231b3b80d8 Jim Laskey 13 years ago
7 changed file(s) with 52 addition(s) and 20 deletion(s). Raw diff Collapse all Expand all
574574 uint, ;; Size in bits
575575 uint, ;; Alignment in bits
576576 uint, ;; Offset in bits
577 bool, ;; Is vector flag
577578 { }* ;; Reference to array of member descriptors
578579 }
579580
588589 DW_TAG_structure_type = 19
589590 DW_TAG_union_type = 23
590591
592
593

The vector flag indicates that an array type is a native packed vector.

591594
592595

The members of array types (tag = DW_TAG_array_type) are

593596 href="#format_subrange">subrange descriptors, each representing the range of
15991602 uint 96,
16001603 uint 32,
16011604 uint 0,
1602 { }* null,
1605 { }* null,
1606 bool false,
16031607 { }* cast ([3 x { }*]* %llvm.dbg.array to { }*) }, section "llvm.metadata"
16041608 %str2 = internal constant [6 x sbyte] c"Color\00", section "llvm.metadata"
16051609
16921696 uint 32,
16931697 uint 0,
16941698 { }* null,
1699 bool false,
16951700 { }* cast ([3 x { }*]* %llvm.dbg.array to { }*) }, section "llvm.metadata"
16961701 %str1 = internal constant [6 x sbyte] c"Trees\00", section "llvm.metadata"
16971702
5656 // Debug info constants.
5757
5858 enum {
59 LLVMDebugVersion = 3 // Current version of debug information.
59 LLVMDebugVersion = 4 // Current version of debug information.
6060 };
6161
6262 //===----------------------------------------------------------------------===//
399399 /// array/struct types (eg., arrays, struct, union, enums.)
400400 class CompositeTypeDesc : public DerivedTypeDesc {
401401 private:
402 bool IsVector; // packed/vector array
402403 std::vector Elements;// Information used to compose type.
403404
404405 public:
405406 CompositeTypeDesc(unsigned T);
406407
407408 // Accessors
409 bool isVector() const { return IsVector; }
408410 std::vector &getElements() { return Elements; }
411 void setIsVector() { IsVector = true; }
409412
410413 // Implement isa/cast/dyncast.
411414 static bool classof(const CompositeTypeDesc *) { return true; }
3636 DW_TAG_arg_variable = 0x101, // Tag for argument variables.
3737 DW_TAG_return_variable = 0x102, // Tag for return variables.
3838
39 DW_TAG_user_base = 0x1000, // Recommended base for user tags.
39 DW_TAG_user_base = 0x1000, // Recommended base for user tags.
4040
41 DW_CIE_VERSION = 1, // Common frame information version.
42 DW_CIE_ID = 0xffffffff // Common frame information mark.
41 DW_CIE_VERSION = 1, // Common frame information version.
42 DW_CIE_ID = 0xffffffff // Common frame information mark.
4343 };
4444
4545 enum dwarf_constants {
197197 DW_AT_elemental = 0x66,
198198 DW_AT_pure = 0x67,
199199 DW_AT_recursive = 0x68,
200 DW_AT_sf_names = 0x2101,
201 DW_AT_src_info = 0x2102,
202 DW_AT_mac_info = 0x2103,
203 DW_AT_src_coords = 0x2104,
204 DW_AT_body_begin = 0x2105,
205 DW_AT_body_end = 0x2106,
206 DW_AT_GNU_vector = 0x2107,
200207 DW_AT_lo_user = 0x2000,
201208 DW_AT_hi_user = 0x3fff,
202209
12641264 // Fundamental types like int, float, bool
12651265 Slot = Ty = new DIE(DW_TAG_base_type);
12661266 unsigned Encoding = BasicTy->getEncoding();
1267 Ty->AddUInt (DW_AT_encoding, DW_FORM_data1, Encoding);
1267 Ty->AddUInt(DW_AT_encoding, DW_FORM_data1, Encoding);
12681268 } else if (DerivedTypeDesc *DerivedTy = dyn_cast(TyDesc)) {
12691269 // Create specific DIE.
12701270 Slot = Ty = new DIE(DerivedTy->getTag());
12861286 Ty->AddDIEntry(DW_AT_type, DW_FORM_ref4,
12871287 NewType(Context, FromTy, Unit));
12881288 }
1289
1290 // check for vector type
1291 if (CompTy->isVector()) {
1292 Ty->AddUInt(DW_AT_GNU_vector, DW_FORM_flag, 1);
1293 }
1294
12891295 // Don't emit size attribute.
12901296 Size = 0;
12911297
14181424 unsigned ID) {
14191425 // Construct debug information entry.
14201426 DIE *Die = new DIE(DW_TAG_compile_unit);
1421 Die->AddLabel (DW_AT_stmt_list, DW_FORM_data4, DWLabel("line", 0));
1427 Die->AddDelta (DW_AT_stmt_list, DW_FORM_data4, DWLabel("line", 0),
1428 DWLabel("section_line", 0));
14221429 Die->AddLabel (DW_AT_high_pc, DW_FORM_addr, DWLabel("text_end", 0));
14231430 Die->AddLabel (DW_AT_low_pc, DW_FORM_addr, DWLabel("text_begin", 0));
14241431 Die->AddString(DW_AT_producer, DW_FORM_string, UnitDesc->getProducer());
18411848 int stackGrowth =
18421849 Asm->TM.getFrameInfo()->getStackGrowthDirection() ==
18431850 TargetFrameInfo::StackGrowsUp ?
1844 AddressSize : -AddressSize;
1851 AddressSize : -AddressSize;
18451852
18461853 EmitULEB128Bytes(Src.getOffset() / stackGrowth);
18471854 EOL("Offset");
18741881
18751882 EmitInt32(ContentSize); EOL("Length of Compilation Unit Info");
18761883 EmitInt16(DWARF_VERSION); EOL("DWARF version number");
1877 EmitReference("abbrev_begin", 0); EOL("Offset Into Abbrev. Section");
1884 EmitDifference("abbrev_begin", 0, "section_abbrev", 0);
1885 EOL("Offset Into Abbrev. Section");
18781886 EmitInt8(AddressSize); EOL("Address Size (in bytes)");
18791887
18801888 EmitDIE(Die);
816816
817817 CompositeTypeDesc::CompositeTypeDesc(unsigned T)
818818 : DerivedTypeDesc(T)
819 , IsVector(false)
819820 , Elements()
820821 {}
821822
838839 void CompositeTypeDesc::ApplyToFields(DIVisitor *Visitor) {
839840 DerivedTypeDesc::ApplyToFields(Visitor);
840841
842 Visitor->Apply(IsVector);
841843 Visitor->Apply(Elements);
842844 }
843845
187187 case DW_AT_elemental: return "AT_elemental";
188188 case DW_AT_pure: return "AT_pure";
189189 case DW_AT_recursive: return "AT_recursive";
190 case DW_AT_sf_names: return "AT_sf_names";
191 case DW_AT_src_info: return "AT_src_info";
192 case DW_AT_mac_info: return "AT_mac_info";
193 case DW_AT_src_coords: return "AT_src_coords";
194 case DW_AT_body_begin: return "AT_body_begin";
195 case DW_AT_body_end: return "AT_body_end";
196 case DW_AT_GNU_vector: return "AT_GNU_vector";
190197 case DW_AT_lo_user: return "AT_lo_user";
191198 case DW_AT_hi_user: return "AT_hi_user";
192199 }
245245 : DwarfWriter(o, ap)
246246 {
247247 needsSet = true;
248 DwarfAbbrevSection = ".section __DWARFA,__debug_abbrev";
249 DwarfInfoSection = ".section __DWARFA,__debug_info";
250 DwarfLineSection = ".section __DWARFA,__debug_line";
251 DwarfFrameSection = ".section __DWARFA,__debug_frame";
252 DwarfPubNamesSection = ".section __DWARFA,__debug_pubnames";
253 DwarfPubTypesSection = ".section __DWARFA,__debug_pubtypes";
254 DwarfStrSection = ".section __DWARFA,__debug_str";
255 DwarfLocSection = ".section __DWARFA,__debug_loc";
256 DwarfARangesSection = ".section __DWARFA,__debug_aranges";
257 DwarfRangesSection = ".section __DWARFA,__debug_ranges";
258 DwarfMacInfoSection = ".section __DWARFA,__debug_macinfo";
248 DwarfAbbrevSection = ".section __DWARF,__debug_abbrev";
249 DwarfInfoSection = ".section __DWARF,__debug_info";
250 DwarfLineSection = ".section __DWARF,__debug_line";
251 DwarfFrameSection = ".section __DWARF,__debug_frame";
252 DwarfPubNamesSection = ".section __DWARF,__debug_pubnames";
253 DwarfPubTypesSection = ".section __DWARF,__debug_pubtypes";
254 DwarfStrSection = ".section __DWARF,__debug_str";
255 DwarfLocSection = ".section __DWARF,__debug_loc";
256 DwarfARangesSection = ".section __DWARF,__debug_aranges";
257 DwarfRangesSection = ".section __DWARF,__debug_ranges";
258 DwarfMacInfoSection = ".section __DWARF,__debug_macinfo";
259259 TextSection = ".text";
260260 DataSection = ".data";
261261 }