Vector support part 3: type node creation; debugging
Bernd Schmidt
bernds@masala.cygnus.co.uk
Sat Jun 24 12:56:00 GMT 2000
This part takes care of creating vector type nodes, and of generating
debug information for them. We pretend to the debugger that a vector
is a structure.
Vector types can be accessed from C by using __attribute__ ((mode)),
this is achieved by the c-common.c patch.
OK if it bootstraps?
Bernd
* 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.
Index: c-common.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/c-common.c,v
retrieving revision 1.120
diff -c -p -r1.120 c-common.c
*** c-common.c 2000/06/18 13:09:26 1.120
--- c-common.c 2000/06/24 19:41:46
*************** type_for_mode (mode, unsignedp)
*** 2296,2301 ****
--- 2296,2314 ----
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: dbxout.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/dbxout.c,v
retrieving revision 1.57
diff -c -p -r1.57 dbxout.c
*** dbxout.c 2000/06/08 14:33:04 1.57
--- dbxout.c 2000/06/24 19:41:48
*************** dbxout_type (type, full, show_arg_types)
*** 1003,1008 ****
--- 1003,1011 ----
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: dwarf.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/dwarf.h,v
retrieving revision 1.3
diff -c -p -r1.3 dwarf.h
*** dwarf.h 1998/12/16 20:54:59 1.3
--- dwarf.h 2000/06/24 19:41:49
*************** enum dwarf_fundamental_type {
*** 237,242 ****
--- 237,245 ----
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: dwarf2out.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/dwarf2out.c,v
retrieving revision 1.177
diff -c -p -r1.177 dwarf2out.c
*** dwarf2out.c 2000/06/08 22:33:18 1.177
--- dwarf2out.c 2000/06/24 19:41:59
*************** static inline dw_die_ref
*** 4118,4123 ****
--- 4118,4125 ----
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);
}
*************** gen_type_die (type, context_die)
*** 9063,9068 ****
--- 9065,9074 ----
}
else
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:
Index: dwarfout.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/dwarfout.c,v
retrieving revision 1.68
diff -c -p -r1.68 dwarfout.c
*** dwarfout.c 2000/05/23 17:42:18 1.68
--- dwarfout.c 2000/06/24 19:42:06
*************** dwarf_fund_type_name (ft)
*** 1135,1140 ****
--- 1135,1143 ----
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";
*************** fundamental_type_code (type)
*** 1366,1371 ****
--- 1369,1377 ----
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;
*************** type_is_fundamental (type)
*** 1554,1559 ****
--- 1560,1566 ----
case FILE_TYPE:
case OFFSET_TYPE:
case LANG_TYPE:
+ case VECTOR_TYPE:
return 0;
default:
*************** output_type (type, containing_scope)
*** 4300,4305 ****
--- 4307,4316 ----
switch (TREE_CODE (type))
{
case ERROR_MARK:
+ break;
+
+ case VECTOR_TYPE:
+ output_type (TYPE_DEBUG_REPRESENTATION_TYPE (type), containing_scope);
break;
case POINTER_TYPE:
Index: tm.texi
===================================================================
RCS file: /cvs/gcc/egcs/gcc/tm.texi,v
retrieving revision 1.130
diff -c -p -r1.130 tm.texi
*** tm.texi 2000/06/14 05:30:08 1.130
--- tm.texi 2000/06/24 19:42:22
*************** this size or smaller can be used for str
*** 1043,1048 ****
--- 1043,1054 ----
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: tree.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/tree.c,v
retrieving revision 1.150
diff -c -p -r1.150 tree.c
*** tree.c 2000/06/14 05:30:08 1.150
--- tree.c 2000/06/24 19:42:29
*************** tree_class_check_failed (node, cl, file,
*** 5613,5618 ****
--- 5613,5644 ----
#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
*************** build_common_tree_nodes_2 (short_double)
*** 5764,5767 ****
--- 5790,5818 ----
#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: tree.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/tree.h,v
retrieving revision 1.181
diff -c -p -r1.181 tree.h
*** tree.h 2000/06/24 19:26:42 1.181
--- tree.h 2000/06/24 19:42:34
*************** struct tree_block
*** 887,892 ****
--- 887,897 ----
#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
*************** enum tree_index
*** 1722,1727 ****
--- 1727,1738 ----
TI_PTRDIFF_TYPE,
TI_VA_LIST_TYPE,
+ TI_V4SF_TYPE,
+ TI_V4SI_TYPE,
+ TI_V8QI_TYPE,
+ TI_V4HI_TYPE,
+ TI_V2SI_TYPE,
+
TI_MAX
};
*************** extern tree global_trees[TI_MAX];
*** 1767,1772 ****
--- 1778,1789 ----
#define const_ptr_type_node global_trees[TI_CONST_PTR_TYPE]
#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. */
More information about the Gcc-patches
mailing list