1. Revise vector debug support.
authorJim Laskey <jlaskey@mac.com>
Fri, 16 Jun 2006 13:14:03 +0000 (13:14 +0000)
committerJim Laskey <jlaskey@mac.com>
Fri, 16 Jun 2006 13:14:03 +0000 (13:14 +0000)
2. Update docs for vector debug support and new version control.

3. Simplify serialization of DebugDescInfo subclasses.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28816 91177308-0d34-0410-b5e6-96231b3b80d8

docs/SourceLevelDebugging.html
include/llvm/CodeGen/MachineDebugInfo.h
include/llvm/Support/Dwarf.h
lib/CodeGen/DwarfWriter.cpp
lib/CodeGen/MachineDebugInfo.cpp

index 2538aeaa109c996b29783ab5aed86939ebbd2752..7916a0e0551321781fca7dd29c77b0653013b820 100644 (file)
@@ -295,13 +295,15 @@ descriptors, arrays of descriptors or global variables.</p>
   }
 </pre>
 
-<p>The first field of a descriptor is always an <tt>uint</tt> containing a tag
-value identifying the content of the descriptor. The remaining fields are
-specific to the descriptor.  The values of tags are loosely bound to the tag
-values of Dwarf information entries.  However, that does not restrict the use of
-the information supplied to Dwarf targets.</p>
+<p><a name="LLVMDebugVersion">The first field of a descriptor is always an
+<tt>uint</tt> containing a tag value identifying the content of the descriptor.
+The remaining fields are specific to the descriptor.  The values of tags are
+loosely bound to the tag values of Dwarf information entries.  However, that
+does not restrict the use of the information supplied to Dwarf targets.  To
+facilitate versioning of debug information, the tag is augmented with the
+current debug version (LLVMDebugVersion = 4 << 16 or 0x40000.)</a></p>
 
-<p>The details of the various descriptors follow.</p>
+<p>The details of the various descriptors follow.</p>  
 
 </div>
 
@@ -314,7 +316,7 @@ the information supplied to Dwarf targets.</p>
 
 <pre>
   %<a href="#format_anchors">llvm.dbg.anchor.type</a> = type {
-    uint,   ;; Tag = 0
+    uint,   ;; Tag = 0 + <a href="#LLVMDebugVersion">LLVMDebugVersion</a>
     uint    ;; Tag of descriptors grouped by the anchor
   }
 </pre>
@@ -352,9 +354,8 @@ deleted.</p>
 
 <pre>
   %<a href="#format_compile_units">llvm.dbg.compile_unit.type</a> = type {
-    uint,   ;; Tag = 17 (DW_TAG_compile_unit)
+    uint,   ;; Tag = 17 + <a href="#LLVMDebugVersion">LLVMDebugVersion</a> (DW_TAG_compile_unit)
     {  }*,  ;; Compile unit anchor = cast = (%<a href="#format_anchors">llvm.dbg.anchor.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_units</a> to {  }*)
-    uint,   ;; LLVM debug version number = 3
     uint,   ;; Dwarf language identifier (ex. DW_LANG_C89) 
     sbyte*, ;; Source file name
     sbyte*, ;; Source file directory (includes trailing slash)
@@ -362,11 +363,11 @@ deleted.</p>
   }
 </pre>
 
-<p>These descriptors contain the version number for the debug info (currently
-3), a source language ID for the file (we use the Dwarf 3.0 ID numbers, such as
-<tt>DW_LANG_C89</tt>, <tt>DW_LANG_C_plus_plus</tt>, <tt>DW_LANG_Cobol74</tt>,
-etc), three strings describing the filename, working directory of the compiler,
-and an identifier string for the compiler that produced it.</p>
+<p>These descriptors contain a source language ID for the file (we use the Dwarf
+3.0 ID numbers, such as <tt>DW_LANG_C89</tt>, <tt>DW_LANG_C_plus_plus</tt>,
+<tt>DW_LANG_Cobol74</tt>, etc), three strings describing the filename, working
+directory of the compiler, and an identifier string for the compiler that
+produced it.</p>
 
 <p> Compile unit descriptors provide the root context for objects declared in a
 specific source file.  Global variables and top level functions would be defined
@@ -384,7 +385,7 @@ line correspondence.</p>
 
 <pre>
   %<a href="#format_global_variables">llvm.dbg.global_variable.type</a> = type {
-    uint,   ;; Tag = 52 (DW_TAG_variable)
+    uint,   ;; Tag = 52 + <a href="#LLVMDebugVersion">LLVMDebugVersion</a> (DW_TAG_variable)
     {  }*,  ;; Global variable anchor = cast (%<a href="#format_anchors">llvm.dbg.anchor.type</a>* %<a href="#format_global_variables">llvm.dbg.global_variables</a> to {  }*),  
     {  }*,  ;; Reference to context descriptor
     sbyte*, ;; Name
@@ -411,7 +412,7 @@ provide details such as name, type and where the variable is defined.</p>
 
 <pre>
   %<a href="#format_subprograms">llvm.dbg.subprogram.type</a> = type {
-    uint,   ;; Tag = 46 (DW_TAG_subprogram)
+    uint,   ;; Tag = 46 + <a href="#LLVMDebugVersion">LLVMDebugVersion</a> (DW_TAG_subprogram)
     {  }*,  ;; Subprogram anchor = cast (%<a href="#format_anchors">llvm.dbg.anchor.type</a>* %<a href="#format_subprograms">llvm.dbg.subprograms</a> to {  }*),  
     {  }*,  ;; Reference to context descriptor
     sbyte*, ;; Name
@@ -437,7 +438,7 @@ location where the subprogram is defined.</p>
 
 <pre>
   %<a href="#format_blocks">llvm.dbg.block</a> = type {
-    uint,   ;; Tag = 13 (DW_TAG_lexical_block)
+    uint,   ;; Tag = 13 + <a href="#LLVMDebugVersion">LLVMDebugVersion</a> (DW_TAG_lexical_block)
     {  }*   ;; Reference to context descriptor
   }
 </pre>
@@ -457,7 +458,7 @@ and deeper nested blocks.</p>
 
 <pre>
   %<a href="#format_basic_type">llvm.dbg.basictype.type</a> = type {
-    uint,   ;; Tag = 36 (DW_TAG_base_type)
+    uint,   ;; Tag = 36 + <a href="#LLVMDebugVersion">LLVMDebugVersion</a> (DW_TAG_base_type)
     {  }*,  ;; Reference to context (typically a compile unit)
     sbyte*, ;; Name (may be "" for anonymous types)
     {  }*,  ;; Reference to compile unit where defined (may be NULL)
@@ -575,7 +576,6 @@ NULL derived type.</p>
     uint,   ;; Size in bits
     uint,   ;; Alignment in bits
     uint,   ;; Offset in bits
-    bool,   ;; Is vector flag
     {  }*   ;; Reference to array of member descriptors
   }
 </pre>
@@ -589,13 +589,15 @@ are possible tag values;</p>
   DW_TAG_enumeration_type = 4
   DW_TAG_structure_type = 19
   DW_TAG_union_type = 23
+  DW_TAG_vector_type = 259
 </pre>
 
 <p>The vector flag indicates that an array type is a native packed vector.</p>
 
-<p>The members of array types (tag = <tt>DW_TAG_array_type</tt>) are <a
-href="#format_subrange">subrange descriptors</a>, each representing the range of
-subscripts at that level of indexing.</p>
+<p>The members of array types (tag = <tt>DW_TAG_array_type</tt>) or vector types
+(tag = <tt>DW_TAG_vector_type</tt>) are <a href="#format_subrange">subrange
+descriptors</a>, each representing the range of subscripts at that level of
+indexing.</p>
 
 <p>The members of enumeration types (tag = <tt>DW_TAG_enumeration_type</tt>) are
 <a href="#format_enumeration">enumerator descriptors</a>, each representing the
@@ -627,7 +629,7 @@ type</a>.</p>
 
 <pre>
   %<a href="#format_subrange">llvm.dbg.subrange.type</a> = type {
-    uint,   ;; Tag = 33 (DW_TAG_subrange_type)
+    uint,   ;; Tag = 33 + <a href="#LLVMDebugVersion">LLVMDebugVersion</a> (DW_TAG_subrange_type)
     uint,   ;; Low value
     uint    ;; High value
   }
@@ -650,7 +652,7 @@ low == high the array will be unbounded.</p>
 
 <pre>
   %<a href="#format_enumeration">llvm.dbg.enumerator.type</a> = type {
-    uint,   ;; Tag = 40 (DW_TAG_enumerator)
+    uint,   ;; Tag = 40 + <a href="#LLVMDebugVersion">LLVMDebugVersion</a> (DW_TAG_enumerator)
     sbyte*, ;; Name
     uint    ;; Value
   }
@@ -1042,7 +1044,7 @@ int main(int argc, char *argv[]) {
 ;; Define the compile unit for the source file "/Users/mine/sources/MySource.cpp".
 ;;
 %<a href="#format_compile_units">llvm.dbg.compile_unit1</a> = internal constant %<a href="#format_compile_units">llvm.dbg.compile_unit.type</a> {
-    uint 17
+    uint add(uint 17, uint 262144)
     {  }* cast (%<a href="#format_anchors">llvm.dbg.anchor.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_units</a> to {  }*), 
     uint 1, 
     uint 1, 
@@ -1054,7 +1056,7 @@ int main(int argc, char *argv[]) {
 ;; Define the compile unit for the header file "/Users/mine/sources/MyHeader.h".
 ;;
 %<a href="#format_compile_units">llvm.dbg.compile_unit2</a> = internal constant %<a href="#format_compile_units">llvm.dbg.compile_unit.type</a> {
-    uint 17
+    uint add(uint 17, uint 262144)
     {  }* cast (%<a href="#format_anchors">llvm.dbg.anchor.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_units</a> to {  }*), 
     uint 1, 
     uint 1, 
@@ -1117,7 +1119,7 @@ int MyGlobal = 100;
 ;; variable anchor and the global variable itself.
 ;;
 %<a href="#format_global_variables">llvm.dbg.global_variable</a> = internal constant %<a href="#format_global_variables">llvm.dbg.global_variable.type</a> {
-    uint 52
+    uint add(uint 52, uint 262144)
     {  }* cast (%<a href="#format_anchors">llvm.dbg.anchor.type</a>* %<a href="#format_global_variables">llvm.dbg.global_variables</a> to {  }*), 
     {  }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to {  }*), 
     sbyte* getelementptr ([9 x sbyte]* %str1, int 0, int 0), 
@@ -1133,7 +1135,7 @@ int MyGlobal = 100;
 ;; intrinsic type the source file is NULL and line 0.
 ;;    
 %<a href="#format_basic_type">llvm.dbg.basictype</a> = internal constant %<a href="#format_basic_type">llvm.dbg.basictype.type</a> {
-    uint 36
+    uint add(uint 36, uint 262144)
     {  }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to {  }*), 
     sbyte* getelementptr ([4 x sbyte]* %str2, int 0, int 0), 
     {  }* null, 
@@ -1190,7 +1192,7 @@ int main(int argc, char *argv[]) {
 ;; Define the descriptor for the subprogram.  TODO - more details.
 ;;
 %<a href="#format_subprograms">llvm.dbg.subprogram</a> = internal constant %<a href="#format_subprograms">llvm.dbg.subprogram.type</a> {
-    uint 46
+    uint add(uint 46, uint 262144)
     {  }* cast (%<a href="#format_anchors">llvm.dbg.anchor.type</a>* %<a href="#format_subprograms">llvm.dbg.subprograms</a> to {  }*), 
     {  }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to {  }*), 
     sbyte* getelementptr ([5 x sbyte]* %str1, int 0, int 0), 
@@ -1235,7 +1237,7 @@ int %main(int %argc, sbyte** %argv) {
 
 <pre>
 %<a href="#format_basic_type">llvm.dbg.basictype</a> = internal constant %<a href="#format_basic_type">llvm.dbg.basictype.type</a> {
-    uint 36
+    uint add(uint 36, uint 262144)
     {  }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to {  }*), 
     sbyte* getelementptr ([5 x sbyte]* %str1, int 0, int 0), 
     {  }* null, 
@@ -1258,7 +1260,7 @@ int %main(int %argc, sbyte** %argv) {
 
 <pre>
 %<a href="#format_basic_type">llvm.dbg.basictype</a> = internal constant %<a href="#format_basic_type">llvm.dbg.basictype.type</a> {
-    uint 36
+    uint add(uint 36, uint 262144)
     {  }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to {  }*), 
     sbyte* getelementptr ([5 x sbyte]* %str1, int 0, int 0), 
     {  }* null, 
@@ -1281,7 +1283,7 @@ int %main(int %argc, sbyte** %argv) {
 
 <pre>
 %<a href="#format_basic_type">llvm.dbg.basictype</a> = internal constant %<a href="#format_basic_type">llvm.dbg.basictype.type</a> {
-    uint 36
+    uint add(uint 36, uint 262144)
     {  }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to {  }*), 
     sbyte* getelementptr ([14 x sbyte]* %str1, int 0, int 0), 
     {  }* null, 
@@ -1304,7 +1306,7 @@ int %main(int %argc, sbyte** %argv) {
 
 <pre>
 %<a href="#format_basic_type">llvm.dbg.basictype</a> = internal constant %<a href="#format_basic_type">llvm.dbg.basictype.type</a> {
-    uint 36
+    uint add(uint 36, uint 262144)
     {  }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to {  }*), 
     sbyte* getelementptr ([10 x sbyte]* %str1, int 0, int 0), 
     {  }* null, 
@@ -1327,7 +1329,7 @@ int %main(int %argc, sbyte** %argv) {
 
 <pre>
 %<a href="#format_basic_type">llvm.dbg.basictype</a> = internal constant %<a href="#format_basic_type">llvm.dbg.basictype.type</a> {
-    uint 36
+    uint add(uint 36, uint 262144)
     {  }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to {  }*), 
     sbyte* getelementptr ([19 x sbyte]* %str1, int 0, int 0), 
     {  }* null, 
@@ -1350,7 +1352,7 @@ int %main(int %argc, sbyte** %argv) {
 
 <pre>
 %<a href="#format_basic_type">llvm.dbg.basictype</a> = internal constant %<a href="#format_basic_type">llvm.dbg.basictype.type</a> {
-    uint 36
+    uint add(uint 36, uint 262144)
     {  }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to {  }*), 
     sbyte* getelementptr ([4 x sbyte]* %str1, int 0, int 0), 
     {  }* null, 
@@ -1373,7 +1375,7 @@ int %main(int %argc, sbyte** %argv) {
 
 <pre>
 %<a href="#format_basic_type">llvm.dbg.basictype</a> = internal constant %<a href="#format_basic_type">llvm.dbg.basictype.type</a> {
-    uint 36
+    uint add(uint 36, uint 262144)
     {  }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to {  }*), 
     sbyte* getelementptr ([13 x sbyte]* %str1, int 0, int 0), 
     {  }* null, 
@@ -1396,7 +1398,7 @@ int %main(int %argc, sbyte** %argv) {
 
 <pre>
 %<a href="#format_basic_type">llvm.dbg.basictype</a> = internal constant %<a href="#format_basic_type">llvm.dbg.basictype.type</a> {
-    uint 36
+    uint add(uint 36, uint 262144)
     {  }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to {  }*), 
     sbyte* getelementptr ([14 x sbyte]* %str1, int 0, int 0), 
     {  }* null, 
@@ -1419,7 +1421,7 @@ int %main(int %argc, sbyte** %argv) {
 
 <pre>
 %<a href="#format_basic_type">llvm.dbg.basictype</a> = internal constant %<a href="#format_basic_type">llvm.dbg.basictype.type</a> {
-    uint 36
+    uint add(uint 36, uint 262144)
     {  }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to {  }*), 
     sbyte* getelementptr ([23 x sbyte]* %str1, int 0, int 0), 
     {  }* null, 
@@ -1442,7 +1444,7 @@ int %main(int %argc, sbyte** %argv) {
 
 <pre>
 %<a href="#format_basic_type">llvm.dbg.basictype</a> = internal constant %<a href="#format_basic_type">llvm.dbg.basictype.type</a> {
-    uint 36
+    uint add(uint 36, uint 262144)
     {  }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to {  }*), 
     sbyte* getelementptr ([6 x sbyte]* %str1, int 0, int 0), 
     {  }* null, 
@@ -1465,7 +1467,7 @@ int %main(int %argc, sbyte** %argv) {
 
 <pre>
 %<a href="#format_basic_type">llvm.dbg.basictype</a> = internal constant %<a href="#format_basic_type">llvm.dbg.basictype.type</a> {
-    uint 36
+    uint add(uint 36, uint 262144)
     {  }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to {  }*), 
     sbyte* getelementptr ([7 x sbyte]* %str1, int 0, int 0), 
     {  }* null, 
@@ -1499,7 +1501,7 @@ typedef const int *IntPtr;
 ;; Define the typedef "IntPtr".
 ;;
 %<a href="#format_derived_type">llvm.dbg.derivedtype1</a> = internal constant %<a href="#format_derived_type">llvm.dbg.derivedtype.type</a> {
-    uint 22
+    uint add(uint 22, uint 262144)
     {  }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to {  }*), 
     sbyte* getelementptr ([7 x sbyte]* %str1, int 0, int 0), 
     {  }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to {  }*), 
@@ -1514,7 +1516,7 @@ typedef const int *IntPtr;
 ;; Define the pointer type.
 ;;
 %<a href="#format_derived_type">llvm.dbg.derivedtype2</a> = internal constant %<a href="#format_derived_type">llvm.dbg.derivedtype.type</a> {
-    uint 15
+    uint add(uint 15, uint 262144)
     {  }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to {  }*), 
     sbyte* null, 
     {  }* null, 
@@ -1528,7 +1530,7 @@ typedef const int *IntPtr;
 ;; Define the const type.
 ;;
 %<a href="#format_derived_type">llvm.dbg.derivedtype3</a> = internal constant %<a href="#format_derived_type">llvm.dbg.derivedtype.type</a> {
-    uint 38
+    uint add(uint 38, uint 262144)
     {  }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to {  }*), 
     sbyte* null, 
     {  }* null, 
@@ -1542,7 +1544,7 @@ typedef const int *IntPtr;
 ;; Define the int type.
 ;;
 %<a href="#format_basic_type">llvm.dbg.basictype1</a> = internal constant %<a href="#format_basic_type">llvm.dbg.basictype.type</a> {
-    uint 36
+    uint add(uint 36, uint 262144)
     {  }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to {  }*), 
     sbyte* getelementptr ([4 x sbyte]* %str2, int 0, int 0), 
     {  }* null, 
@@ -1580,7 +1582,7 @@ struct Color {
 ;; Define basic type for unsigned int.
 ;;
 %<a href="#format_basic_type">llvm.dbg.basictype</a> = internal constant %<a href="#format_basic_type">llvm.dbg.basictype.type</a> {
-    uint 36
+    uint add(uint 36, uint 262144)
     {  }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to {  }*), 
     sbyte* getelementptr ([13 x sbyte]* %str1, int 0, int 0), 
     {  }* null, 
@@ -1595,7 +1597,7 @@ struct Color {
 ;; Define composite type for struct Color.
 ;;
 %<a href="#format_composite_type">llvm.dbg.compositetype</a> = internal constant %<a href="#format_composite_type">llvm.dbg.compositetype.type</a> {
-    uint 19
+    uint add(uint 19, uint 262144)
     {  }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to {  }*), 
     sbyte* getelementptr ([6 x sbyte]* %str2, int 0, int 0), 
     {  }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to {  }*), 
@@ -1604,7 +1606,6 @@ struct Color {
     uint 32, 
     uint 0, 
     {  }* null,
-    bool false,
     {  }* cast ([3 x {  }*]* %llvm.dbg.array to {  }*) }, section "llvm.metadata"
 %str2 = internal constant [6 x sbyte] c"Color\00", section "llvm.metadata"
 
@@ -1612,7 +1613,7 @@ struct Color {
 ;; Define the Red field.
 ;;
 %<a href="#format_derived_type">llvm.dbg.derivedtype1</a> = internal constant %<a href="#format_derived_type">llvm.dbg.derivedtype.type</a> {
-    uint 13
+    uint add(uint 13, uint 262144)
     {  }* null, 
     sbyte* getelementptr ([4 x sbyte]* %str3, int 0, int 0), 
     {  }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to {  }*), 
@@ -1627,7 +1628,7 @@ struct Color {
 ;; Define the Green field.
 ;;
 %<a href="#format_derived_type">llvm.dbg.derivedtype2</a> = internal constant %<a href="#format_derived_type">llvm.dbg.derivedtype.type</a> {
-    uint 13
+    uint add(uint 13, uint 262144)
     {  }* null, 
     sbyte* getelementptr ([6 x sbyte]* %str4, int 0, int 0), 
     {  }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to {  }*), 
@@ -1642,7 +1643,7 @@ struct Color {
 ;; Define the Blue field.
 ;;
 %<a href="#format_derived_type">llvm.dbg.derivedtype3</a> = internal constant %<a href="#format_derived_type">llvm.dbg.derivedtype.type</a> {
-    uint 13
+    uint add(uint 13, uint 262144)
     {  }* null, 
     sbyte* getelementptr ([5 x sbyte]* %str5, int 0, int 0), 
     {  }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to {  }*), 
@@ -1688,7 +1689,7 @@ enum Trees {
 ;; Define composite type for enum Trees
 ;;
 %<a href="#format_composite_type">llvm.dbg.compositetype</a> = internal constant %<a href="#format_composite_type">llvm.dbg.compositetype.type</a> {
-    uint 4
+    uint add(uint 4, uint 262144)
     {  }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to {  }*), 
     sbyte* getelementptr ([6 x sbyte]* %str1, int 0, int 0), 
     {  }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to {  }*), 
@@ -1697,7 +1698,6 @@ enum Trees {
     uint 32, 
     uint 0, 
     {  }* null, 
-    bool false,
     {  }* cast ([3 x {  }*]* %llvm.dbg.array to {  }*) }, section "llvm.metadata"
 %str1 = internal constant [6 x sbyte] c"Trees\00", section "llvm.metadata"
 
@@ -1705,7 +1705,7 @@ enum Trees {
 ;; Define Spruce enumerator.
 ;;
 %<a href="#format_enumeration">llvm.dbg.enumerator1</a> = internal constant %<a href="#format_enumeration">llvm.dbg.enumerator.type</a> {
-    uint 40
+    uint add(uint 40, uint 262144)
     sbyte* getelementptr ([7 x sbyte]* %str2, int 0, int 0), 
     int 100 }, section "llvm.metadata"
 %str2 = internal constant [7 x sbyte] c"Spruce\00", section "llvm.metadata"
@@ -1714,7 +1714,7 @@ enum Trees {
 ;; Define Oak enumerator.
 ;;
 %<a href="#format_enumeration">llvm.dbg.enumerator2</a> = internal constant %<a href="#format_enumeration">llvm.dbg.enumerator.type</a> {
-    uint 40
+    uint add(uint 40, uint 262144)
     sbyte* getelementptr ([4 x sbyte]* %str3, int 0, int 0), 
     int 200 }, section "llvm.metadata"
 %str3 = internal constant [4 x sbyte] c"Oak\00", section "llvm.metadata"
@@ -1723,7 +1723,7 @@ enum Trees {
 ;; Define Maple enumerator.
 ;;
 %<a href="#format_enumeration">llvm.dbg.enumerator3</a> = internal constant %<a href="#format_enumeration">llvm.dbg.enumerator.type</a> {
-    uint 40
+    uint add(uint 40, uint 262144)
     sbyte* getelementptr ([6 x sbyte]* %str4, int 0, int 0), 
     int 300 }, section "llvm.metadata"
 %str4 = internal constant [6 x sbyte] c"Maple\00", section "llvm.metadata"
index ba135def3f03012b743527c2b0f98a45b9f6a623..cd28c772502922d38a4d4056ca70aa6b5c07ba50 100644 (file)
@@ -57,7 +57,8 @@ class StructType;
 // Debug info constants.
 
 enum {
-  LLVMDebugVersion = 4                  // Current version of debug information.
+  LLVMDebugVersion = (4 << 16),         // Current version of debug information.
+  LLVMDebugVersionMask = 0xffff0000     // Mask for version number.
 };
 
 //===----------------------------------------------------------------------===//
@@ -90,25 +91,20 @@ public:
 ///
 class DebugInfoDesc {
 private:
-  enum {
-    tag_mask = 0x0000ffff,
-    version_shift = 16
-  };
-
-
   unsigned Tag;                         // Content indicator.  Dwarf values are
                                         // used but that does not limit use to
                                         // Dwarf writers.
   
 protected:
-  DebugInfoDesc(unsigned T) : Tag(T | (LLVMDebugVersion << version_shift)) {}
+  DebugInfoDesc(unsigned T) : Tag(T | LLVMDebugVersion) {}
   
 public:
   virtual ~DebugInfoDesc() {}
 
   // Accessors
-  unsigned getTag()          const { return Tag & tag_mask; }
-  unsigned getVersion()      const { return Tag >> version_shift; }
+  unsigned getTag()          const { return Tag & ~LLVMDebugVersionMask; }
+  unsigned getVersion()      const { return Tag &  LLVMDebugVersionMask; }
+  void setTag(unsigned T)          { Tag = T | LLVMDebugVersion; }
   
   /// TagFromGlobal - Returns the tag number from a debug info descriptor
   /// GlobalVariable.   Return DIIValid if operand is not an unsigned int. 
@@ -199,7 +195,7 @@ public:
 /// descriptors.
 class AnchoredDesc : public DebugInfoDesc {
 private:  
-  AnchorDesc *Anchor;                   // Anchor for all descriptors of the
+  DebugInfoDesc *Anchor;                // Anchor for all descriptors of the
                                         // same type.
 
 protected:
@@ -208,8 +204,8 @@ protected:
 
 public:  
   // Accessors.
-  AnchorDesc *getAnchor() const { return Anchor; }
-  void setAnchor(AnchorDesc *A) { Anchor = A; }
+  AnchorDesc *getAnchor() const { return static_cast<AnchorDesc *>(Anchor); }
+  void setAnchor(AnchorDesc *A) { Anchor = static_cast<DebugInfoDesc *>(A); }
 
   //===--------------------------------------------------------------------===//
   // Subclasses should supply the following virtual methods.
@@ -282,7 +278,7 @@ class TypeDesc : public DebugInfoDesc {
 private:
   DebugInfoDesc *Context;               // Context debug descriptor.
   std::string Name;                     // Type name (may be empty.)
-  CompileUnitDesc *File;                // Defined compile unit (may be NULL.)
+  DebugInfoDesc *File;                  // Defined compile unit (may be NULL.)
   unsigned Line;                        // Defined line# (may be zero.)
   uint64_t Size;                        // Type bit size (may be zero.)
   uint64_t Align;                       // Type bit alignment (may be zero.)
@@ -294,14 +290,18 @@ public:
   // Accessors
   DebugInfoDesc *getContext()                const { return Context; }
   const std::string &getName()               const { return Name; }
-  CompileUnitDesc *getFile()                 const { return File; }
+  CompileUnitDesc *getFile() const {
+    return static_cast<CompileUnitDesc *>(File);
+  }
   unsigned getLine()                         const { return Line; }
   uint64_t getSize()                         const { return Size; }
   uint64_t getAlign()                        const { return Align; }
   uint64_t getOffset()                       const { return Offset; }
   void setContext(DebugInfoDesc *C)                { Context = C; }
   void setName(const std::string &N)               { Name = N; }
-  void setFile(CompileUnitDesc *U)                 { File = U; }
+  void setFile(CompileUnitDesc *U) {
+    File = static_cast<DebugInfoDesc *>(U);
+  }
   void setLine(unsigned L)                         { Line = L; }
   void setSize(uint64_t S)                         { Size = S; }
   void setAlign(uint64_t A)                        { Align = A; }
@@ -365,14 +365,18 @@ public:
 /// derived types (eg., typedef, pointer, reference.)
 class DerivedTypeDesc : public TypeDesc {
 private:
-  TypeDesc *FromType;                   // Type derived from.
+  DebugInfoDesc *FromType;              // Type derived from.
 
 public:
   DerivedTypeDesc(unsigned T);
   
   // Accessors
-  TypeDesc *getFromType()                    const { return FromType; }
-  void setFromType(TypeDesc *F)                    { FromType = F; }
+  TypeDesc *getFromType() const {
+    return static_cast<TypeDesc *>(FromType);
+  }
+  void setFromType(TypeDesc *F) {
+    FromType = static_cast<DebugInfoDesc *>(F);
+  }
 
   // Implement isa/cast/dyncast.
   static bool classof(const DerivedTypeDesc *) { return true; }
@@ -400,16 +404,13 @@ public:
 /// array/struct types (eg., arrays, struct, union, enums.)
 class CompositeTypeDesc : public DerivedTypeDesc {
 private:
-  bool IsVector;                        // packed/vector array
   std::vector<DebugInfoDesc *> Elements;// Information used to compose type.
 
 public:
   CompositeTypeDesc(unsigned T);
   
   // Accessors
-  bool isVector() const { return IsVector; }
   std::vector<DebugInfoDesc *> &getElements() { return Elements; }
-  void setIsVector() { IsVector = true; }
 
   // Implement isa/cast/dyncast.
   static bool classof(const CompositeTypeDesc *) { return true; }
@@ -516,9 +517,9 @@ class VariableDesc : public DebugInfoDesc {
 private:
   DebugInfoDesc *Context;               // Context debug descriptor.
   std::string Name;                     // Type name (may be empty.)
-  CompileUnitDesc *File;                // Defined compile unit (may be NULL.)
+  DebugInfoDesc *File;                  // Defined compile unit (may be NULL.)
   unsigned Line;                        // Defined line# (may be zero.)
-  TypeDesc *TyDesc;                     // Type of variable.
+  DebugInfoDesc *TyDesc;                // Type of variable.
 
 public:
   VariableDesc(unsigned T);
@@ -526,14 +527,22 @@ public:
   // Accessors
   DebugInfoDesc *getContext()                const { return Context; }
   const std::string &getName()               const { return Name; }
-  CompileUnitDesc *getFile()                 const { return File; }
+  CompileUnitDesc *getFile() const {
+    return static_cast<CompileUnitDesc *>(File);
+  }
   unsigned getLine()                         const { return Line; }
-  TypeDesc *getType()                        const { return TyDesc; }
+  TypeDesc *getType() const {
+    return static_cast<TypeDesc *>(TyDesc);
+  }
   void setContext(DebugInfoDesc *C)                { Context = C; }
   void setName(const std::string &N)               { Name = N; }
-  void setFile(CompileUnitDesc *U)                 { File = U; }
+  void setFile(CompileUnitDesc *U) {
+    File = static_cast<DebugInfoDesc *>(U);
+  }
   void setLine(unsigned L)                         { Line = L; }
-  void setType(TypeDesc *T)                        { TyDesc = T; }
+  void setType(TypeDesc *T) {
+    TyDesc = static_cast<DebugInfoDesc *>(T);
+  }
   
   // Implement isa/cast/dyncast.
   static bool classof(const VariableDesc *) { return true; }
@@ -563,9 +572,9 @@ class GlobalDesc : public AnchoredDesc {
 private:
   DebugInfoDesc *Context;               // Context debug descriptor.
   std::string Name;                     // Global name.
-  CompileUnitDesc *File;                // Defined compile unit (may be NULL.)
+  DebugInfoDesc *File;                  // Defined compile unit (may be NULL.)
   unsigned Line;                        // Defined line# (may be zero.)
-  TypeDesc *TyDesc;                     // Type debug descriptor.
+  DebugInfoDesc *TyDesc;                // Type debug descriptor.
   bool IsStatic;                        // Is the global a static.
   bool IsDefinition;                    // Is the global defined in context.
   
@@ -576,16 +585,24 @@ public:
   // Accessors
   DebugInfoDesc *getContext()                const { return Context; }
   const std::string &getName()               const { return Name; }
-  CompileUnitDesc *getFile()                 const { return File; }
+  CompileUnitDesc *getFile() const {
+    return static_cast<CompileUnitDesc *>(File);
+  }
   unsigned getLine()                         const { return Line; }
-  TypeDesc *getType()                        const { return TyDesc; }
+  TypeDesc *getType() const {
+    return static_cast<TypeDesc *>(TyDesc);
+  }
   bool isStatic()                            const { return IsStatic; }
   bool isDefinition()                        const { return IsDefinition; }
   void setContext(DebugInfoDesc *C)                { Context = C; }
   void setName(const std::string &N)               { Name = N; }
-  void setFile(CompileUnitDesc *U)                 { File = U; }
+  void setFile(CompileUnitDesc *U) {
+    File = static_cast<DebugInfoDesc *>(U);
+  }
   void setLine(unsigned L)                         { Line = L; }
-  void setType(TypeDesc *T)                        { TyDesc = T; }
+  void setType(TypeDesc *T) {
+    TyDesc = static_cast<DebugInfoDesc *>(T);
+  }
   void setIsStatic(bool IS)                        { IsStatic = IS; }
   void setIsDefinition(bool ID)                    { IsDefinition = ID; }
 
index 49a7d3de990f1affceec88bbdb250895036de525..17622f4515810705f572547257221e4d9b95466e 100644 (file)
@@ -37,6 +37,8 @@ enum llvm_dwarf_constants {
   DW_TAG_arg_variable = 0x101,          // Tag for argument variables.
   DW_TAG_return_variable = 0x102,       // Tag for return variables.
   
+  DW_TAG_vector_type = 0x103,           // Tag for vector types.
+  
   DW_TAG_user_base = 0x1000,            // Recommended base for user tags.
   
   DW_CIE_VERSION = 1,                   // Common frame information version.
index 7805bbcbbf02122026d1eff64455f33513fa8b96..b384b416a42639b42c23e8b1cc53d6d3e9a4c6ce 100644 (file)
@@ -1276,11 +1276,18 @@ DIE *DwarfWriter::NewType(DIE *Context, TypeDesc *TyDesc, CompileUnit *Unit) {
                      NewType(Context, FromTy, Unit));
     }
   } else if (CompositeTypeDesc *CompTy = dyn_cast<CompositeTypeDesc>(TyDesc)) {
+    // Fetch tag
+    unsigned Tag = CompTy->getTag();
+    
     // Create specific DIE.
-    Slot = Ty = new DIE(CompTy->getTag());
+    Slot = Ty = Tag == DW_TAG_vector_type ? new DIE(DW_TAG_array_type) :
+                                            new DIE(Tag);
+    
     std::vector<DebugInfoDesc *> &Elements = CompTy->getElements();
     
-    switch (CompTy->getTag()) {
+    switch (Tag) {
+    case DW_TAG_vector_type: Ty->AddUInt(DW_AT_GNU_vector, DW_FORM_flag, 1);
+      // Fall thru
     case DW_TAG_array_type: {
       // Add element type.
       if (TypeDesc *FromTy = CompTy->getFromType()) {
@@ -1288,11 +1295,6 @@ DIE *DwarfWriter::NewType(DIE *Context, TypeDesc *TyDesc, CompileUnit *Unit) {
                        NewType(Context, FromTy, Unit));
       }
       
-      // check for vector type
-      if (CompTy->isVector()) {
-        Ty->AddUInt(DW_AT_GNU_vector, DW_FORM_flag, 1);
-      }
-      
       // Don't emit size attribute.
       Size = 0;
       
index a3013e9608ec7ad446290e52cbcb9ec1e02ac78c..97fecb482ba300a3a65725eb35c790800e6675b1 100644 (file)
@@ -459,7 +459,8 @@ public:
 /// GlobalVariable.   Return DIIValid if operand is not an unsigned int. 
 unsigned DebugInfoDesc::TagFromGlobal(GlobalVariable *GV) {
   ConstantUInt *C = getUIntOperand(GV, 0);
-  return C ? ((unsigned)C->getValue() & tag_mask) : (unsigned)DW_TAG_invalid;
+  return C ? ((unsigned)C->getValue() & ~LLVMDebugVersionMask) :
+             (unsigned)DW_TAG_invalid;
 }
 
 /// VersionFromGlobal - Returns the version number from a debug info
@@ -467,7 +468,7 @@ unsigned DebugInfoDesc::TagFromGlobal(GlobalVariable *GV) {
 /// int.
 unsigned  DebugInfoDesc::VersionFromGlobal(GlobalVariable *GV) {
   ConstantUInt *C = getUIntOperand(GV, 0);
-  return C ? ((unsigned)C->getValue() >> version_shift) :
+  return C ? ((unsigned)C->getValue() & LLVMDebugVersionMask) :
              (unsigned)DW_TAG_invalid;
 }
 
@@ -491,7 +492,8 @@ DebugInfoDesc *DebugInfoDesc::DescFactory(unsigned Tag) {
   case DW_TAG_array_type:
   case DW_TAG_structure_type:
   case DW_TAG_union_type:
-  case DW_TAG_enumeration_type: return new CompositeTypeDesc(Tag);
+  case DW_TAG_enumeration_type:
+  case DW_TAG_vector_type:      return new CompositeTypeDesc(Tag);
   case DW_TAG_subrange_type:    return new SubrangeDesc();
   case DW_TAG_enumerator:       return new EnumeratorDesc();
   case DW_TAG_return_variable:
@@ -590,9 +592,7 @@ AnchoredDesc::AnchoredDesc(unsigned T)
 void AnchoredDesc::ApplyToFields(DIVisitor *Visitor) {
   DebugInfoDesc::ApplyToFields(Visitor);
 
-  DebugInfoDesc *Tmp = Anchor;
-  Visitor->Apply(Tmp);
-  Anchor = (AnchorDesc*)Tmp;
+  Visitor->Apply(Anchor);
 }
 
 //===----------------------------------------------------------------------===//
@@ -673,9 +673,7 @@ void TypeDesc::ApplyToFields(DIVisitor *Visitor) {
   
   Visitor->Apply(Context);
   Visitor->Apply(Name);
-  DebugInfoDesc* Tmp = File;
-  Visitor->Apply(Tmp);
-  File = (CompileUnitDesc*)Tmp;
+  Visitor->Apply(File);
   Visitor->Apply(Line);
   Visitor->Apply(Size);
   Visitor->Apply(Align);
@@ -782,9 +780,7 @@ bool DerivedTypeDesc::classof(const DebugInfoDesc *D) {
 void DerivedTypeDesc::ApplyToFields(DIVisitor *Visitor) {
   TypeDesc::ApplyToFields(Visitor);
   
-  DebugInfoDesc* Tmp = FromType;
-  Visitor->Apply(Tmp);
-  FromType = (TypeDesc*)Tmp;
+  Visitor->Apply(FromType);
 }
 
 /// getDescString - Return a string used to compose global names and labels.
@@ -817,7 +813,6 @@ void DerivedTypeDesc::dump() {
 
 CompositeTypeDesc::CompositeTypeDesc(unsigned T)
 : DerivedTypeDesc(T)
-, IsVector(false)
 , Elements()
 {}
   
@@ -829,6 +824,7 @@ bool CompositeTypeDesc::classof(const DebugInfoDesc *D) {
   case DW_TAG_structure_type:
   case DW_TAG_union_type:
   case DW_TAG_enumeration_type:
+  case DW_TAG_vector_type:
     return true;
   default: break;
   }
@@ -838,9 +834,8 @@ bool CompositeTypeDesc::classof(const DebugInfoDesc *D) {
 /// ApplyToFields - Target the visitor to the fields of the CompositeTypeDesc.
 ///
 void CompositeTypeDesc::ApplyToFields(DIVisitor *Visitor) {
-  DerivedTypeDesc::ApplyToFields(Visitor);
-  
-  Visitor->Apply(IsVector);
+  DerivedTypeDesc::ApplyToFields(Visitor);  
+
   Visitor->Apply(Elements);
 }
 
@@ -990,13 +985,9 @@ void VariableDesc::ApplyToFields(DIVisitor *Visitor) {
   
   Visitor->Apply(Context);
   Visitor->Apply(Name);
-  DebugInfoDesc* Tmp1 = File;
-  Visitor->Apply(Tmp1);
-  File = (CompileUnitDesc*)Tmp1;
+  Visitor->Apply(File);
   Visitor->Apply(Line);
-  DebugInfoDesc* Tmp2 = TyDesc;
-  Visitor->Apply(Tmp2);
-  TyDesc = (TypeDesc*)Tmp2;
+  Visitor->Apply(TyDesc);
 }
 
 /// getDescString - Return a string used to compose global names and labels.
@@ -1044,13 +1035,9 @@ void GlobalDesc::ApplyToFields(DIVisitor *Visitor) {
 
   Visitor->Apply(Context);
   Visitor->Apply(Name);
-  DebugInfoDesc* Tmp1 = File;
-  Visitor->Apply(Tmp1);
-  File = (CompileUnitDesc*)Tmp1;
+  Visitor->Apply(File);
   Visitor->Apply(Line);
-  DebugInfoDesc* Tmp2 = TyDesc;
-  Visitor->Apply(Tmp2);
-  TyDesc = (TypeDesc*)Tmp2;
+  Visitor->Apply(TyDesc);
   Visitor->Apply(IsStatic);
   Visitor->Apply(IsDefinition);
 }