OSDN Git Service

2002-02-26 Aldy Hernandez <aldyh@redhat.com>
authoraldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 26 Feb 2002 06:58:01 +0000 (06:58 +0000)
committeraldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 26 Feb 2002 06:58:01 +0000 (06:58 +0000)
        * dwarf2out.c (modified_type_die): Do not call type_main_variant
        for vectors.
        (gen_type_die): Same.

        * attribs.c (handle_vector_size_attribute): Set debug information.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@50048 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/attribs.c
gcc/dwarf2out.c

index 98b2074..c3ab894 100644 (file)
@@ -1,3 +1,11 @@
+2002-02-26  Aldy Hernandez  <aldyh@redhat.com>
+
+        * dwarf2out.c (modified_type_die): Do not call type_main_variant
+        for vectors.
+        (gen_type_die): Same.
+
+        * attribs.c (handle_vector_size_attribute): Set debug information.
+
 2002-02-26  Daniel Egger  <degger@fhm.edu>
 
         * config/rs6000/rs6000.md: Swap define_insn attributes to
index b915c88..d046a62 100644 (file)
@@ -1307,12 +1307,33 @@ handle_vector_size_attribute (node, name, args, flags, no_add_attrs)
     error ("no vector mode with the size and type specified could be found");
   else
     {
+      tree index, array, rt;
+
       new_type = type_for_mode (new_mode, TREE_UNSIGNED (type));
+
       if (!new_type)
-       error ("no vector mode with the size and type specified could be found");
-      else
-       /* Build back pointers if needed.  */
-       *node = vector_size_helper (*node, new_type);
+       {
+         error ("no vector mode with the size and type specified could be found");
+         return NULL_TREE;
+       }
+
+      new_type = build_type_copy (new_type);
+
+      /* Set the debug information here, because this is the only
+        place where we know the underlying type for a vector made
+        with vector_size.  For debugging purposes we pretend a vector
+        is an array within a structure.  */
+      index = build_int_2 (TYPE_VECTOR_SUBPARTS (new_type) - 1, 0);
+      array = build_array_type (type, build_index_type (index));
+      rt = make_node (RECORD_TYPE);
+
+      TYPE_FIELDS (rt) = build_decl (FIELD_DECL, get_identifier ("f"), array);
+      DECL_CONTEXT (TYPE_FIELDS (rt)) = rt;
+      layout_type (rt);
+      TYPE_DEBUG_REPRESENTATION_TYPE (new_type) = rt;
+
+      /* Build back pointers if needed.  */
+      *node = vector_size_helper (*node, new_type);
     }
     
   return NULL_TREE;
index 8d7d48b..6313aeb 100644 (file)
@@ -7565,7 +7565,12 @@ modified_type_die (type, is_const_type, is_volatile_type, context_die)
             copy was created to help us keep track of typedef names) and
             that copy might have a different TYPE_UID from the original
             ..._TYPE node.  */
-         mod_type_die = lookup_type_die (type_main_variant (type));
+         if (TREE_CODE (type) != VECTOR_TYPE)
+           mod_type_die = lookup_type_die (type_main_variant (type));
+         else
+           /* Vectors have the debugging information in the type,
+              not the main variant.  */
+           mod_type_die = lookup_type_die (type);
          if (mod_type_die == NULL)
            abort ();
        }
@@ -10976,10 +10981,13 @@ gen_type_die (type, context_die)
   if (type == NULL_TREE || type == error_mark_node)
     return;
 
-  /* We are going to output a DIE to represent the unqualified version of
-     this type (i.e. without any const or volatile qualifiers) so get the
-     main variant (i.e. the unqualified version) of this type now.  */
-  type = type_main_variant (type);
+  /* We are going to output a DIE to represent the unqualified version
+     of this type (i.e. without any const or volatile qualifiers) so
+     get the main variant (i.e. the unqualified version) of this type
+     now.  (Vectors are special because the debugging info is in the
+     cloned type itself).  */
+  if (TREE_CODE (type) != VECTOR_TYPE)
+    type = type_main_variant (type);
 
   if (TREE_ASM_WRITTEN (type))
     return;