From 4061f623a6ab220259c77be5f97617a05aa67d51 Mon Sep 17 00:00:00 2001 From: Bernd Schmidt Date: Sun, 25 Jun 2000 17:27:28 +0000 Subject: [PATCH] Vector support: type node creation & debugging support From-SVN: r34696 --- gcc/ChangeLog | 19 ++++++++++++++++++ gcc/c-common.c | 13 +++++++++++++ gcc/dbxout.c | 3 +++ gcc/dwarf.h | 3 +++ gcc/dwarf2out.c | 6 ++++++ gcc/dwarfout.c | 11 +++++++++++ gcc/tm.texi | 6 ++++++ gcc/tree.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++ gcc/tree.h | 17 +++++++++++++++++ 9 files changed, 129 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 134e773cfb5..b7695987aa5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,22 @@ +2000-06-24 Bernd Schmidt + + * 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 * config/arm.c: Fix a comment typo. diff --git a/gcc/c-common.c b/gcc/c-common.c index 2f25a6765f1..b28284c011e 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -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; } diff --git a/gcc/dbxout.c b/gcc/dbxout.c index f0b9860df07..b2ce424e6e2 100644 --- a/gcc/dbxout.c +++ b/gcc/dbxout.c @@ -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'. */ diff --git a/gcc/dwarf.h b/gcc/dwarf.h index 6aca017e6e5..3928574a3f1 100644 --- a/gcc/dwarf.h +++ b/gcc/dwarf.h @@ -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, diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 58be8c47616..9757a631d59 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -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: diff --git a/gcc/dwarfout.c b/gcc/dwarfout.c index aaa3d1e5dcb..af1337f4ce8 100644 --- a/gcc/dwarfout.c +++ b/gcc/dwarfout.c @@ -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 diff --git a/gcc/tm.texi b/gcc/tm.texi index 458b9ba50fe..008ee50e0d1 100644 --- a/gcc/tm.texi +++ b/gcc/tm.texi @@ -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 diff --git a/gcc/tree.c b/gcc/tree.c index 933bba81fd5..e1551c56338 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -5613,6 +5613,32 @@ tree_class_check_failed (node, cl, file, line, function) #endif /* ENABLE_TREE_CHECKING */ +/* 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); } diff --git a/gcc/tree.h b/gcc/tree.h index f683357f148..bb6602c0f53 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -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 -- 2.30.2