Vector support: type node creation & debugging support
authorBernd Schmidt <bernds@cygnus.co.uk>
Sun, 25 Jun 2000 17:27:28 +0000 (17:27 +0000)
committerBernd Schmidt <crux@gcc.gnu.org>
Sun, 25 Jun 2000 17:27:28 +0000 (17:27 +0000)
From-SVN: r34696

gcc/ChangeLog
gcc/c-common.c
gcc/dbxout.c
gcc/dwarf.h
gcc/dwarf2out.c
gcc/dwarfout.c
gcc/tm.texi
gcc/tree.c
gcc/tree.h

index 134e773cfb58b5c14944f225262ec084d54d5f82..b7695987aa57d3fb61802bc2968f142c61b2a30c 100644 (file)
@@ -1,3 +1,22 @@
+2000-06-24  Bernd Schmidt  <bernds@cygnus.co.uk>
+
+       * tree.h (enum tree_index): Add vector type nodes.
+       Add accessor macros for them.
+       (TYPE_REPRESENATION_TYPE): New macro.
+       * tree.c (build_common_tree_nodes_2): Build these nodes.
+       (finish_vector_type): New function.
+       * c-common.c (type_for_mode): Handle vector modes.
+       * tm.texi (VECTOR_MODE_SUPPORTED_P): Document.
+
+       * dbxout.c (dbxout_type): Handle VECTOR_TYPEs.
+       * dwarf.h (enum dwarf_fundamental_type): Add 128 bit integers.
+       * dwarf2out.c (lookup_type_die): Handle VECTOR_TYPEs.
+       (gen_type_die): Likewise.
+       * dwarfout.c (dwarf_fund_type_name): Handle 128 bit integers.
+       (fundamental_type_code): Likewise.
+       (type_is_fundamental): VECTOR_TYPEs aren't.
+       (output_type): Handle VECTOR_TYPEs.
+
 2000-06-25  Kazu Hirata  <kazu@hxi.com>
 
        * config/arm.c: Fix a comment typo.
index 2f25a6765f16b4ce9e538fa32bd7f8cb21df3465..b28284c011e862f75fb41a18ee06b94d31b2f0f9 100644 (file)
@@ -2296,6 +2296,19 @@ type_for_mode (mode, unsignedp)
   if (mode == TYPE_MODE (build_pointer_type (integer_type_node)))
     return build_pointer_type (integer_type_node);
 
+#ifdef VECTOR_MODE_SUPPORTED_P
+  if (mode == TYPE_MODE (V4SF_type_node) && VECTOR_MODE_SUPPORTED_P (mode))
+    return V4SF_type_node;
+  if (mode == TYPE_MODE (V4SI_type_node) && VECTOR_MODE_SUPPORTED_P (mode))
+    return V4SI_type_node;
+  if (mode == TYPE_MODE (V2SI_type_node) && VECTOR_MODE_SUPPORTED_P (mode))
+    return V2SI_type_node;
+  if (mode == TYPE_MODE (V4HI_type_node) && VECTOR_MODE_SUPPORTED_P (mode))
+    return V4HI_type_node;
+  if (mode == TYPE_MODE (V8QI_type_node) && VECTOR_MODE_SUPPORTED_P (mode))
+    return V8QI_type_node;
+#endif
+
   return 0;
 }
 
index f0b9860df07da36be647805ce4791362c01f0307..b2ce424e6e2b53c9257047b3ccfdba0b49d23aa5 100644 (file)
@@ -1003,6 +1003,9 @@ dbxout_type (type, full, show_arg_types)
   register tree tem;
   static int anonymous_type_number = 0;
 
+  if (TREE_CODE (type) == VECTOR_TYPE)
+    type = TYPE_DEBUG_REPRESENTATION_TYPE (type);
+
   /* If there was an input error and we don't really have a type,
      avoid crashing and write something that is at least valid
      by assuming `int'.  */
index 6aca017e6e511dd176a40332f5a66b76b320f77b..3928574a3f16c5ed000f1c46c9c64c1c5b1e913f 100644 (file)
@@ -237,6 +237,9 @@ enum dwarf_fundamental_type {
     FT_int64           = 0x9908,
     FT_signed_int64    = 0x9a08,
     FT_unsigned_int64  = 0x9b08,
+    FT_int128          = 0x9c10,
+    FT_signed_int128   = 0x9d10,
+    FT_unsigned_int128 = 0x9e10,
 
     FT_real32          = 0xa004,
     FT_real64          = 0xa108,
index 58be8c47616a7fd3a61c63b6bbcd9681b08262af..9757a631d5927675e825d36de7d0ab8337abddbc 100644 (file)
@@ -4118,6 +4118,8 @@ static inline dw_die_ref
 lookup_type_die (type)
      register tree type;
 {
+  if (TREE_CODE (type) == VECTOR_TYPE)
+    type = TYPE_DEBUG_REPRESENTATION_TYPE (type);
   return (dw_die_ref) TYPE_SYMTAB_POINTER (type);
 }
 
@@ -9065,6 +9067,10 @@ gen_type_die (type, context_die)
        gen_array_type_die (type, context_die);
       break;
 
+    case VECTOR_TYPE:
+      gen_type_die (TYPE_DEBUG_REPRESENTATION_TYPE (type), context_die);
+      break;
+
     case ENUMERAL_TYPE:
     case RECORD_TYPE:
     case UNION_TYPE:
index aaa3d1e5dcbc06772c5d586bb6e8236d193ac5c8..af1337f4ce83f364ed8ef44aaef3a68ad198030d 100644 (file)
@@ -1135,6 +1135,9 @@ dwarf_fund_type_name (ft)
     case FT_int64:             return "FT_int64";
     case FT_signed_int64:      return "FT_signed_int64";
     case FT_unsigned_int64:    return "FT_unsigned_int64";
+    case FT_int128:            return "FT_int128";
+    case FT_signed_int128:     return "FT_signed_int128";
+    case FT_unsigned_int128:   return "FT_unsigned_int128";
 
     case FT_real32:            return "FT_real32";
     case FT_real64:            return "FT_real64";
@@ -1366,6 +1369,9 @@ fundamental_type_code (type)
        if (TYPE_PRECISION (type) == CHAR_TYPE_SIZE)
          return (TREE_UNSIGNED (type) ? FT_unsigned_char : FT_char);
 
+       if (TYPE_MODE (type) == TImode)
+         return (TREE_UNSIGNED (type) ? FT_unsigned_int128 : FT_int128);
+
        /* In C++, __java_boolean is an INTEGER_TYPE with precision == 1 */
        if (TYPE_PRECISION (type) == 1)
          return FT_boolean;
@@ -1554,6 +1560,7 @@ type_is_fundamental (type)
       case FILE_TYPE:
       case OFFSET_TYPE:
       case LANG_TYPE:
+      case VECTOR_TYPE:
        return 0;
 
       default:
@@ -4302,6 +4309,10 @@ output_type (type, containing_scope)
       case ERROR_MARK:
        break;
 
+      case VECTOR_TYPE:
+       output_type (TYPE_DEBUG_REPRESENTATION_TYPE (type), containing_scope);
+       break;
+
       case POINTER_TYPE:
       case REFERENCE_TYPE:
        /* Prevent infinite recursion in cases where this is a recursive
index 458b9ba50fe4c249973a886963293c98e210eb23..008ee50e0d16f863c0de4b24a2276ee0efffdedf 100644 (file)
@@ -1043,6 +1043,12 @@ this size or smaller can be used for structures and unions with the
 appropriate sizes.  If this macro is undefined, @code{GET_MODE_BITSIZE
 (DImode)} is assumed.
 
+@findex VECTOR_MODE_SUPPORTED_P
+@item VECTOR_MODE_SUPPORTED_P(@var{mode})
+Define this macro to be nonzero if the port is prepared to handle insns
+involving vector mode @var{mode}.  At the very least, it must have move
+patterns for this mode.
+
 @findex STACK_SAVEAREA_MODE
 @item STACK_SAVEAREA_MODE (@var{save_level})
 If defined, an expression of type @code{enum machine_mode} that
index 933bba81fd5df6c105a1f0275541015067d70fca..e1551c56338ed3eb994ad931d0f1c1c61e345b35 100644 (file)
@@ -5613,6 +5613,32 @@ tree_class_check_failed (node, cl, file, line, function)
 #endif /* ENABLE_TREE_CHECKING */
 
 \f
+/* For a new vector type node T, build the information necessary for
+   debuggint output.  */
+static void
+finish_vector_type (t)
+     tree t;
+{
+  layout_type (t);
+
+  {
+    tree index = build_int_2 (TYPE_VECTOR_SUBPARTS (t) - 1, 0);
+    tree array = build_array_type (TREE_TYPE (t),
+                                  build_index_type (index));
+    tree 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 (t) = rt;
+    /* In dwarfout.c, type lookup uses TYPE_UID numbers.  We want to output
+       the representation type, and we want to find that die when looking up
+       the vector type.  This is most easily achieved by making the TYPE_UID
+       numbers equal.  */
+    TYPE_UID (rt) = TYPE_UID (t);
+  }
+}
+
 #ifndef CHAR_TYPE_SIZE
 #define CHAR_TYPE_SIZE BITS_PER_UNIT
 #endif
@@ -5764,4 +5790,29 @@ build_common_tree_nodes_2 (short_double)
 #else
   va_list_type_node = ptr_type_node;
 #endif
+
+  V4SF_type_node = make_node (VECTOR_TYPE);
+  TREE_TYPE (V4SF_type_node) = float_type_node;
+  TYPE_MODE (V4SF_type_node) = V4SFmode;
+  finish_vector_type (V4SF_type_node);
+
+  V4SI_type_node = make_node (VECTOR_TYPE);
+  TREE_TYPE (V4SI_type_node) = intSI_type_node;
+  TYPE_MODE (V4SI_type_node) = V4SImode;
+  finish_vector_type (V4SI_type_node);
+
+  V2SI_type_node = make_node (VECTOR_TYPE);
+  TREE_TYPE (V2SI_type_node) = intSI_type_node;
+  TYPE_MODE (V2SI_type_node) = V2SImode;
+  finish_vector_type (V2SI_type_node);
+
+  V4HI_type_node = make_node (VECTOR_TYPE);
+  TREE_TYPE (V4HI_type_node) = intHI_type_node;
+  TYPE_MODE (V4HI_type_node) = V4HImode;
+  finish_vector_type (V4HI_type_node);
+
+  V8QI_type_node = make_node (VECTOR_TYPE);
+  TREE_TYPE (V8QI_type_node) = intQI_type_node;
+  TYPE_MODE (V8QI_type_node) = V8QImode;
+  finish_vector_type (V8QI_type_node);
 }
index f683357f1482c632b60d5258db0e273c04d4d908..bb6602c0f53757ccd35adad8e0dde741cb39b817 100644 (file)
@@ -887,6 +887,11 @@ struct tree_block
 #define TYPE_OBSTACK(NODE) (TYPE_CHECK (NODE)->type.obstack)
 #define TYPE_LANG_SPECIFIC(NODE) (TYPE_CHECK (NODE)->type.lang_specific)
 
+/* For a VECTOR_TYPE node, this describes a different type which is emitted
+   in the debugging output.  We use this to describe a vector as a
+   structure containing an array.  */
+#define TYPE_DEBUG_REPRESENTATION_TYPE(NODE) (TYPE_CHECK (NODE)->type.values)
+
 /* Indirect types present difficulties because they may be represented
    as either POINTER_TYPE/REFERENCE_TYPE nodes (unbounded) or as
    RECORD_TYPE nodes (bounded).  Bounded and unbounded pointers might
@@ -1722,6 +1727,12 @@ enum tree_index
   TI_PTRDIFF_TYPE,
   TI_VA_LIST_TYPE,
 
+  TI_V4SF_TYPE,
+  TI_V4SI_TYPE,
+  TI_V8QI_TYPE,
+  TI_V4HI_TYPE,
+  TI_V2SI_TYPE,
+
   TI_MAX
 };
 
@@ -1768,6 +1779,12 @@ extern tree global_trees[TI_MAX];
 #define ptrdiff_type_node              global_trees[TI_PTRDIFF_TYPE]
 #define va_list_type_node              global_trees[TI_VA_LIST_TYPE]
 
+#define V4SF_type_node                 global_trees[TI_V4SF_TYPE]
+#define V4SI_type_node                 global_trees[TI_V4SI_TYPE]
+#define V8QI_type_node                 global_trees[TI_V8QI_TYPE]
+#define V4HI_type_node                 global_trees[TI_V4HI_TYPE]
+#define V2SI_type_node                 global_trees[TI_V2SI_TYPE]
+
 /* An enumeration of the standard C integer types.  These must be
    ordered so that shorter types appear before longer ones.  */
 enum integer_type_kind