diff options
Diffstat (limited to 'gcc/config/spu')
-rw-r--r-- | gcc/config/spu/spu-c.c | 3 | ||||
-rw-r--r-- | gcc/config/spu/spu.c | 87 | ||||
-rw-r--r-- | gcc/config/spu/spu.h | 4 |
3 files changed, 41 insertions, 53 deletions
diff --git a/gcc/config/spu/spu-c.c b/gcc/config/spu/spu-c.c index ce5f92d94db..1f22cd6fb7c 100644 --- a/gcc/config/spu/spu-c.c +++ b/gcc/config/spu/spu-c.c @@ -24,6 +24,7 @@ #include "c-family/c-pragma.h" #include "tm_p.h" #include "langhooks.h" +#include "target.h" /* Keep the vector keywords handy for fast comparisons. */ @@ -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; 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 param; bool all_scalar; diff --git a/gcc/config/spu/spu.c b/gcc/config/spu/spu.c index 8ae4e605362..689b50048ff 100644 --- a/gcc/config/spu/spu.c +++ b/gcc/config/spu/spu.c @@ -35,6 +35,7 @@ #include "output.h" #include "basic-block.h" #include "integrate.h" +#include "diagnostic-core.h" #include "toplev.h" #include "ggc.h" #include "hashtab.h" @@ -209,7 +210,7 @@ static rtx spu_addr_space_legitimize_address (rtx, rtx, enum machine_mode, static tree spu_builtin_mul_widen_even (tree); static tree spu_builtin_mul_widen_odd (tree); static tree spu_builtin_mask_for_load (void); -static int spu_builtin_vectorization_cost (enum vect_cost_for_stmt); +static int spu_builtin_vectorization_cost (enum vect_cost_for_stmt, tree, int); static bool spu_vector_alignment_reachable (const_tree, bool); static tree spu_builtin_vec_perm (tree, tree *); static enum machine_mode spu_addr_space_pointer_mode (addr_space_t); @@ -224,8 +225,6 @@ static void spu_unique_section (tree, int); static rtx spu_expand_load (rtx, rtx, rtx, int); static void spu_trampoline_init (rtx, tree, rtx); -extern const char *reg_names[]; - /* Which instruction set architecture to use. */ int spu_arch; /* Which cpu are we tuning for. */ @@ -1139,7 +1138,7 @@ spu_emit_branch_or_set (int is_set, rtx cmp, rtx operands[]) if (eq_rtx == 0) abort (); emit_insn (eq_rtx); - ior_code = ior_optab->handlers[(int)comp_mode].insn_code; + ior_code = optab_handler (ior_optab, comp_mode); gcc_assert (ior_code != CODE_FOR_nothing); emit_insn (GEN_FCN (ior_code) (compare_result, compare_result, eq_result)); @@ -1696,8 +1695,6 @@ print_operand (FILE * file, rtx x, int code) gcc_unreachable (); } -extern char call_used_regs[]; - /* For PIC mode we've reserved PIC_OFFSET_TABLE_REGNUM, which is a caller saved register. For leaf functions it is more efficient to use a volatile register because we won't need to save and restore the @@ -4079,7 +4076,7 @@ spu_build_builtin_va_list (void) TREE_CHAIN (record) = type_decl; TYPE_NAME (record) = type_decl; TYPE_FIELDS (record) = f_args; - TREE_CHAIN (f_args) = f_skip; + DECL_CHAIN (f_args) = f_skip; /* We know this is being padded and we want it too. It is an internal type so hide the warnings from the user. */ @@ -4114,7 +4111,7 @@ spu_va_start (tree valist, rtx nextarg) tree args, skip, t; f_args = TYPE_FIELDS (TREE_TYPE (va_list_type_node)); - f_skip = TREE_CHAIN (f_args); + f_skip = DECL_CHAIN (f_args); valist = build_va_arg_indirect_ref (valist); args = @@ -4169,9 +4166,9 @@ spu_gimplify_va_arg_expr (tree valist, tree type, gimple_seq * pre_p, bool pass_by_reference_p; f_args = TYPE_FIELDS (TREE_TYPE (va_list_type_node)); - f_skip = TREE_CHAIN (f_args); + f_skip = DECL_CHAIN (f_args); - valist = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (valist)), valist); + valist = build_simple_mem_ref (valist); args = build3 (COMPONENT_REF, TREE_TYPE (f_args), valist, f_args, NULL_TREE); skip = @@ -4588,7 +4585,8 @@ spu_expand_mov (rtx * ops, enum machine_mode mode) if (GET_MODE_SIZE (mode) < GET_MODE_SIZE (imode)) { - enum insn_code icode = convert_optab_handler (trunc_optab, mode, imode)->insn_code; + enum insn_code icode = convert_optab_handler (trunc_optab, + mode, imode); emit_insn (GEN_FCN (icode) (ops[0], from)); } else @@ -5616,12 +5614,14 @@ extern GTY(()) struct spu_builtin_description spu_builtins[NUM_SPU_BUILTINS]; struct spu_builtin_description spu_builtins[] = { #define DEF_BUILTIN(fcode, icode, name, type, params) \ - {fcode, icode, name, type, params, NULL_TREE}, + {fcode, icode, name, type, params}, #include "spu-builtins.def" #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 spu_builtin_decl (unsigned code, bool initialize_p ATTRIBUTE_UNUSED) @@ -5629,7 +5629,7 @@ spu_builtin_decl (unsigned code, bool initialize_p ATTRIBUTE_UNUSED) if (code >= NUM_SPU_BUILTINS) return error_mark_node; - return spu_builtins[code].fndecl; + return spu_builtin_decls[code]; } @@ -5707,14 +5707,14 @@ spu_init_builtins (void) p = build_function_type (spu_builtin_types[d->parm[0]], p); sprintf (name, "__builtin_%s", d->name); - d->fndecl = + spu_builtin_decls[i] = add_builtin_function (name, p, END_BUILTINS + i, BUILT_IN_MD, NULL, NULL_TREE); if (d->fcode == SPU_MASK_FOR_LOAD) - TREE_READONLY (d->fndecl) = 1; + TREE_READONLY (spu_builtin_decls[i]) = 1; /* These builtins don't throw. */ - TREE_NOTHROW (d->fndecl) = 1; + TREE_NOTHROW (spu_builtin_decls[i]) = 1; } } @@ -6251,7 +6251,7 @@ spu_emit_vector_compare (enum rtx_code rcode, { enum insn_code nor_code; rtx eq_rtx = spu_emit_vector_compare (EQ, op0, op1, dest_mode); - nor_code = optab_handler (one_cmpl_optab, (int)dest_mode)->insn_code; + nor_code = optab_handler (one_cmpl_optab, dest_mode); gcc_assert (nor_code != CODE_FOR_nothing); emit_insn (GEN_FCN (nor_code) (mask, eq_rtx)); if (dmode != dest_mode) @@ -6286,7 +6286,7 @@ spu_emit_vector_compare (enum rtx_code rcode, c_rtx = spu_emit_vector_compare (new_code, op0, op1, dest_mode); eq_rtx = spu_emit_vector_compare (EQ, op0, op1, dest_mode); - ior_code = optab_handler (ior_optab, (int)dest_mode)->insn_code; + ior_code = optab_handler (ior_optab, dest_mode); gcc_assert (ior_code != CODE_FOR_nothing); emit_insn (GEN_FCN (ior_code) (mask, c_rtx, eq_rtx)); if (dmode != dest_mode) @@ -6514,7 +6514,7 @@ spu_expand_builtin_1 (struct spu_builtin_description *d, /* get addr */ arg = CALL_EXPR_ARG (exp, 0); - gcc_assert (TREE_CODE (TREE_TYPE (arg)) == POINTER_TYPE); + gcc_assert (POINTER_TYPE_P (TREE_TYPE (arg))); op = expand_expr (arg, NULL_RTX, Pmode, EXPAND_NORMAL); addr = memory_address (mode, op); @@ -6657,9 +6657,9 @@ spu_builtin_mul_widen_even (tree type) { case V8HImode: if (TYPE_UNSIGNED (type)) - return spu_builtins[SPU_MULE_0].fndecl; + return spu_builtin_decls[SPU_MULE_0]; else - return spu_builtins[SPU_MULE_1].fndecl; + return spu_builtin_decls[SPU_MULE_1]; break; default: return NULL_TREE; @@ -6674,9 +6674,9 @@ spu_builtin_mul_widen_odd (tree type) { case V8HImode: if (TYPE_UNSIGNED (type)) - return spu_builtins[SPU_MULO_1].fndecl; + return spu_builtin_decls[SPU_MULO_1]; else - return spu_builtins[SPU_MULO_0].fndecl; + return spu_builtin_decls[SPU_MULO_0]; break; default: return NULL_TREE; @@ -6687,14 +6687,14 @@ spu_builtin_mul_widen_odd (tree type) static tree spu_builtin_mask_for_load (void) { - struct spu_builtin_description *d = &spu_builtins[SPU_MASK_FOR_LOAD]; - gcc_assert (d); - return d->fndecl; + return spu_builtin_decls[SPU_MASK_FOR_LOAD]; } /* Implement targetm.vectorize.builtin_vectorization_cost. */ static int -spu_builtin_vectorization_cost (enum vect_cost_for_stmt type_of_cost) +spu_builtin_vectorization_cost (enum vect_cost_for_stmt type_of_cost, + tree vectype ATTRIBUTE_UNUSED, + int misalign ATTRIBUTE_UNUSED) { switch (type_of_cost) { @@ -6744,54 +6744,43 @@ spu_vector_alignment_reachable (const_tree type ATTRIBUTE_UNUSED, bool is_packed tree spu_builtin_vec_perm (tree type, tree *mask_element_type) { - struct spu_builtin_description *d; - *mask_element_type = unsigned_char_type_node; switch (TYPE_MODE (type)) { case V16QImode: if (TYPE_UNSIGNED (type)) - d = &spu_builtins[SPU_SHUFFLE_0]; + return spu_builtin_decls[SPU_SHUFFLE_0]; else - d = &spu_builtins[SPU_SHUFFLE_1]; - break; + return spu_builtin_decls[SPU_SHUFFLE_1]; case V8HImode: if (TYPE_UNSIGNED (type)) - d = &spu_builtins[SPU_SHUFFLE_2]; + return spu_builtin_decls[SPU_SHUFFLE_2]; else - d = &spu_builtins[SPU_SHUFFLE_3]; - break; + return spu_builtin_decls[SPU_SHUFFLE_3]; case V4SImode: if (TYPE_UNSIGNED (type)) - d = &spu_builtins[SPU_SHUFFLE_4]; + return spu_builtin_decls[SPU_SHUFFLE_4]; else - d = &spu_builtins[SPU_SHUFFLE_5]; - break; + return spu_builtin_decls[SPU_SHUFFLE_5]; case V2DImode: if (TYPE_UNSIGNED (type)) - d = &spu_builtins[SPU_SHUFFLE_6]; + return spu_builtin_decls[SPU_SHUFFLE_6]; else - d = &spu_builtins[SPU_SHUFFLE_7]; - break; + return spu_builtin_decls[SPU_SHUFFLE_7]; case V4SFmode: - d = &spu_builtins[SPU_SHUFFLE_8]; - break; + return spu_builtin_decls[SPU_SHUFFLE_8]; case V2DFmode: - d = &spu_builtins[SPU_SHUFFLE_9]; - break; + return spu_builtin_decls[SPU_SHUFFLE_9]; default: return NULL_TREE; } - - gcc_assert (d); - return d->fndecl; } /* Return the appropriate mode for a named address pointer. */ diff --git a/gcc/config/spu/spu.h b/gcc/config/spu/spu.h index d3880418c2f..1184227bf01 100644 --- a/gcc/config/spu/spu.h +++ b/gcc/config/spu/spu.h @@ -570,7 +570,7 @@ enum spu_builtin_type B_INTERNAL }; -struct GTY(()) spu_builtin_description +struct spu_builtin_description { int fcode; int icode; @@ -580,8 +580,6 @@ struct GTY(()) spu_builtin_description /* The first element of parm is always the return type. The rest are a zero terminated list of parameters. */ int parm[5]; - - tree fndecl; }; extern struct spu_builtin_description spu_builtins[]; |