diff options
Diffstat (limited to 'gcc/config/rs6000')
-rw-r--r-- | gcc/config/rs6000/rs6000-builtin.cc | 2 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000-c.cc | 62 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000-gen-builtins.cc | 72 |
3 files changed, 72 insertions, 64 deletions
diff --git a/gcc/config/rs6000/rs6000-builtin.cc b/gcc/config/rs6000/rs6000-builtin.cc index ff58305..f01f3ad 100644 --- a/gcc/config/rs6000/rs6000-builtin.cc +++ b/gcc/config/rs6000/rs6000-builtin.cc @@ -869,7 +869,7 @@ rs6000_init_builtins (void) continue; if (e == ENB_MMA && !TARGET_MMA) continue; - tree fntype = rs6000_builtin_info[i].fntype; + tree fntype = rs6000_builtin_info_fntype[i]; tree t = TREE_TYPE (fntype); fprintf (stderr, "%s %s (", rs6000_type_string (t), rs6000_builtin_info[i].bifname); diff --git a/gcc/config/rs6000/rs6000-c.cc b/gcc/config/rs6000/rs6000-c.cc index 77d8de7..6106aa9 100644 --- a/gcc/config/rs6000/rs6000-c.cc +++ b/gcc/config/rs6000/rs6000-c.cc @@ -1663,34 +1663,37 @@ resolve_vec_step (resolution *res, vec<tree, va_gc> *arglist, unsigned nargs) UNSUPPORTED_BUILTIN to true. If we don't match, return error_mark_node and leave UNSUPPORTED_BUILTIN alone. */ -tree -find_instance (bool *unsupported_builtin, ovlddata **instance, +static tree +find_instance (bool *unsupported_builtin, int *instance, rs6000_gen_builtins instance_code, rs6000_gen_builtins fcode, tree *types, tree *args) { - while (*instance && (*instance)->bifid != instance_code) - *instance = (*instance)->next; + while (*instance != -1 + && rs6000_instance_info[*instance].bifid != instance_code) + *instance = rs6000_instance_info[*instance].next; - ovlddata *inst = *instance; - gcc_assert (inst != NULL); + int inst = *instance; + gcc_assert (inst != -1); /* It is possible for an instance to require a data type that isn't - defined on this target, in which case inst->fntype will be NULL. */ - if (!inst->fntype) + defined on this target, in which case rs6000_instance_info_fntype[inst] + will be NULL. */ + if (!rs6000_instance_info_fntype[inst]) return error_mark_node; - tree fntype = rs6000_builtin_info[inst->bifid].fntype; + rs6000_gen_builtins bifid = rs6000_instance_info[inst].bifid; + tree fntype = rs6000_builtin_info_fntype[bifid]; tree parmtype0 = TREE_VALUE (TYPE_ARG_TYPES (fntype)); tree parmtype1 = TREE_VALUE (TREE_CHAIN (TYPE_ARG_TYPES (fntype))); if (rs6000_builtin_type_compatible (types[0], parmtype0) && rs6000_builtin_type_compatible (types[1], parmtype1)) { - if (rs6000_builtin_decl (inst->bifid, false) != error_mark_node - && rs6000_builtin_is_supported (inst->bifid)) + if (rs6000_builtin_decl (bifid, false) != error_mark_node + && rs6000_builtin_is_supported (bifid)) { - tree ret_type = TREE_TYPE (inst->fntype); + tree ret_type = TREE_TYPE (rs6000_instance_info_fntype[inst]); return altivec_build_resolved_builtin (args, 2, fntype, ret_type, - inst->bifid, fcode); + bifid, fcode); } else *unsupported_builtin = true; @@ -1873,11 +1876,11 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl, bool unsupported_builtin = false; rs6000_gen_builtins instance_code; bool supported = false; - ovlddata *instance = rs6000_overload_info[adj_fcode].first_instance; - gcc_assert (instance != NULL); + int instance = rs6000_overload_info[adj_fcode].first_instance; + gcc_assert (instance != -1); /* Functions with no arguments can have only one overloaded instance. */ - gcc_assert (nargs > 0 || !instance->next); + gcc_assert (nargs > 0 || rs6000_instance_info[instance].next == -1); /* Standard overload processing involves determining whether an instance exists that is type-compatible with the overloaded function call. In @@ -1951,16 +1954,18 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl, /* Standard overload processing. Look for an instance with compatible parameter types. If it is supported in the current context, resolve the overloaded call to that instance. */ - for (; instance != NULL; instance = instance->next) + for (; instance != -1; instance = rs6000_instance_info[instance].next) { + tree fntype = rs6000_instance_info_fntype[instance]; + rs6000_gen_builtins bifid = rs6000_instance_info[instance].bifid; /* It is possible for an instance to require a data type that isn't - defined on this target, in which case instance->fntype will be + defined on this target, in which case fntype will be NULL. */ - if (!instance->fntype) + if (!fntype) continue; bool mismatch = false; - tree nextparm = TYPE_ARG_TYPES (instance->fntype); + tree nextparm = TYPE_ARG_TYPES (fntype); for (unsigned int arg_i = 0; arg_i < nargs && nextparm != NULL; @@ -1978,15 +1983,14 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl, if (mismatch) continue; - supported = rs6000_builtin_is_supported (instance->bifid); - if (rs6000_builtin_decl (instance->bifid, false) != error_mark_node + supported = rs6000_builtin_is_supported (bifid); + if (rs6000_builtin_decl (bifid, false) != error_mark_node && supported) { - tree fntype = rs6000_builtin_info[instance->bifid].fntype; - tree ret_type = TREE_TYPE (instance->fntype); + tree ret_type = TREE_TYPE (fntype); + fntype = rs6000_builtin_info_fntype[bifid]; return altivec_build_resolved_builtin (args, nargs, fntype, - ret_type, instance->bifid, - fcode); + ret_type, bifid, fcode); } else { @@ -2003,12 +2007,12 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl, { /* Indicate that the instantiation of the overloaded builtin name is not available with the target flags in effect. */ - rs6000_gen_builtins fcode = (rs6000_gen_builtins) instance->bifid; + rs6000_gen_builtins bifid = rs6000_instance_info[instance].bifid; + rs6000_gen_builtins fcode = (rs6000_gen_builtins) bifid; rs6000_invalid_builtin (fcode); /* Provide clarity of the relationship between the overload and the instantiation. */ - const char *internal_name - = rs6000_builtin_info[instance->bifid].bifname; + const char *internal_name = rs6000_builtin_info[bifid].bifname; rich_location richloc (line_table, input_location); inform (&richloc, "overloaded builtin %qs is implemented by builtin %qs", diff --git a/gcc/config/rs6000/rs6000-gen-builtins.cc b/gcc/config/rs6000/rs6000-gen-builtins.cc index 0bd7a53..e04ed83 100644 --- a/gcc/config/rs6000/rs6000-gen-builtins.cc +++ b/gcc/config/rs6000/rs6000-gen-builtins.cc @@ -2261,20 +2261,19 @@ write_decls (void) fprintf (header_file, "};\n\n"); fprintf (header_file, "#define PPC_MAXRESTROPNDS 3\n"); - fprintf (header_file, "struct GTY(()) bifdata\n"); + fprintf (header_file, "struct bifdata\n"); fprintf (header_file, "{\n"); - fprintf (header_file, " const char *GTY((skip(\"\"))) bifname;\n"); - fprintf (header_file, " bif_enable GTY((skip(\"\"))) enable;\n"); - fprintf (header_file, " tree fntype;\n"); - fprintf (header_file, " insn_code GTY((skip(\"\"))) icode;\n"); - fprintf (header_file, " int nargs;\n"); - fprintf (header_file, " int bifattrs;\n"); - fprintf (header_file, " int restr_opnd[PPC_MAXRESTROPNDS];\n"); - fprintf (header_file, " restriction GTY((skip(\"\"))) restr[PPC_MAXRESTROPNDS];\n"); - fprintf (header_file, " int restr_val1[PPC_MAXRESTROPNDS];\n"); - fprintf (header_file, " int restr_val2[PPC_MAXRESTROPNDS];\n"); - fprintf (header_file, " const char *GTY((skip(\"\"))) attr_string;\n"); - fprintf (header_file, " rs6000_gen_builtins GTY((skip(\"\"))) assoc_bif;\n"); + fprintf (header_file, " const char *bifname;\n"); + fprintf (header_file, " bif_enable enable;\n"); + fprintf (header_file, " insn_code icode;\n"); + fprintf (header_file, " int nargs;\n"); + fprintf (header_file, " int bifattrs;\n"); + fprintf (header_file, " int restr_opnd[PPC_MAXRESTROPNDS];\n"); + fprintf (header_file, " restriction restr[PPC_MAXRESTROPNDS];\n"); + fprintf (header_file, " int restr_val1[PPC_MAXRESTROPNDS];\n"); + fprintf (header_file, " int restr_val2[PPC_MAXRESTROPNDS];\n"); + fprintf (header_file, " const char *attr_string;\n"); + fprintf (header_file, " rs6000_gen_builtins assoc_bif;\n"); fprintf (header_file, "};\n\n"); fprintf (header_file, "#define bif_init_bit\t\t(0x00000001)\n"); @@ -2353,24 +2352,28 @@ write_decls (void) fprintf (header_file, "\n"); fprintf (header_file, - "extern GTY(()) bifdata rs6000_builtin_info[RS6000_BIF_MAX];\n\n"); + "extern bifdata rs6000_builtin_info[RS6000_BIF_MAX];\n\n"); - fprintf (header_file, "struct GTY(()) ovlddata\n"); + fprintf (header_file, + "extern GTY(()) tree rs6000_builtin_info_fntype[RS6000_BIF_MAX];\n\n"); + + fprintf (header_file, "struct ovlddata\n"); fprintf (header_file, "{\n"); - fprintf (header_file, " const char *GTY((skip(\"\"))) bifname;\n"); - fprintf (header_file, " rs6000_gen_builtins GTY((skip(\"\"))) bifid;\n"); - fprintf (header_file, " tree fntype;\n"); - fprintf (header_file, " ovlddata *GTY((skip(\"\"))) next;\n"); + fprintf (header_file, " const char *bifname;\n"); + fprintf (header_file, " rs6000_gen_builtins bifid;\n"); + fprintf (header_file, " int next;\n"); fprintf (header_file, "};\n\n"); fprintf (header_file, "struct ovldrecord\n"); fprintf (header_file, "{\n"); fprintf (header_file, " const char *ovld_name;\n"); - fprintf (header_file, " ovlddata *first_instance;\n"); + fprintf (header_file, " int first_instance;\n"); fprintf (header_file, "};\n\n"); fprintf (header_file, - "extern GTY(()) ovlddata rs6000_instance_info[RS6000_INST_MAX];\n"); + "extern ovlddata rs6000_instance_info[RS6000_INST_MAX];\n"); + fprintf (header_file, "extern GTY(()) tree " + "rs6000_instance_info_fntype[RS6000_INST_MAX];\n"); fprintf (header_file, "extern ovldrecord rs6000_overload_info[];\n\n"); fprintf (header_file, "extern void rs6000_init_generated_builtins ();\n\n"); @@ -2481,7 +2484,7 @@ write_bif_static_init (void) fprintf (init_file, "bifdata rs6000_builtin_info[RS6000_BIF_MAX] =\n"); fprintf (init_file, " {\n"); fprintf (init_file, " { /* RS6000_BIF_NONE: */\n"); - fprintf (init_file, " \"\", ENB_ALWAYS, 0, CODE_FOR_nothing, 0,\n"); + fprintf (init_file, " \"\", ENB_ALWAYS, CODE_FOR_nothing, 0,\n"); fprintf (init_file, " 0, {0, 0, 0}, {RES_NONE, RES_NONE, RES_NONE},\n"); fprintf (init_file, " {0, 0, 0}, {0, 0, 0}, \"\", RS6000_BIF_NONE\n"); fprintf (init_file, " },\n"); @@ -2493,8 +2496,6 @@ write_bif_static_init (void) bifp->proto.bifname); fprintf (init_file, " /* enable*/\t%s,\n", enable_string[bifp->stanza]); - /* Type must be instantiated at run time. */ - fprintf (init_file, " /* fntype */\t0,\n"); fprintf (init_file, " /* icode */\tCODE_FOR_%s,\n", bifp->patname); fprintf (init_file, " /* nargs */\t%d,\n", @@ -2586,6 +2587,8 @@ write_bif_static_init (void) fprintf (init_file, " },\n"); } fprintf (init_file, " };\n\n"); + + fprintf (init_file, "tree rs6000_builtin_info_fntype[RS6000_BIF_MAX];\n\n"); } /* Write the decls and initializers for rs6000_overload_info[] and @@ -2598,7 +2601,7 @@ write_ovld_static_init (void) "- RS6000_OVLD_NONE] =\n"); fprintf (init_file, " {\n"); fprintf (init_file, " { /* RS6000_OVLD_NONE: */\n"); - fprintf (init_file, " \"\", NULL\n"); + fprintf (init_file, " \"\", -1\n"); fprintf (init_file, " },\n"); for (int i = 0; i <= curr_ovld_stanza; i++) { @@ -2607,7 +2610,7 @@ write_ovld_static_init (void) fprintf (init_file, " /* ovld_name */\t\"%s\",\n", ovld_stanzas[i].intern_name); /* First-instance must currently be instantiated at run time. */ - fprintf (init_file, " /* first_instance */\tNULL\n"); + fprintf (init_file, " /* first_instance */\t-1\n"); fprintf (init_file, " },\n"); } fprintf (init_file, " };\n\n"); @@ -2615,7 +2618,7 @@ write_ovld_static_init (void) fprintf (init_file, "ovlddata rs6000_instance_info[RS6000_INST_MAX] =\n"); fprintf (init_file, " {\n"); fprintf (init_file, " { /* RS6000_INST_NONE: */\n"); - fprintf (init_file, " \"\", RS6000_BIF_NONE, NULL_TREE, NULL\n"); + fprintf (init_file, " \"\", RS6000_BIF_NONE, -1\n"); fprintf (init_file, " },\n"); for (int i = 0; i <= curr_ovld; i++) { @@ -2625,19 +2628,20 @@ write_ovld_static_init (void) ovlds[i].proto.bifname); fprintf (init_file, " /* bifid */\tRS6000_BIF_%s,\n", ovlds[i].bif_id_name); - /* Type must be instantiated at run time. */ - fprintf (init_file, " /* fntype */\t0,\n"); fprintf (init_file, " /* next */\t"); if (i < curr_ovld && !strcmp (ovlds[i+1].proto.bifname, ovlds[i].proto.bifname)) fprintf (init_file, - "&rs6000_instance_info[RS6000_INST_%s]\n", + "RS6000_INST_%s\n", ovlds[i+1].ovld_id_name); else - fprintf (init_file, "NULL\n"); + fprintf (init_file, "-1\n"); fprintf (init_file, " },\n"); } fprintf (init_file, " };\n\n"); + + fprintf (init_file, + "tree rs6000_instance_info_fntype[RS6000_INST_MAX];\n\n"); } /* Write code to initialize the built-in function table. */ @@ -2647,7 +2651,7 @@ write_init_bif_table (void) for (int i = 0; i <= curr_bif; i++) { fprintf (init_file, - " rs6000_builtin_info[RS6000_BIF_%s].fntype" + " rs6000_builtin_info_fntype[RS6000_BIF_%s]" "\n = %s;\n", bifs[i].idname, bifs[i].fndecl); @@ -2736,7 +2740,7 @@ write_init_ovld_table (void) for (int i = 0; i <= curr_ovld; i++) { fprintf (init_file, - " rs6000_instance_info[RS6000_INST_%s].fntype" + " rs6000_instance_info_fntype[RS6000_INST_%s]" "\n = %s;\n", ovlds[i].ovld_id_name, ovlds[i].fndecl); @@ -2793,7 +2797,7 @@ write_init_ovld_table (void) ".first_instance\n", stanza->stanza_id); fprintf (init_file, - " = &rs6000_instance_info[RS6000_INST_%s];\n\n", + " = RS6000_INST_%s;\n\n", ovlds[i].ovld_id_name); } } |