Commit 8dc9f5bd by Ulrich Weigand Committed by Ulrich Weigand

spu.h (struct spu_builtin_description): Remove FNDECL member.

	* config/spu/spu.h (struct spu_builtin_description): Remove FNDECL
	member.  Do not mark as GTY(()).
	* config/spu/spu.c (spu_builtins): Remove FNDECL initializer elements.
	(spu_builtin_decls): New static variable.
	(spu_builtin_decl): Use it instead of spu_builtins[].fndecl.
	(spu_init_builtins): Likewise.
	(spu_builtin_mul_widen_even): Likewise.
	(spu_builtin_mul_widen_odd): Likewise.
	(spu_builtin_mask_for_load): Likewise.
	(spu_builtin_vec_perm): Likewise.
	* config/spu/spu-c.c: Include "target.h".
	(spu_resolve_overloaded_builtin): Call targetm.builtin_decl instead
	of using spu_builtins[].fndecl.

From-SVN: r162114
parent 248ce2f8
2010-07-12 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
* config/spu/spu.h (struct spu_builtin_description): Remove FNDECL
member. Do not mark as GTY(()).
* config/spu/spu.c (spu_builtins): Remove FNDECL initializer elements.
(spu_builtin_decls): New static variable.
(spu_builtin_decl): Use it instead of spu_builtins[].fndecl.
(spu_init_builtins): Likewise.
(spu_builtin_mul_widen_even): Likewise.
(spu_builtin_mul_widen_odd): Likewise.
(spu_builtin_mask_for_load): Likewise.
(spu_builtin_vec_perm): Likewise.
* config/spu/spu-c.c: Include "target.h".
(spu_resolve_overloaded_builtin): Call targetm.builtin_decl instead
of using spu_builtins[].fndecl.
2010-07-12 Richard Sandiford <rdsandiford@googlemail.com> 2010-07-12 Richard Sandiford <rdsandiford@googlemail.com>
* config/mips/mips.c (mips_override_options): Make -mflip-mips16 * config/mips/mips.c (mips_override_options): Make -mflip-mips16
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "c-family/c-pragma.h" #include "c-family/c-pragma.h"
#include "tm_p.h" #include "tm_p.h"
#include "langhooks.h" #include "langhooks.h"
#include "target.h"
/* Keep the vector keywords handy for fast comparisons. */ /* Keep the vector keywords handy for fast comparisons. */
...@@ -111,7 +112,7 @@ spu_resolve_overloaded_builtin (location_t loc, tree fndecl, void *passed_args) ...@@ -111,7 +112,7 @@ spu_resolve_overloaded_builtin (location_t loc, tree fndecl, void *passed_args)
for (new_fcode = fcode + 1; spu_builtins[new_fcode].type == B_INTERNAL; for (new_fcode = fcode + 1; spu_builtins[new_fcode].type == B_INTERNAL;
new_fcode++) new_fcode++)
{ {
tree decl = spu_builtins[new_fcode].fndecl; tree decl = targetm.builtin_decl (new_fcode, true);
tree params = TYPE_ARG_TYPES (TREE_TYPE (decl)); tree params = TYPE_ARG_TYPES (TREE_TYPE (decl));
tree param; tree param;
bool all_scalar; bool all_scalar;
......
...@@ -5618,12 +5618,14 @@ extern GTY(()) struct spu_builtin_description spu_builtins[NUM_SPU_BUILTINS]; ...@@ -5618,12 +5618,14 @@ extern GTY(()) struct spu_builtin_description spu_builtins[NUM_SPU_BUILTINS];
struct spu_builtin_description spu_builtins[] = { struct spu_builtin_description spu_builtins[] = {
#define DEF_BUILTIN(fcode, icode, name, type, params) \ #define DEF_BUILTIN(fcode, icode, name, type, params) \
{fcode, icode, name, type, params, NULL_TREE}, {fcode, icode, name, type, params},
#include "spu-builtins.def" #include "spu-builtins.def"
#undef DEF_BUILTIN #undef DEF_BUILTIN
}; };
/* Returns the rs6000 builtin decl for CODE. */ static GTY(()) tree spu_builtin_decls[NUM_SPU_BUILTINS];
/* Returns the spu builtin decl for CODE. */
static tree static tree
spu_builtin_decl (unsigned code, bool initialize_p ATTRIBUTE_UNUSED) spu_builtin_decl (unsigned code, bool initialize_p ATTRIBUTE_UNUSED)
...@@ -5631,7 +5633,7 @@ spu_builtin_decl (unsigned code, bool initialize_p ATTRIBUTE_UNUSED) ...@@ -5631,7 +5633,7 @@ spu_builtin_decl (unsigned code, bool initialize_p ATTRIBUTE_UNUSED)
if (code >= NUM_SPU_BUILTINS) if (code >= NUM_SPU_BUILTINS)
return error_mark_node; return error_mark_node;
return spu_builtins[code].fndecl; return spu_builtin_decls[code];
} }
...@@ -5709,14 +5711,14 @@ spu_init_builtins (void) ...@@ -5709,14 +5711,14 @@ spu_init_builtins (void)
p = build_function_type (spu_builtin_types[d->parm[0]], p); p = build_function_type (spu_builtin_types[d->parm[0]], p);
sprintf (name, "__builtin_%s", d->name); sprintf (name, "__builtin_%s", d->name);
d->fndecl = spu_builtin_decls[i] =
add_builtin_function (name, p, END_BUILTINS + i, BUILT_IN_MD, add_builtin_function (name, p, END_BUILTINS + i, BUILT_IN_MD,
NULL, NULL_TREE); NULL, NULL_TREE);
if (d->fcode == SPU_MASK_FOR_LOAD) if (d->fcode == SPU_MASK_FOR_LOAD)
TREE_READONLY (d->fndecl) = 1; TREE_READONLY (spu_builtin_decls[i]) = 1;
/* These builtins don't throw. */ /* These builtins don't throw. */
TREE_NOTHROW (d->fndecl) = 1; TREE_NOTHROW (spu_builtin_decls[i]) = 1;
} }
} }
...@@ -6659,9 +6661,9 @@ spu_builtin_mul_widen_even (tree type) ...@@ -6659,9 +6661,9 @@ spu_builtin_mul_widen_even (tree type)
{ {
case V8HImode: case V8HImode:
if (TYPE_UNSIGNED (type)) if (TYPE_UNSIGNED (type))
return spu_builtins[SPU_MULE_0].fndecl; return spu_builtin_decls[SPU_MULE_0];
else else
return spu_builtins[SPU_MULE_1].fndecl; return spu_builtin_decls[SPU_MULE_1];
break; break;
default: default:
return NULL_TREE; return NULL_TREE;
...@@ -6676,9 +6678,9 @@ spu_builtin_mul_widen_odd (tree type) ...@@ -6676,9 +6678,9 @@ spu_builtin_mul_widen_odd (tree type)
{ {
case V8HImode: case V8HImode:
if (TYPE_UNSIGNED (type)) if (TYPE_UNSIGNED (type))
return spu_builtins[SPU_MULO_1].fndecl; return spu_builtin_decls[SPU_MULO_1];
else else
return spu_builtins[SPU_MULO_0].fndecl; return spu_builtin_decls[SPU_MULO_0];
break; break;
default: default:
return NULL_TREE; return NULL_TREE;
...@@ -6689,9 +6691,7 @@ spu_builtin_mul_widen_odd (tree type) ...@@ -6689,9 +6691,7 @@ spu_builtin_mul_widen_odd (tree type)
static tree static tree
spu_builtin_mask_for_load (void) spu_builtin_mask_for_load (void)
{ {
struct spu_builtin_description *d = &spu_builtins[SPU_MASK_FOR_LOAD]; return spu_builtin_decls[SPU_MASK_FOR_LOAD];
gcc_assert (d);
return d->fndecl;
} }
/* Implement targetm.vectorize.builtin_vectorization_cost. */ /* Implement targetm.vectorize.builtin_vectorization_cost. */
...@@ -6748,54 +6748,43 @@ spu_vector_alignment_reachable (const_tree type ATTRIBUTE_UNUSED, bool is_packed ...@@ -6748,54 +6748,43 @@ spu_vector_alignment_reachable (const_tree type ATTRIBUTE_UNUSED, bool is_packed
tree tree
spu_builtin_vec_perm (tree type, tree *mask_element_type) spu_builtin_vec_perm (tree type, tree *mask_element_type)
{ {
struct spu_builtin_description *d;
*mask_element_type = unsigned_char_type_node; *mask_element_type = unsigned_char_type_node;
switch (TYPE_MODE (type)) switch (TYPE_MODE (type))
{ {
case V16QImode: case V16QImode:
if (TYPE_UNSIGNED (type)) if (TYPE_UNSIGNED (type))
d = &spu_builtins[SPU_SHUFFLE_0]; return spu_builtin_decls[SPU_SHUFFLE_0];
else else
d = &spu_builtins[SPU_SHUFFLE_1]; return spu_builtin_decls[SPU_SHUFFLE_1];
break;
case V8HImode: case V8HImode:
if (TYPE_UNSIGNED (type)) if (TYPE_UNSIGNED (type))
d = &spu_builtins[SPU_SHUFFLE_2]; return spu_builtin_decls[SPU_SHUFFLE_2];
else else
d = &spu_builtins[SPU_SHUFFLE_3]; return spu_builtin_decls[SPU_SHUFFLE_3];
break;
case V4SImode: case V4SImode:
if (TYPE_UNSIGNED (type)) if (TYPE_UNSIGNED (type))
d = &spu_builtins[SPU_SHUFFLE_4]; return spu_builtin_decls[SPU_SHUFFLE_4];
else else
d = &spu_builtins[SPU_SHUFFLE_5]; return spu_builtin_decls[SPU_SHUFFLE_5];
break;
case V2DImode: case V2DImode:
if (TYPE_UNSIGNED (type)) if (TYPE_UNSIGNED (type))
d = &spu_builtins[SPU_SHUFFLE_6]; return spu_builtin_decls[SPU_SHUFFLE_6];
else else
d = &spu_builtins[SPU_SHUFFLE_7]; return spu_builtin_decls[SPU_SHUFFLE_7];
break;
case V4SFmode: case V4SFmode:
d = &spu_builtins[SPU_SHUFFLE_8]; return spu_builtin_decls[SPU_SHUFFLE_8];
break;
case V2DFmode: case V2DFmode:
d = &spu_builtins[SPU_SHUFFLE_9]; return spu_builtin_decls[SPU_SHUFFLE_9];
break;
default: default:
return NULL_TREE; return NULL_TREE;
} }
gcc_assert (d);
return d->fndecl;
} }
/* Return the appropriate mode for a named address pointer. */ /* Return the appropriate mode for a named address pointer. */
......
...@@ -570,7 +570,7 @@ enum spu_builtin_type ...@@ -570,7 +570,7 @@ enum spu_builtin_type
B_INTERNAL B_INTERNAL
}; };
struct GTY(()) spu_builtin_description struct spu_builtin_description
{ {
int fcode; int fcode;
int icode; int icode;
...@@ -580,8 +580,6 @@ struct GTY(()) spu_builtin_description ...@@ -580,8 +580,6 @@ struct GTY(()) spu_builtin_description
/* The first element of parm is always the return type. The rest /* The first element of parm is always the return type. The rest
are a zero terminated list of parameters. */ are a zero terminated list of parameters. */
int parm[5]; int parm[5];
tree fndecl;
}; };
extern struct spu_builtin_description spu_builtins[]; extern struct spu_builtin_description spu_builtins[];
......
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