As $SUBJECT suggests. The only tricky part is in builtin_function_type, where we fill in unused args with NULL_TREE so that passing extra arguments to build_function_type_list doesn't matter.
Tested with cross to powerpc-eabi. OK to commit? -Nathan * config/rs6000/rs6000.c (spe_init_builtins): Call build_function_type_list instead of build_function_type. (paired_init_builtins, altivec_init_builtins): Likewise. (builtin_function_type): Likewise. diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 8182bf0..c08c16e 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -12824,107 +12824,97 @@ enable_mask_for_builtins (struct builtin_description *desc, int size, static void spe_init_builtins (void) { - tree endlink = void_list_node; tree puint_type_node = build_pointer_type (unsigned_type_node); tree pushort_type_node = build_pointer_type (short_unsigned_type_node); struct builtin_description *d; size_t i; tree v2si_ftype_4_v2si - = build_function_type - (opaque_V2SI_type_node, - tree_cons (NULL_TREE, opaque_V2SI_type_node, - tree_cons (NULL_TREE, opaque_V2SI_type_node, - tree_cons (NULL_TREE, opaque_V2SI_type_node, - tree_cons (NULL_TREE, opaque_V2SI_type_node, - endlink))))); + = build_function_type_list (opaque_V2SI_type_node, + opaque_V2SI_type_node, + opaque_V2SI_type_node, + opaque_V2SI_type_node, + opaque_V2SI_type_node, + NULL_TREE); tree v2sf_ftype_4_v2sf - = build_function_type - (opaque_V2SF_type_node, - tree_cons (NULL_TREE, opaque_V2SF_type_node, - tree_cons (NULL_TREE, opaque_V2SF_type_node, - tree_cons (NULL_TREE, opaque_V2SF_type_node, - tree_cons (NULL_TREE, opaque_V2SF_type_node, - endlink))))); + = build_function_type_list (opaque_V2SF_type_node, + opaque_V2SF_type_node, + opaque_V2SF_type_node, + opaque_V2SF_type_node, + opaque_V2SF_type_node, + NULL_TREE); tree int_ftype_int_v2si_v2si - = build_function_type - (integer_type_node, - tree_cons (NULL_TREE, integer_type_node, - tree_cons (NULL_TREE, opaque_V2SI_type_node, - tree_cons (NULL_TREE, opaque_V2SI_type_node, - endlink)))); + = build_function_type_list (integer_type_node, + integer_type_node, + opaque_V2SI_type_node, + opaque_V2SI_type_node, + NULL_TREE); tree int_ftype_int_v2sf_v2sf - = build_function_type - (integer_type_node, - tree_cons (NULL_TREE, integer_type_node, - tree_cons (NULL_TREE, opaque_V2SF_type_node, - tree_cons (NULL_TREE, opaque_V2SF_type_node, - endlink)))); + = build_function_type_list (integer_type_node, + integer_type_node, + opaque_V2SF_type_node, + opaque_V2SF_type_node, + NULL_TREE); tree void_ftype_v2si_puint_int - = build_function_type (void_type_node, - tree_cons (NULL_TREE, opaque_V2SI_type_node, - tree_cons (NULL_TREE, puint_type_node, - tree_cons (NULL_TREE, - integer_type_node, - endlink)))); + = build_function_type_list (void_type_node, + opaque_V2SI_type_node, + puint_type_node, + integer_type_node, + NULL_TREE); tree void_ftype_v2si_puint_char - = build_function_type (void_type_node, - tree_cons (NULL_TREE, opaque_V2SI_type_node, - tree_cons (NULL_TREE, puint_type_node, - tree_cons (NULL_TREE, - char_type_node, - endlink)))); + = build_function_type_list (void_type_node, + opaque_V2SI_type_node, + puint_type_node, + char_type_node, + NULL_TREE); tree void_ftype_v2si_pv2si_int - = build_function_type (void_type_node, - tree_cons (NULL_TREE, opaque_V2SI_type_node, - tree_cons (NULL_TREE, opaque_p_V2SI_type_node, - tree_cons (NULL_TREE, - integer_type_node, - endlink)))); + = build_function_type_list (void_type_node, + opaque_V2SI_type_node, + opaque_p_V2SI_type_node, + integer_type_node, + NULL_TREE); tree void_ftype_v2si_pv2si_char - = build_function_type (void_type_node, - tree_cons (NULL_TREE, opaque_V2SI_type_node, - tree_cons (NULL_TREE, opaque_p_V2SI_type_node, - tree_cons (NULL_TREE, - char_type_node, - endlink)))); + = build_function_type_list (void_type_node, + opaque_V2SI_type_node, + opaque_p_V2SI_type_node, + char_type_node, + NULL_TREE); tree void_ftype_int - = build_function_type (void_type_node, - tree_cons (NULL_TREE, integer_type_node, endlink)); + = build_function_type_list (void_type_node, integer_type_node, NULL_TREE); tree int_ftype_void - = build_function_type (integer_type_node, endlink); + = build_function_type_list (integer_type_node, NULL_TREE); tree v2si_ftype_pv2si_int - = build_function_type (opaque_V2SI_type_node, - tree_cons (NULL_TREE, opaque_p_V2SI_type_node, - tree_cons (NULL_TREE, integer_type_node, - endlink))); + = build_function_type_list (opaque_V2SI_type_node, + opaque_p_V2SI_type_node, + integer_type_node, + NULL_TREE); tree v2si_ftype_puint_int - = build_function_type (opaque_V2SI_type_node, - tree_cons (NULL_TREE, puint_type_node, - tree_cons (NULL_TREE, integer_type_node, - endlink))); + = build_function_type_list (opaque_V2SI_type_node, + puint_type_node, + integer_type_node, + NULL_TREE); tree v2si_ftype_pushort_int - = build_function_type (opaque_V2SI_type_node, - tree_cons (NULL_TREE, pushort_type_node, - tree_cons (NULL_TREE, integer_type_node, - endlink))); + = build_function_type_list (opaque_V2SI_type_node, + pushort_type_node, + integer_type_node, + NULL_TREE); tree v2si_ftype_signed_char - = build_function_type (opaque_V2SI_type_node, - tree_cons (NULL_TREE, signed_char_type_node, - endlink)); + = build_function_type_list (opaque_V2SI_type_node, + signed_char_type_node, + NULL_TREE); /* The initialization of the simple binary and unary builtins is done in rs6000_common_init_builtins, but we have to enable the @@ -13046,15 +13036,13 @@ paired_init_builtins (void) { const struct builtin_description *d; size_t i; - tree endlink = void_list_node; tree int_ftype_int_v2sf_v2sf - = build_function_type - (integer_type_node, - tree_cons (NULL_TREE, integer_type_node, - tree_cons (NULL_TREE, V2SF_type_node, - tree_cons (NULL_TREE, V2SF_type_node, - endlink)))); + = build_function_type_list (integer_type_node, + integer_type_node, + V2SF_type_node, + V2SF_type_node, + NULL_TREE); tree pcfloat_type_node = build_pointer_type (build_qualified_type (float_type_node, TYPE_QUAL_CONST)); @@ -13115,8 +13103,7 @@ altivec_init_builtins (void) = build_function_type_list (integer_type_node, opaque_V4SI_type_node, NULL_TREE); tree opaque_ftype_opaque - = build_function_type (integer_type_node, - NULL_TREE); + = build_function_type_list (integer_type_node, NULL_TREE); tree opaque_ftype_opaque_int = build_function_type_list (opaque_V4SI_type_node, opaque_V4SI_type_node, integer_type_node, NULL_TREE); @@ -13135,9 +13122,9 @@ altivec_init_builtins (void) tree void_ftype_v4si = build_function_type_list (void_type_node, V4SI_type_node, NULL_TREE); tree v8hi_ftype_void - = build_function_type (V8HI_type_node, void_list_node); + = build_function_type_list (V8HI_type_node, NULL_TREE); tree void_ftype_void - = build_function_type (void_type_node, void_list_node); + = build_function_type_list (void_type_node, NULL_TREE); tree void_ftype_int = build_function_type_list (void_type_node, integer_type_node, NULL_TREE); @@ -13600,7 +13587,6 @@ builtin_function_type (enum machine_mode mode_ret, enum machine_mode mode_arg0, int i; tree ret_type = NULL_TREE; tree arg_type[3] = { NULL_TREE, NULL_TREE, NULL_TREE }; - tree args; /* Create builtin_hash_table. */ if (builtin_hash_table == NULL) @@ -13703,6 +13689,9 @@ builtin_function_type (enum machine_mode mode_ret, enum machine_mode mode_arg0, fatal_error ("internal error: builtin function %s had an unexpected " "return type %s", name, GET_MODE_NAME (h.mode[0])); + for (i = 0; i < (int) ARRAY_SIZE (arg_type); i++) + arg_type[i] = NULL_TREE; + for (i = 0; i < num_args; i++) { int m = (int) h.mode[i+1]; @@ -13724,12 +13713,9 @@ builtin_function_type (enum machine_mode mode_ret, enum machine_mode mode_arg0, h2 = ggc_alloc_builtin_hash_struct (); *h2 = h; *found = (void *)h2; - args = void_list_node; - - for (i = num_args - 1; i >= 0; i--) - args = tree_cons (NULL_TREE, arg_type[i], args); - h2->type = build_function_type (ret_type, args); + h2->type = build_function_type_list (ret_type, arg_type[0], arg_type[1], + arg_type[2], NULL_TREE); } return ((struct builtin_hash_struct *)(*found))->type;