Commit 4061f623 by Bernd Schmidt Committed by Bernd Schmidt

Vector support: type node creation & debugging support

From-SVN: r34696
parent f1ff439a
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> 2000-06-25 Kazu Hirata <kazu@hxi.com>
* config/arm.c: Fix a comment typo. * config/arm.c: Fix a comment typo.
......
...@@ -2296,6 +2296,19 @@ type_for_mode (mode, unsignedp) ...@@ -2296,6 +2296,19 @@ type_for_mode (mode, unsignedp)
if (mode == TYPE_MODE (build_pointer_type (integer_type_node))) if (mode == TYPE_MODE (build_pointer_type (integer_type_node)))
return 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; return 0;
} }
......
...@@ -1003,6 +1003,9 @@ dbxout_type (type, full, show_arg_types) ...@@ -1003,6 +1003,9 @@ dbxout_type (type, full, show_arg_types)
register tree tem; register tree tem;
static int anonymous_type_number = 0; 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, /* If there was an input error and we don't really have a type,
avoid crashing and write something that is at least valid avoid crashing and write something that is at least valid
by assuming `int'. */ by assuming `int'. */
......
...@@ -237,6 +237,9 @@ enum dwarf_fundamental_type { ...@@ -237,6 +237,9 @@ enum dwarf_fundamental_type {
FT_int64 = 0x9908, FT_int64 = 0x9908,
FT_signed_int64 = 0x9a08, FT_signed_int64 = 0x9a08,
FT_unsigned_int64 = 0x9b08, FT_unsigned_int64 = 0x9b08,
FT_int128 = 0x9c10,
FT_signed_int128 = 0x9d10,
FT_unsigned_int128 = 0x9e10,
FT_real32 = 0xa004, FT_real32 = 0xa004,
FT_real64 = 0xa108, FT_real64 = 0xa108,
......
...@@ -4118,6 +4118,8 @@ static inline dw_die_ref ...@@ -4118,6 +4118,8 @@ static inline dw_die_ref
lookup_type_die (type) lookup_type_die (type)
register tree type; register tree type;
{ {
if (TREE_CODE (type) == VECTOR_TYPE)
type = TYPE_DEBUG_REPRESENTATION_TYPE (type);
return (dw_die_ref) TYPE_SYMTAB_POINTER (type); return (dw_die_ref) TYPE_SYMTAB_POINTER (type);
} }
...@@ -9065,6 +9067,10 @@ gen_type_die (type, context_die) ...@@ -9065,6 +9067,10 @@ gen_type_die (type, context_die)
gen_array_type_die (type, context_die); gen_array_type_die (type, context_die);
break; break;
case VECTOR_TYPE:
gen_type_die (TYPE_DEBUG_REPRESENTATION_TYPE (type), context_die);
break;
case ENUMERAL_TYPE: case ENUMERAL_TYPE:
case RECORD_TYPE: case RECORD_TYPE:
case UNION_TYPE: case UNION_TYPE:
......
...@@ -1135,6 +1135,9 @@ dwarf_fund_type_name (ft) ...@@ -1135,6 +1135,9 @@ dwarf_fund_type_name (ft)
case FT_int64: return "FT_int64"; case FT_int64: return "FT_int64";
case FT_signed_int64: return "FT_signed_int64"; case FT_signed_int64: return "FT_signed_int64";
case FT_unsigned_int64: return "FT_unsigned_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_real32: return "FT_real32";
case FT_real64: return "FT_real64"; case FT_real64: return "FT_real64";
...@@ -1366,6 +1369,9 @@ fundamental_type_code (type) ...@@ -1366,6 +1369,9 @@ fundamental_type_code (type)
if (TYPE_PRECISION (type) == CHAR_TYPE_SIZE) if (TYPE_PRECISION (type) == CHAR_TYPE_SIZE)
return (TREE_UNSIGNED (type) ? FT_unsigned_char : FT_char); 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 */ /* In C++, __java_boolean is an INTEGER_TYPE with precision == 1 */
if (TYPE_PRECISION (type) == 1) if (TYPE_PRECISION (type) == 1)
return FT_boolean; return FT_boolean;
...@@ -1554,6 +1560,7 @@ type_is_fundamental (type) ...@@ -1554,6 +1560,7 @@ type_is_fundamental (type)
case FILE_TYPE: case FILE_TYPE:
case OFFSET_TYPE: case OFFSET_TYPE:
case LANG_TYPE: case LANG_TYPE:
case VECTOR_TYPE:
return 0; return 0;
default: default:
...@@ -4302,6 +4309,10 @@ output_type (type, containing_scope) ...@@ -4302,6 +4309,10 @@ output_type (type, containing_scope)
case ERROR_MARK: case ERROR_MARK:
break; break;
case VECTOR_TYPE:
output_type (TYPE_DEBUG_REPRESENTATION_TYPE (type), containing_scope);
break;
case POINTER_TYPE: case POINTER_TYPE:
case REFERENCE_TYPE: case REFERENCE_TYPE:
/* Prevent infinite recursion in cases where this is a recursive /* Prevent infinite recursion in cases where this is a recursive
......
...@@ -1043,6 +1043,12 @@ this size or smaller can be used for structures and unions with the ...@@ -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 appropriate sizes. If this macro is undefined, @code{GET_MODE_BITSIZE
(DImode)} is assumed. (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 @findex STACK_SAVEAREA_MODE
@item STACK_SAVEAREA_MODE (@var{save_level}) @item STACK_SAVEAREA_MODE (@var{save_level})
If defined, an expression of type @code{enum machine_mode} that If defined, an expression of type @code{enum machine_mode} that
......
...@@ -5613,6 +5613,32 @@ tree_class_check_failed (node, cl, file, line, function) ...@@ -5613,6 +5613,32 @@ tree_class_check_failed (node, cl, file, line, function)
#endif /* ENABLE_TREE_CHECKING */ #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 #ifndef CHAR_TYPE_SIZE
#define CHAR_TYPE_SIZE BITS_PER_UNIT #define CHAR_TYPE_SIZE BITS_PER_UNIT
#endif #endif
...@@ -5764,4 +5790,29 @@ build_common_tree_nodes_2 (short_double) ...@@ -5764,4 +5790,29 @@ build_common_tree_nodes_2 (short_double)
#else #else
va_list_type_node = ptr_type_node; va_list_type_node = ptr_type_node;
#endif #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);
} }
...@@ -887,6 +887,11 @@ struct tree_block ...@@ -887,6 +887,11 @@ struct tree_block
#define TYPE_OBSTACK(NODE) (TYPE_CHECK (NODE)->type.obstack) #define TYPE_OBSTACK(NODE) (TYPE_CHECK (NODE)->type.obstack)
#define TYPE_LANG_SPECIFIC(NODE) (TYPE_CHECK (NODE)->type.lang_specific) #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 /* Indirect types present difficulties because they may be represented
as either POINTER_TYPE/REFERENCE_TYPE nodes (unbounded) or as as either POINTER_TYPE/REFERENCE_TYPE nodes (unbounded) or as
RECORD_TYPE nodes (bounded). Bounded and unbounded pointers might RECORD_TYPE nodes (bounded). Bounded and unbounded pointers might
...@@ -1722,6 +1727,12 @@ enum tree_index ...@@ -1722,6 +1727,12 @@ enum tree_index
TI_PTRDIFF_TYPE, TI_PTRDIFF_TYPE,
TI_VA_LIST_TYPE, TI_VA_LIST_TYPE,
TI_V4SF_TYPE,
TI_V4SI_TYPE,
TI_V8QI_TYPE,
TI_V4HI_TYPE,
TI_V2SI_TYPE,
TI_MAX TI_MAX
}; };
...@@ -1768,6 +1779,12 @@ extern tree global_trees[TI_MAX]; ...@@ -1768,6 +1779,12 @@ extern tree global_trees[TI_MAX];
#define ptrdiff_type_node global_trees[TI_PTRDIFF_TYPE] #define ptrdiff_type_node global_trees[TI_PTRDIFF_TYPE]
#define va_list_type_node global_trees[TI_VA_LIST_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 /* An enumeration of the standard C integer types. These must be
ordered so that shorter types appear before longer ones. */ ordered so that shorter types appear before longer ones. */
enum integer_type_kind enum integer_type_kind
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment