This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
ppc e500: make spe builtin return opaque types
- From: Aldy Hernandez <aldyh at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 7 Apr 2003 16:07:57 -0400
- Subject: ppc e500: make spe builtin return opaque types
A while ago Zack and Geoff suggested that the builtins return a
different type to be used as the opaque type. This way we wouldn't
need the myriad of casts in spe.h, and we wouldn't have to define the
opaque type as V2SI, thus making any old V2SI an opaque type.
With this patch I make a copy of V2SI_type_node and V2SF_type_node,
that later get recognized as an opaque type. So now opaque types will
not only be __ev64_opaque__ types, but the arguments and return types
of SPE builtins (like the API documentation specifies).
Now we can say:
__ev64_s16__ foo, bar;
foo = __ev_addw (foo, bar);
without any syntax errors.
In a subsequent patch I will remove the gazillion casts in <spe.h>
which should no longer be necessary. But I'm SPE-ed out today.
Committed to mainline.
Aldy
2003-04-07 Aldy Hernandez <aldyh at redhat dot com>
* config/rs6000/rs6000.c (rs6000_common_init_builtins): Rename all
V2SI_type_node to opaque_V2SI_type_node. Rename all
V2SF_type_node to opaque_V2SF_type_node.
(rs6000_init_builtins): Define opaque_V2SI_type_node and
opaque_V2SF_type_node.
(is_ev64_opaque_type): The types opaque_V2SI_type_node and
opaque_V2SF_type_node are opaque types.
Index: config/rs6000/rs6000.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.452
diff -c -p -r1.452 rs6000.c
*** config/rs6000/rs6000.c 7 Apr 2003 18:49:10 -0000 1.452
--- config/rs6000/rs6000.c 7 Apr 2003 19:59:02 -0000
*************** const char *rs6000_debug_name;
*** 147,152 ****
--- 147,158 ----
int rs6000_debug_stack; /* debug stack applications */
int rs6000_debug_arg; /* debug argument handling */
+ /* A copy of V2SI_type_node to be used as an opaque type. */
+ static GTY(()) tree opaque_V2SI_type_node;
+
+ /* Same, but for V2SF. */
+ static GTY(()) tree opaque_V2SF_type_node;
+
const char *rs6000_traceback_name;
static enum {
traceback_default = 0,
*************** static void
*** 5431,5437 ****
rs6000_init_builtins ()
{
if (TARGET_SPE)
! spe_init_builtins ();
if (TARGET_ALTIVEC)
altivec_init_builtins ();
if (TARGET_ALTIVEC || TARGET_SPE)
--- 5437,5447 ----
rs6000_init_builtins ()
{
if (TARGET_SPE)
! {
! opaque_V2SI_type_node = copy_node (V2SI_type_node);
! opaque_V2SF_type_node = copy_node (V2SF_type_node);
! spe_init_builtins ();
! }
if (TARGET_ALTIVEC)
altivec_init_builtins ();
if (TARGET_ALTIVEC || TARGET_SPE)
*************** rs6000_common_init_builtins ()
*** 5910,5952 ****
= build_function_type_list (V4SF_type_node, V4SF_type_node,
NULL_TREE);
tree v2si_ftype_v2si_v2si
! = build_function_type_list (V2SI_type_node,
! V2SI_type_node, V2SI_type_node, NULL_TREE);
tree v2sf_ftype_v2sf_v2sf
! = build_function_type_list (V2SF_type_node,
! V2SF_type_node, V2SF_type_node, NULL_TREE);
tree v2si_ftype_int_int
! = build_function_type_list (V2SI_type_node,
integer_type_node, integer_type_node,
NULL_TREE);
tree v2si_ftype_v2si
! = build_function_type_list (V2SI_type_node, V2SI_type_node,
NULL_TREE);
tree v2sf_ftype_v2sf
! = build_function_type_list (V2SF_type_node,
! V2SF_type_node, NULL_TREE);
tree v2sf_ftype_v2si
! = build_function_type_list (V2SF_type_node,
! V2SI_type_node, NULL_TREE);
tree v2si_ftype_v2sf
! = build_function_type_list (V2SI_type_node,
! V2SF_type_node, NULL_TREE);
tree v2si_ftype_v2si_char
! = build_function_type_list (V2SI_type_node,
! V2SI_type_node, char_type_node, NULL_TREE);
tree v2si_ftype_int_char
! = build_function_type_list (V2SI_type_node,
integer_type_node, char_type_node, NULL_TREE);
tree v2si_ftype_char
! = build_function_type_list (V2SI_type_node, char_type_node,
NULL_TREE);
tree int_ftype_int_int
= build_function_type_list (integer_type_node,
--- 5920,5967 ----
= build_function_type_list (V4SF_type_node, V4SF_type_node,
NULL_TREE);
tree v2si_ftype_v2si_v2si
! = build_function_type_list (opaque_V2SI_type_node,
! opaque_V2SI_type_node,
! opaque_V2SI_type_node, NULL_TREE);
tree v2sf_ftype_v2sf_v2sf
! = build_function_type_list (opaque_V2SF_type_node,
! opaque_V2SF_type_node,
! opaque_V2SF_type_node, NULL_TREE);
tree v2si_ftype_int_int
! = build_function_type_list (opaque_V2SI_type_node,
integer_type_node, integer_type_node,
NULL_TREE);
tree v2si_ftype_v2si
! = build_function_type_list (opaque_V2SI_type_node,
! opaque_V2SI_type_node, NULL_TREE);
tree v2sf_ftype_v2sf
! = build_function_type_list (opaque_V2SF_type_node,
! opaque_V2SF_type_node, NULL_TREE);
tree v2sf_ftype_v2si
! = build_function_type_list (opaque_V2SF_type_node,
! opaque_V2SI_type_node, NULL_TREE);
tree v2si_ftype_v2sf
! = build_function_type_list (opaque_V2SI_type_node,
! opaque_V2SF_type_node, NULL_TREE);
tree v2si_ftype_v2si_char
! = build_function_type_list (opaque_V2SI_type_node,
! opaque_V2SI_type_node,
! char_type_node, NULL_TREE);
tree v2si_ftype_int_char
! = build_function_type_list (opaque_V2SI_type_node,
integer_type_node, char_type_node, NULL_TREE);
tree v2si_ftype_char
! = build_function_type_list (opaque_V2SI_type_node,
! char_type_node, NULL_TREE);
tree int_ftype_int_int
= build_function_type_list (integer_type_node,
*************** is_ev64_opaque_type (type)
*** 13933,13944 ****
tree type;
{
return (TARGET_SPE
! && TREE_CODE (type) == VECTOR_TYPE
! && TYPE_NAME (type)
! && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
! && DECL_NAME (TYPE_NAME (type))
! && strcmp (IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))),
! "__ev64_opaque__") == 0);
}
static rtx
--- 13948,13961 ----
tree type;
{
return (TARGET_SPE
! && (type == opaque_V2SI_type_node
! || type == opaque_V2SF_type_node
! || (TREE_CODE (type) == VECTOR_TYPE
! && TYPE_NAME (type)
! && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
! && DECL_NAME (TYPE_NAME (type))
! && strcmp (IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))),
! "__ev64_opaque__") == 0)));
}
static rtx