public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/wschmidt/heads/builtins10)] rs6000: Write output to the builtins init file, part 1 of 3
@ 2021-06-15 17:17 William Schmidt
0 siblings, 0 replies; 6+ messages in thread
From: William Schmidt @ 2021-06-15 17:17 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:a8cc6db9e18a524cf2cda8be8a9fc433571ea0c2
commit a8cc6db9e18a524cf2cda8be8a9fc433571ea0c2
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date: Mon Jun 7 14:37:54 2021 -0500
rs6000: Write output to the builtins init file, part 1 of 3
2021-06-07 Bill Schmidt <wschmidt@linux.ibm.com>
gcc/
* config/rs6000/rs6000-gen-builtins.c (write_fntype): New
callback function.
(write_fntype_init): New stub function.
(write_init_bif_table): Likewise.
(write_init_ovld_table): New function.
(write_init_file): Implement.
Diff:
---
gcc/config/rs6000/rs6000-gen-builtins.c | 163 ++++++++++++++++++++++++++++++++
1 file changed, 163 insertions(+)
diff --git a/gcc/config/rs6000/rs6000-gen-builtins.c b/gcc/config/rs6000/rs6000-gen-builtins.c
index 6f393ee46d3..2240dfc030f 100644
--- a/gcc/config/rs6000/rs6000-gen-builtins.c
+++ b/gcc/config/rs6000/rs6000-gen-builtins.c
@@ -2202,6 +2202,18 @@ write_extern_fntype (char *str)
fprintf (header_file, "extern GTY(()) tree %s;\n", str);
}
+void
+write_fntype (char *str)
+{
+ fprintf (init_file, "tree %s;\n", str);
+}
+
+/* Write an initializer for a function type identified by STR. */
+void
+write_fntype_init (char *str)
+{
+}
+
/* Write everything to the header file (rs6000-builtins.h). */
static int
write_header_file (void)
@@ -2222,10 +2234,161 @@ write_header_file (void)
return 1;
}
+/* Write code to initialize the built-in function table. */
+static void
+write_init_bif_table (void)
+{
+}
+
+/* Write code to initialize the overload table. */
+static void
+write_init_ovld_table (void)
+{
+ fprintf (init_file, " int base = RS6000_OVLD_NONE;\n\n");
+
+ for (int i = 0; i <= curr_ovld; i++)
+ {
+ fprintf (init_file,
+ " rs6000_instance_info[RS6000_INST_%s].fntype"
+ "\n = %s;\n",
+ ovlds[i].ovld_id_name, ovlds[i].fndecl);
+
+ if (i == 0 || ovlds[i].stanza != ovlds[i-1].stanza)
+ {
+ ovld_stanza *stanza = &ovld_stanzas[ovlds[i].stanza];
+ fprintf (init_file, "\n");
+
+ /* Check whether we have a "tf" token in this string, representing
+ a float128_type_node. It's possible that float128_type_node is
+ undefined (occurs for -maltivec -mno-vsx, for example), so we
+ must guard against that. */
+ int tf_found = strstr (ovlds[i].fndecl, "tf") != NULL;
+
+ /* Similarly, look for decimal float tokens. */
+ int dfp_found = (strstr (ovlds[i].fndecl, "dd") != NULL
+ || strstr (ovlds[i].fndecl, "td") != NULL
+ || strstr (ovlds[i].fndecl, "sd") != NULL);
+
+ /* The fndecl for an overload is arbitrarily the first one
+ for the overload. We sort out the real types when
+ processing the overload in the gcc front end. */
+ fprintf (init_file,
+ " if (new_builtins_are_live)\n");
+ fprintf (init_file, " {\n");
+
+ if (tf_found)
+ {
+ fprintf (init_file, " if (float128_type_node)\n");
+ fprintf (init_file, " {\n");
+ }
+ else if (dfp_found)
+ {
+ fprintf (init_file, " if (dfloat64_type_node)\n");
+ fprintf (init_file, " {\n");
+ }
+
+ fprintf (init_file,
+ " rs6000_builtin_decls_x[(int)RS6000_OVLD_%s] = t\n",
+ stanza->stanza_id);
+ fprintf (init_file,
+ " = add_builtin_function (\"%s\",\n",
+ stanza->intern_name);
+ fprintf (init_file,
+ " %s,\n",
+ ovlds[i].fndecl);
+ fprintf (init_file,
+ " (int)RS6000_OVLD_%s,"
+ " BUILT_IN_MD,\n",
+ stanza->stanza_id);
+ fprintf (init_file,
+ " NULL, NULL_TREE);\n");
+
+ if (tf_found || dfp_found)
+ fprintf (init_file, " }\n");
+
+ fprintf (init_file, " }\n\n");
+
+ fprintf (init_file,
+ " rs6000_overload_info[RS6000_OVLD_%s - base]"
+ ".first_instance\n",
+ stanza->stanza_id);
+ fprintf (init_file,
+ " = &rs6000_instance_info[RS6000_INST_%s];\n\n",
+ ovlds[i].ovld_id_name);
+ }
+ }
+}
+
/* Write everything to the initialization file (rs6000-builtins.c). */
static int
write_init_file (void)
{
+ write_autogenerated_header (init_file);
+
+ fprintf (init_file, "#include \"config.h\"\n");
+ fprintf (init_file, "#include \"system.h\"\n");
+ fprintf (init_file, "#include \"coretypes.h\"\n");
+ fprintf (init_file, "#include \"backend.h\"\n");
+ fprintf (init_file, "#include \"rtl.h\"\n");
+ fprintf (init_file, "#include \"tree.h\"\n");
+ fprintf (init_file, "#include \"langhooks.h\"\n");
+ fprintf (init_file, "#include \"insn-codes.h\"\n");
+ fprintf (init_file, "#include \"rs6000-builtins.h\"\n");
+ fprintf (init_file, "\n");
+
+ fprintf (init_file, "int new_builtins_are_live = 0;\n\n");
+
+ fprintf (init_file, "tree rs6000_builtin_decls_x[RS6000_OVLD_MAX];\n\n");
+
+ rbt_inorder_callback (&fntype_rbt, fntype_rbt.rbt_root, write_fntype);
+ fprintf (init_file, "\n");
+
+ fprintf (init_file, "void\n");
+ fprintf (init_file, "rs6000_autoinit_builtins ()\n");
+ fprintf (init_file, "{\n");
+ fprintf (init_file, " tree t;\n");
+ rbt_inorder_callback (&fntype_rbt, fntype_rbt.rbt_root, write_fntype_init);
+ fprintf (init_file, "\n");
+
+ fprintf (init_file,
+ " rs6000_builtin_decls_x[RS6000_BIF_NONE] = NULL_TREE;\n");
+ fprintf (init_file,
+ " rs6000_builtin_decls_x[RS6000_BIF_MAX] = NULL_TREE;\n");
+ fprintf (init_file,
+ " rs6000_builtin_decls_x[RS6000_OVLD_NONE] = NULL_TREE;\n\n");
+
+ write_init_bif_table ();
+ write_init_ovld_table ();
+
+ fprintf (init_file, "}\n\n");
+
+ fprintf (init_file,
+ "void gt_ggc_mx (bifdata *bd)\n");
+ fprintf (init_file,
+ "{\n gt_ggc_mx (bd->fntype);\n}\n\n");
+ fprintf (init_file,
+ "void gt_pch_nx (bifdata *bd)\n");
+ fprintf (init_file,
+ "{\n gt_pch_nx (bd->fntype);\n}\n\n");
+ fprintf (init_file,
+ "void gt_pch_nx (bifdata *bd, gt_pointer_operator op, "
+ "void *cookie)\n");
+ fprintf (init_file,
+ "{\n op(&(bd->fntype), cookie);\n}\n\n");
+ fprintf (init_file,
+ "void gt_ggc_mx (ovlddata *od)\n");
+ fprintf (init_file,
+ "{\n gt_ggc_mx (od->fntype);\n}\n\n");
+ fprintf (init_file,
+ "void gt_pch_nx (ovlddata *od)\n");
+ fprintf (init_file,
+ "{\n gt_pch_nx (od->fntype);\n}\n\n");
+ fprintf (init_file,
+ "void gt_pch_nx (ovlddata *od, gt_pointer_operator op, "
+ "void *cookie)\n");
+ fprintf (init_file,
+ "{\n op(&(od->fntype), cookie);\n}\n");
+
return 1;
}
^ permalink raw reply [flat|nested] 6+ messages in thread
* [gcc(refs/users/wschmidt/heads/builtins10)] rs6000: Write output to the builtins init file, part 1 of 3
@ 2021-06-25 16:16 William Schmidt
0 siblings, 0 replies; 6+ messages in thread
From: William Schmidt @ 2021-06-25 16:16 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:9b7092a69c5849d5b4911c01054481fdc7a0e099
commit 9b7092a69c5849d5b4911c01054481fdc7a0e099
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date: Mon Jun 7 14:37:54 2021 -0500
rs6000: Write output to the builtins init file, part 1 of 3
2021-06-07 Bill Schmidt <wschmidt@linux.ibm.com>
gcc/
* config/rs6000/rs6000-gen-builtins.c (write_fntype): New
callback function.
(write_fntype_init): New stub function.
(write_init_bif_table): Likewise.
(write_init_ovld_table): New function.
(write_init_file): Implement.
Diff:
---
gcc/config/rs6000/rs6000-gen-builtins.c | 163 ++++++++++++++++++++++++++++++++
1 file changed, 163 insertions(+)
diff --git a/gcc/config/rs6000/rs6000-gen-builtins.c b/gcc/config/rs6000/rs6000-gen-builtins.c
index 6f393ee46d3..2240dfc030f 100644
--- a/gcc/config/rs6000/rs6000-gen-builtins.c
+++ b/gcc/config/rs6000/rs6000-gen-builtins.c
@@ -2202,6 +2202,18 @@ write_extern_fntype (char *str)
fprintf (header_file, "extern GTY(()) tree %s;\n", str);
}
+void
+write_fntype (char *str)
+{
+ fprintf (init_file, "tree %s;\n", str);
+}
+
+/* Write an initializer for a function type identified by STR. */
+void
+write_fntype_init (char *str)
+{
+}
+
/* Write everything to the header file (rs6000-builtins.h). */
static int
write_header_file (void)
@@ -2222,10 +2234,161 @@ write_header_file (void)
return 1;
}
+/* Write code to initialize the built-in function table. */
+static void
+write_init_bif_table (void)
+{
+}
+
+/* Write code to initialize the overload table. */
+static void
+write_init_ovld_table (void)
+{
+ fprintf (init_file, " int base = RS6000_OVLD_NONE;\n\n");
+
+ for (int i = 0; i <= curr_ovld; i++)
+ {
+ fprintf (init_file,
+ " rs6000_instance_info[RS6000_INST_%s].fntype"
+ "\n = %s;\n",
+ ovlds[i].ovld_id_name, ovlds[i].fndecl);
+
+ if (i == 0 || ovlds[i].stanza != ovlds[i-1].stanza)
+ {
+ ovld_stanza *stanza = &ovld_stanzas[ovlds[i].stanza];
+ fprintf (init_file, "\n");
+
+ /* Check whether we have a "tf" token in this string, representing
+ a float128_type_node. It's possible that float128_type_node is
+ undefined (occurs for -maltivec -mno-vsx, for example), so we
+ must guard against that. */
+ int tf_found = strstr (ovlds[i].fndecl, "tf") != NULL;
+
+ /* Similarly, look for decimal float tokens. */
+ int dfp_found = (strstr (ovlds[i].fndecl, "dd") != NULL
+ || strstr (ovlds[i].fndecl, "td") != NULL
+ || strstr (ovlds[i].fndecl, "sd") != NULL);
+
+ /* The fndecl for an overload is arbitrarily the first one
+ for the overload. We sort out the real types when
+ processing the overload in the gcc front end. */
+ fprintf (init_file,
+ " if (new_builtins_are_live)\n");
+ fprintf (init_file, " {\n");
+
+ if (tf_found)
+ {
+ fprintf (init_file, " if (float128_type_node)\n");
+ fprintf (init_file, " {\n");
+ }
+ else if (dfp_found)
+ {
+ fprintf (init_file, " if (dfloat64_type_node)\n");
+ fprintf (init_file, " {\n");
+ }
+
+ fprintf (init_file,
+ " rs6000_builtin_decls_x[(int)RS6000_OVLD_%s] = t\n",
+ stanza->stanza_id);
+ fprintf (init_file,
+ " = add_builtin_function (\"%s\",\n",
+ stanza->intern_name);
+ fprintf (init_file,
+ " %s,\n",
+ ovlds[i].fndecl);
+ fprintf (init_file,
+ " (int)RS6000_OVLD_%s,"
+ " BUILT_IN_MD,\n",
+ stanza->stanza_id);
+ fprintf (init_file,
+ " NULL, NULL_TREE);\n");
+
+ if (tf_found || dfp_found)
+ fprintf (init_file, " }\n");
+
+ fprintf (init_file, " }\n\n");
+
+ fprintf (init_file,
+ " rs6000_overload_info[RS6000_OVLD_%s - base]"
+ ".first_instance\n",
+ stanza->stanza_id);
+ fprintf (init_file,
+ " = &rs6000_instance_info[RS6000_INST_%s];\n\n",
+ ovlds[i].ovld_id_name);
+ }
+ }
+}
+
/* Write everything to the initialization file (rs6000-builtins.c). */
static int
write_init_file (void)
{
+ write_autogenerated_header (init_file);
+
+ fprintf (init_file, "#include \"config.h\"\n");
+ fprintf (init_file, "#include \"system.h\"\n");
+ fprintf (init_file, "#include \"coretypes.h\"\n");
+ fprintf (init_file, "#include \"backend.h\"\n");
+ fprintf (init_file, "#include \"rtl.h\"\n");
+ fprintf (init_file, "#include \"tree.h\"\n");
+ fprintf (init_file, "#include \"langhooks.h\"\n");
+ fprintf (init_file, "#include \"insn-codes.h\"\n");
+ fprintf (init_file, "#include \"rs6000-builtins.h\"\n");
+ fprintf (init_file, "\n");
+
+ fprintf (init_file, "int new_builtins_are_live = 0;\n\n");
+
+ fprintf (init_file, "tree rs6000_builtin_decls_x[RS6000_OVLD_MAX];\n\n");
+
+ rbt_inorder_callback (&fntype_rbt, fntype_rbt.rbt_root, write_fntype);
+ fprintf (init_file, "\n");
+
+ fprintf (init_file, "void\n");
+ fprintf (init_file, "rs6000_autoinit_builtins ()\n");
+ fprintf (init_file, "{\n");
+ fprintf (init_file, " tree t;\n");
+ rbt_inorder_callback (&fntype_rbt, fntype_rbt.rbt_root, write_fntype_init);
+ fprintf (init_file, "\n");
+
+ fprintf (init_file,
+ " rs6000_builtin_decls_x[RS6000_BIF_NONE] = NULL_TREE;\n");
+ fprintf (init_file,
+ " rs6000_builtin_decls_x[RS6000_BIF_MAX] = NULL_TREE;\n");
+ fprintf (init_file,
+ " rs6000_builtin_decls_x[RS6000_OVLD_NONE] = NULL_TREE;\n\n");
+
+ write_init_bif_table ();
+ write_init_ovld_table ();
+
+ fprintf (init_file, "}\n\n");
+
+ fprintf (init_file,
+ "void gt_ggc_mx (bifdata *bd)\n");
+ fprintf (init_file,
+ "{\n gt_ggc_mx (bd->fntype);\n}\n\n");
+ fprintf (init_file,
+ "void gt_pch_nx (bifdata *bd)\n");
+ fprintf (init_file,
+ "{\n gt_pch_nx (bd->fntype);\n}\n\n");
+ fprintf (init_file,
+ "void gt_pch_nx (bifdata *bd, gt_pointer_operator op, "
+ "void *cookie)\n");
+ fprintf (init_file,
+ "{\n op(&(bd->fntype), cookie);\n}\n\n");
+ fprintf (init_file,
+ "void gt_ggc_mx (ovlddata *od)\n");
+ fprintf (init_file,
+ "{\n gt_ggc_mx (od->fntype);\n}\n\n");
+ fprintf (init_file,
+ "void gt_pch_nx (ovlddata *od)\n");
+ fprintf (init_file,
+ "{\n gt_pch_nx (od->fntype);\n}\n\n");
+ fprintf (init_file,
+ "void gt_pch_nx (ovlddata *od, gt_pointer_operator op, "
+ "void *cookie)\n");
+ fprintf (init_file,
+ "{\n op(&(od->fntype), cookie);\n}\n");
+
return 1;
}
^ permalink raw reply [flat|nested] 6+ messages in thread
* [gcc(refs/users/wschmidt/heads/builtins10)] rs6000: Write output to the builtins init file, part 1 of 3
@ 2021-04-26 20:49 William Schmidt
0 siblings, 0 replies; 6+ messages in thread
From: William Schmidt @ 2021-04-26 20:49 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:a883e914311f35f2a4e1df291e37fdf261028dde
commit a883e914311f35f2a4e1df291e37fdf261028dde
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date: Thu Apr 1 13:01:45 2021 -0500
rs6000: Write output to the builtins init file, part 1 of 3
2021-04-01 Bill Schmidt <wschmidt@linux.ibm.com>
gcc/
* config/rs6000/rs6000-gen-builtins.c (write_fntype): New
function.
(write_fntype_init): New stub function.
(write_init_bif_table): Likewise.
(write_init_ovld_table): New function.
(write_init_file): Implement.
Diff:
---
gcc/config/rs6000/rs6000-gen-builtins.c | 153 ++++++++++++++++++++++++++++++++
1 file changed, 153 insertions(+)
diff --git a/gcc/config/rs6000/rs6000-gen-builtins.c b/gcc/config/rs6000/rs6000-gen-builtins.c
index 48d28af6366..28810f56ec2 100644
--- a/gcc/config/rs6000/rs6000-gen-builtins.c
+++ b/gcc/config/rs6000/rs6000-gen-builtins.c
@@ -2236,6 +2236,18 @@ write_extern_fntype (char *str)
fprintf (header_file, "extern GTY(()) tree %s;\n", str);
}
+void
+write_fntype (char *str)
+{
+ fprintf (init_file, "tree %s;\n", str);
+}
+
+/* Write an initializer for a function type identified by STR. */
+void
+write_fntype_init (char *str)
+{
+}
+
/* Write everything to the header file (rs6000-builtins.h). */
static int
write_header_file ()
@@ -2256,10 +2268,151 @@ write_header_file ()
return 1;
}
+/* Write code to initialize the built-in function table. */
+static void
+write_init_bif_table ()
+{
+}
+
+/* Write code to initialize the overload table. */
+static void
+write_init_ovld_table ()
+{
+ fprintf (init_file, " int base = RS6000_OVLD_NONE;\n\n");
+
+ for (int i = 0; i <= curr_ovld; i++)
+ {
+ fprintf (init_file,
+ " rs6000_instance_info[RS6000_INST_%s].fntype"
+ "\n = %s;\n",
+ ovlds[i].ovld_id_name, ovlds[i].fndecl);
+
+ if (i == 0 || ovlds[i].stanza != ovlds[i-1].stanza)
+ {
+ ovld_stanza *stanza = &ovld_stanzas[ovlds[i].stanza];
+ fprintf (init_file, "\n");
+
+ /* Check whether we have a "tf" token in this string, representing
+ a float128_type_node. It's possible that float128_type_node is
+ undefined (occurs for -maltivec -mno-vsx, for example), so we
+ must guard against that. */
+ int tf_found = strstr (ovlds[i].fndecl, "tf") != NULL;
+
+ /* The fndecl for an overload is arbitrarily the first one
+ for the overload. We sort out the real types when
+ processing the overload in the gcc front end. */
+ fprintf (init_file,
+ " if (new_builtins_are_live)\n");
+ fprintf (init_file, " {\n");
+
+ if (tf_found)
+ {
+ fprintf (init_file, " if (float128_type_node)\n");
+ fprintf (init_file, " {\n");
+ }
+
+ fprintf (init_file,
+ " rs6000_builtin_decls_x[(int)RS6000_OVLD_%s] = t\n",
+ stanza->stanza_id);
+ fprintf (init_file,
+ " = add_builtin_function (\"%s\",\n",
+ stanza->intern_name);
+ fprintf (init_file,
+ " %s,\n",
+ ovlds[i].fndecl);
+ fprintf (init_file,
+ " (int)RS6000_OVLD_%s,"
+ " BUILT_IN_MD,\n",
+ stanza->stanza_id);
+ fprintf (init_file,
+ " NULL, NULL_TREE);\n");
+
+ if (tf_found)
+ fprintf (init_file, " }\n");
+
+ fprintf (init_file, " }\n\n");
+
+ fprintf (init_file,
+ " rs6000_overload_info[RS6000_OVLD_%s - base]"
+ ".first_instance\n",
+ stanza->stanza_id);
+ fprintf (init_file,
+ " = &rs6000_instance_info[RS6000_INST_%s];\n\n",
+ ovlds[i].ovld_id_name);
+ }
+ }
+}
+
/* Write everything to the initialization file (rs6000-builtins.c). */
static int
write_init_file ()
{
+ write_autogenerated_header (init_file);
+
+ fprintf (init_file, "#include \"config.h\"\n");
+ fprintf (init_file, "#include \"system.h\"\n");
+ fprintf (init_file, "#include \"coretypes.h\"\n");
+ fprintf (init_file, "#include \"backend.h\"\n");
+ fprintf (init_file, "#include \"rtl.h\"\n");
+ fprintf (init_file, "#include \"tree.h\"\n");
+ fprintf (init_file, "#include \"langhooks.h\"\n");
+ fprintf (init_file, "#include \"insn-codes.h\"\n");
+ fprintf (init_file, "#include \"rs6000-builtins.h\"\n");
+ fprintf (init_file, "\n");
+
+ fprintf (init_file, "int new_builtins_are_live = 0;\n\n");
+
+ fprintf (init_file, "tree rs6000_builtin_decls_x[RS6000_OVLD_MAX];\n\n");
+
+ rbt_inorder_callback (&fntype_rbt, fntype_rbt.rbt_root, write_fntype);
+ fprintf (init_file, "\n");
+
+ fprintf (init_file, "void\n");
+ fprintf (init_file, "rs6000_autoinit_builtins ()\n");
+ fprintf (init_file, "{\n");
+ fprintf (init_file, " tree t;\n");
+ rbt_inorder_callback (&fntype_rbt, fntype_rbt.rbt_root, write_fntype_init);
+ fprintf (init_file, "\n");
+
+ fprintf (init_file,
+ " rs6000_builtin_decls_x[RS6000_BIF_NONE] = NULL_TREE;\n");
+ fprintf (init_file,
+ " rs6000_builtin_decls_x[RS6000_BIF_MAX] = NULL_TREE;\n");
+ fprintf (init_file,
+ " rs6000_builtin_decls_x[RS6000_OVLD_NONE] = NULL_TREE;\n\n");
+
+ write_init_bif_table ();
+ write_init_ovld_table ();
+
+ fprintf (init_file, "}\n\n");
+
+ fprintf (init_file,
+ "void gt_ggc_mx (bifdata *bd)\n");
+ fprintf (init_file,
+ "{\n gt_ggc_mx (bd->fntype);\n}\n\n");
+ fprintf (init_file,
+ "void gt_pch_nx (bifdata *bd)\n");
+ fprintf (init_file,
+ "{\n gt_pch_nx (bd->fntype);\n}\n\n");
+ fprintf (init_file,
+ "void gt_pch_nx (bifdata *bd, gt_pointer_operator op, "
+ "void *cookie)\n");
+ fprintf (init_file,
+ "{\n op(&(bd->fntype), cookie);\n}\n\n");
+ fprintf (init_file,
+ "void gt_ggc_mx (ovlddata *od)\n");
+ fprintf (init_file,
+ "{\n gt_ggc_mx (od->fntype);\n}\n\n");
+ fprintf (init_file,
+ "void gt_pch_nx (ovlddata *od)\n");
+ fprintf (init_file,
+ "{\n gt_pch_nx (od->fntype);\n}\n\n");
+ fprintf (init_file,
+ "void gt_pch_nx (ovlddata *od, gt_pointer_operator op, "
+ "void *cookie)\n");
+ fprintf (init_file,
+ "{\n op(&(od->fntype), cookie);\n}\n");
+
return 1;
}
^ permalink raw reply [flat|nested] 6+ messages in thread
* [gcc(refs/users/wschmidt/heads/builtins10)] rs6000: Write output to the builtins init file, part 1 of 3
@ 2021-04-02 22:10 William Schmidt
0 siblings, 0 replies; 6+ messages in thread
From: William Schmidt @ 2021-04-02 22:10 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:c9c0f2d5c41f47fdb94d35a35396c27af99b0f15
commit c9c0f2d5c41f47fdb94d35a35396c27af99b0f15
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date: Thu Apr 1 13:01:45 2021 -0500
rs6000: Write output to the builtins init file, part 1 of 3
2021-04-01 Bill Schmidt <wschmidt@linux.ibm.com>
gcc/
* config/rs6000/rs6000-gen-builtins.c (write_fntype): New
function.
(write_fntype_init): New stub function.
(write_init_bif_table): Likewise.
(write_init_ovld_table): New function.
(write_init_file): Implement.
Diff:
---
gcc/config/rs6000/rs6000-gen-builtins.c | 153 ++++++++++++++++++++++++++++++++
1 file changed, 153 insertions(+)
diff --git a/gcc/config/rs6000/rs6000-gen-builtins.c b/gcc/config/rs6000/rs6000-gen-builtins.c
index 48d28af6366..28810f56ec2 100644
--- a/gcc/config/rs6000/rs6000-gen-builtins.c
+++ b/gcc/config/rs6000/rs6000-gen-builtins.c
@@ -2236,6 +2236,18 @@ write_extern_fntype (char *str)
fprintf (header_file, "extern GTY(()) tree %s;\n", str);
}
+void
+write_fntype (char *str)
+{
+ fprintf (init_file, "tree %s;\n", str);
+}
+
+/* Write an initializer for a function type identified by STR. */
+void
+write_fntype_init (char *str)
+{
+}
+
/* Write everything to the header file (rs6000-builtins.h). */
static int
write_header_file ()
@@ -2256,10 +2268,151 @@ write_header_file ()
return 1;
}
+/* Write code to initialize the built-in function table. */
+static void
+write_init_bif_table ()
+{
+}
+
+/* Write code to initialize the overload table. */
+static void
+write_init_ovld_table ()
+{
+ fprintf (init_file, " int base = RS6000_OVLD_NONE;\n\n");
+
+ for (int i = 0; i <= curr_ovld; i++)
+ {
+ fprintf (init_file,
+ " rs6000_instance_info[RS6000_INST_%s].fntype"
+ "\n = %s;\n",
+ ovlds[i].ovld_id_name, ovlds[i].fndecl);
+
+ if (i == 0 || ovlds[i].stanza != ovlds[i-1].stanza)
+ {
+ ovld_stanza *stanza = &ovld_stanzas[ovlds[i].stanza];
+ fprintf (init_file, "\n");
+
+ /* Check whether we have a "tf" token in this string, representing
+ a float128_type_node. It's possible that float128_type_node is
+ undefined (occurs for -maltivec -mno-vsx, for example), so we
+ must guard against that. */
+ int tf_found = strstr (ovlds[i].fndecl, "tf") != NULL;
+
+ /* The fndecl for an overload is arbitrarily the first one
+ for the overload. We sort out the real types when
+ processing the overload in the gcc front end. */
+ fprintf (init_file,
+ " if (new_builtins_are_live)\n");
+ fprintf (init_file, " {\n");
+
+ if (tf_found)
+ {
+ fprintf (init_file, " if (float128_type_node)\n");
+ fprintf (init_file, " {\n");
+ }
+
+ fprintf (init_file,
+ " rs6000_builtin_decls_x[(int)RS6000_OVLD_%s] = t\n",
+ stanza->stanza_id);
+ fprintf (init_file,
+ " = add_builtin_function (\"%s\",\n",
+ stanza->intern_name);
+ fprintf (init_file,
+ " %s,\n",
+ ovlds[i].fndecl);
+ fprintf (init_file,
+ " (int)RS6000_OVLD_%s,"
+ " BUILT_IN_MD,\n",
+ stanza->stanza_id);
+ fprintf (init_file,
+ " NULL, NULL_TREE);\n");
+
+ if (tf_found)
+ fprintf (init_file, " }\n");
+
+ fprintf (init_file, " }\n\n");
+
+ fprintf (init_file,
+ " rs6000_overload_info[RS6000_OVLD_%s - base]"
+ ".first_instance\n",
+ stanza->stanza_id);
+ fprintf (init_file,
+ " = &rs6000_instance_info[RS6000_INST_%s];\n\n",
+ ovlds[i].ovld_id_name);
+ }
+ }
+}
+
/* Write everything to the initialization file (rs6000-builtins.c). */
static int
write_init_file ()
{
+ write_autogenerated_header (init_file);
+
+ fprintf (init_file, "#include \"config.h\"\n");
+ fprintf (init_file, "#include \"system.h\"\n");
+ fprintf (init_file, "#include \"coretypes.h\"\n");
+ fprintf (init_file, "#include \"backend.h\"\n");
+ fprintf (init_file, "#include \"rtl.h\"\n");
+ fprintf (init_file, "#include \"tree.h\"\n");
+ fprintf (init_file, "#include \"langhooks.h\"\n");
+ fprintf (init_file, "#include \"insn-codes.h\"\n");
+ fprintf (init_file, "#include \"rs6000-builtins.h\"\n");
+ fprintf (init_file, "\n");
+
+ fprintf (init_file, "int new_builtins_are_live = 0;\n\n");
+
+ fprintf (init_file, "tree rs6000_builtin_decls_x[RS6000_OVLD_MAX];\n\n");
+
+ rbt_inorder_callback (&fntype_rbt, fntype_rbt.rbt_root, write_fntype);
+ fprintf (init_file, "\n");
+
+ fprintf (init_file, "void\n");
+ fprintf (init_file, "rs6000_autoinit_builtins ()\n");
+ fprintf (init_file, "{\n");
+ fprintf (init_file, " tree t;\n");
+ rbt_inorder_callback (&fntype_rbt, fntype_rbt.rbt_root, write_fntype_init);
+ fprintf (init_file, "\n");
+
+ fprintf (init_file,
+ " rs6000_builtin_decls_x[RS6000_BIF_NONE] = NULL_TREE;\n");
+ fprintf (init_file,
+ " rs6000_builtin_decls_x[RS6000_BIF_MAX] = NULL_TREE;\n");
+ fprintf (init_file,
+ " rs6000_builtin_decls_x[RS6000_OVLD_NONE] = NULL_TREE;\n\n");
+
+ write_init_bif_table ();
+ write_init_ovld_table ();
+
+ fprintf (init_file, "}\n\n");
+
+ fprintf (init_file,
+ "void gt_ggc_mx (bifdata *bd)\n");
+ fprintf (init_file,
+ "{\n gt_ggc_mx (bd->fntype);\n}\n\n");
+ fprintf (init_file,
+ "void gt_pch_nx (bifdata *bd)\n");
+ fprintf (init_file,
+ "{\n gt_pch_nx (bd->fntype);\n}\n\n");
+ fprintf (init_file,
+ "void gt_pch_nx (bifdata *bd, gt_pointer_operator op, "
+ "void *cookie)\n");
+ fprintf (init_file,
+ "{\n op(&(bd->fntype), cookie);\n}\n\n");
+ fprintf (init_file,
+ "void gt_ggc_mx (ovlddata *od)\n");
+ fprintf (init_file,
+ "{\n gt_ggc_mx (od->fntype);\n}\n\n");
+ fprintf (init_file,
+ "void gt_pch_nx (ovlddata *od)\n");
+ fprintf (init_file,
+ "{\n gt_pch_nx (od->fntype);\n}\n\n");
+ fprintf (init_file,
+ "void gt_pch_nx (ovlddata *od, gt_pointer_operator op, "
+ "void *cookie)\n");
+ fprintf (init_file,
+ "{\n op(&(od->fntype), cookie);\n}\n");
+
return 1;
}
^ permalink raw reply [flat|nested] 6+ messages in thread
* [gcc(refs/users/wschmidt/heads/builtins10)] rs6000: Write output to the builtins init file, part 1 of 3
@ 2021-04-01 19:48 William Schmidt
0 siblings, 0 replies; 6+ messages in thread
From: William Schmidt @ 2021-04-01 19:48 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:dd148cd6163712d881fd621557525af2bff85016
commit dd148cd6163712d881fd621557525af2bff85016
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date: Thu Apr 1 13:01:45 2021 -0500
rs6000: Write output to the builtins init file, part 1 of 3
2021-04-01 Bill Schmidt <wschmidt@linux.ibm.com>
gcc/
* config/rs6000/rs6000-gen-builtins.c (write_fntype): New
function.
(write_fntype_init): New stub function.
(write_init_bif_table): Likewise.
(write_init_ovld_table): New function.
(write_init_file): Implement.
Diff:
---
gcc/config/rs6000/rs6000-gen-builtins.c | 153 ++++++++++++++++++++++++++++++++
1 file changed, 153 insertions(+)
diff --git a/gcc/config/rs6000/rs6000-gen-builtins.c b/gcc/config/rs6000/rs6000-gen-builtins.c
index 9e216b54805..ef4a070340d 100644
--- a/gcc/config/rs6000/rs6000-gen-builtins.c
+++ b/gcc/config/rs6000/rs6000-gen-builtins.c
@@ -2235,6 +2235,18 @@ write_extern_fntype (char *str)
fprintf (header_file, "extern GTY(()) tree %s;\n", str);
}
+void
+write_fntype (char *str)
+{
+ fprintf (init_file, "tree %s;\n", str);
+}
+
+/* Write an initializer for a function type identified by STR. */
+void
+write_fntype_init (char *str)
+{
+}
+
/* Write everything to the header file (rs6000-builtins.h). */
static int
write_header_file ()
@@ -2255,10 +2267,151 @@ write_header_file ()
return 1;
}
+/* Write code to initialize the built-in function table. */
+static void
+write_init_bif_table ()
+{
+}
+
+/* Write code to initialize the overload table. */
+static void
+write_init_ovld_table ()
+{
+ fprintf (init_file, " int base = RS6000_OVLD_NONE;\n\n");
+
+ for (int i = 0; i <= curr_ovld; i++)
+ {
+ fprintf (init_file,
+ " rs6000_instance_info[RS6000_INST_%s].fntype"
+ "\n = %s;\n",
+ ovlds[i].ovld_id_name, ovlds[i].fndecl);
+
+ if (i == 0 || ovlds[i].stanza != ovlds[i-1].stanza)
+ {
+ ovld_stanza *stanza = &ovld_stanzas[ovlds[i].stanza];
+ fprintf (init_file, "\n");
+
+ /* Check whether we have a "tf" token in this string, representing
+ a float128_type_node. It's possible that float128_type_node is
+ undefined (occurs for -maltivec -mno-vsx, for example), so we
+ must guard against that. */
+ int tf_found = strstr (ovlds[i].fndecl, "tf") != NULL;
+
+ /* The fndecl for an overload is arbitrarily the first one
+ for the overload. We sort out the real types when
+ processing the overload in the gcc front end. */
+ fprintf (init_file,
+ " if (new_builtins_are_live)\n");
+ fprintf (init_file, " {\n");
+
+ if (tf_found)
+ {
+ fprintf (init_file, " if (float128_type_node)\n");
+ fprintf (init_file, " {\n");
+ }
+
+ fprintf (init_file,
+ " rs6000_builtin_decls_x[(int)RS6000_OVLD_%s] = t\n",
+ stanza->stanza_id);
+ fprintf (init_file,
+ " = add_builtin_function (\"%s\",\n",
+ stanza->intern_name);
+ fprintf (init_file,
+ " %s,\n",
+ ovlds[i].fndecl);
+ fprintf (init_file,
+ " (int)RS6000_OVLD_%s,"
+ " BUILT_IN_MD,\n",
+ stanza->stanza_id);
+ fprintf (init_file,
+ " NULL, NULL_TREE);\n");
+
+ if (tf_found)
+ fprintf (init_file, " }\n");
+
+ fprintf (init_file, " }\n\n");
+
+ fprintf (init_file,
+ " rs6000_overload_info[RS6000_OVLD_%s - base]"
+ ".first_instance\n",
+ stanza->stanza_id);
+ fprintf (init_file,
+ " = &rs6000_instance_info[RS6000_INST_%s];\n\n",
+ ovlds[i].ovld_id_name);
+ }
+ }
+}
+
/* Write everything to the initialization file (rs6000-builtins.c). */
static int
write_init_file ()
{
+ write_autogenerated_header (init_file);
+
+ fprintf (init_file, "#include \"config.h\"\n");
+ fprintf (init_file, "#include \"system.h\"\n");
+ fprintf (init_file, "#include \"coretypes.h\"\n");
+ fprintf (init_file, "#include \"backend.h\"\n");
+ fprintf (init_file, "#include \"rtl.h\"\n");
+ fprintf (init_file, "#include \"tree.h\"\n");
+ fprintf (init_file, "#include \"langhooks.h\"\n");
+ fprintf (init_file, "#include \"insn-codes.h\"\n");
+ fprintf (init_file, "#include \"rs6000-builtins.h\"\n");
+ fprintf (init_file, "\n");
+
+ fprintf (init_file, "int new_builtins_are_live = 0;\n\n");
+
+ fprintf (init_file, "tree rs6000_builtin_decls_x[RS6000_OVLD_MAX];\n\n");
+
+ rbt_inorder_callback (&fntype_rbt, fntype_rbt.rbt_root, write_fntype);
+ fprintf (init_file, "\n");
+
+ fprintf (init_file, "void\n");
+ fprintf (init_file, "rs6000_autoinit_builtins ()\n");
+ fprintf (init_file, "{\n");
+ fprintf (init_file, " tree t;\n");
+ rbt_inorder_callback (&fntype_rbt, fntype_rbt.rbt_root, write_fntype_init);
+ fprintf (init_file, "\n");
+
+ fprintf (init_file,
+ " rs6000_builtin_decls_x[RS6000_BIF_NONE] = NULL_TREE;\n");
+ fprintf (init_file,
+ " rs6000_builtin_decls_x[RS6000_BIF_MAX] = NULL_TREE;\n");
+ fprintf (init_file,
+ " rs6000_builtin_decls_x[RS6000_OVLD_NONE] = NULL_TREE;\n\n");
+
+ write_init_bif_table ();
+ write_init_ovld_table ();
+
+ fprintf (init_file, "}\n\n");
+
+ fprintf (init_file,
+ "void gt_ggc_mx (bifdata *bd)\n");
+ fprintf (init_file,
+ "{\n gt_ggc_mx (bd->fntype);\n}\n\n");
+ fprintf (init_file,
+ "void gt_pch_nx (bifdata *bd)\n");
+ fprintf (init_file,
+ "{\n gt_pch_nx (bd->fntype);\n}\n\n");
+ fprintf (init_file,
+ "void gt_pch_nx (bifdata *bd, gt_pointer_operator op, "
+ "void *cookie)\n");
+ fprintf (init_file,
+ "{\n op(&(bd->fntype), cookie);\n}\n\n");
+ fprintf (init_file,
+ "void gt_ggc_mx (ovlddata *od)\n");
+ fprintf (init_file,
+ "{\n gt_ggc_mx (od->fntype);\n}\n\n");
+ fprintf (init_file,
+ "void gt_pch_nx (ovlddata *od)\n");
+ fprintf (init_file,
+ "{\n gt_pch_nx (od->fntype);\n}\n\n");
+ fprintf (init_file,
+ "void gt_pch_nx (ovlddata *od, gt_pointer_operator op, "
+ "void *cookie)\n");
+ fprintf (init_file,
+ "{\n op(&(od->fntype), cookie);\n}\n");
+
return 1;
}
^ permalink raw reply [flat|nested] 6+ messages in thread
* [gcc(refs/users/wschmidt/heads/builtins10)] rs6000: Write output to the builtins init file, part 1 of 3
@ 2021-03-25 15:45 William Schmidt
0 siblings, 0 replies; 6+ messages in thread
From: William Schmidt @ 2021-03-25 15:45 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:a5f1d973800f338d6d74279a76c2a415ad731493
commit a5f1d973800f338d6d74279a76c2a415ad731493
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date: Wed Mar 3 16:58:42 2021 -0600
rs6000: Write output to the builtins init file, part 1 of 3
2021-03-03 Bill Schmidt <wschmidt@linux.ibm.com>
gcc/
* config/rs6000/rs6000-gen-builtins.c (write_fntype): New
function.
(write_fntype_init): New stub function.
(write_init_bif_table): Likewise.
(write_init_ovld_table): New function.
(write_init_file): Implement.
Diff:
---
gcc/config/rs6000/rs6000-gen-builtins.c | 136 ++++++++++++++++++++++++++++++++
1 file changed, 136 insertions(+)
diff --git a/gcc/config/rs6000/rs6000-gen-builtins.c b/gcc/config/rs6000/rs6000-gen-builtins.c
index 9e216b54805..097c3cf08f5 100644
--- a/gcc/config/rs6000/rs6000-gen-builtins.c
+++ b/gcc/config/rs6000/rs6000-gen-builtins.c
@@ -2235,6 +2235,18 @@ write_extern_fntype (char *str)
fprintf (header_file, "extern GTY(()) tree %s;\n", str);
}
+void
+write_fntype (char *str)
+{
+ fprintf (init_file, "tree %s;\n", str);
+}
+
+/* Write an initializer for a function type identified by STR. */
+void
+write_fntype_init (char *str)
+{
+}
+
/* Write everything to the header file (rs6000-builtins.h). */
static int
write_header_file ()
@@ -2255,10 +2267,134 @@ write_header_file ()
return 1;
}
+/* Write code to initialize the built-in function table. */
+static void
+write_init_bif_table ()
+{
+}
+
+/* Write code to initialize the overload table. */
+static void
+write_init_ovld_table ()
+{
+ fprintf (init_file, " int base = RS6000_OVLD_NONE;\n\n");
+
+ for (int i = 0; i <= curr_ovld; i++)
+ {
+ fprintf (init_file,
+ " rs6000_instance_info[RS6000_INST_%s].fntype"
+ "\n = %s;\n",
+ ovlds[i].ovld_id_name, ovlds[i].fndecl);
+
+ if (i == 0 || ovlds[i].stanza != ovlds[i-1].stanza)
+ {
+ ovld_stanza *stanza = &ovld_stanzas[ovlds[i].stanza];
+ fprintf (init_file, "\n");
+
+ /* The fndecl for an overload is arbitrarily the first one
+ for the overload. We sort out the real types when
+ processing the overload in the gcc front end. */
+ fprintf (init_file,
+ " if (new_builtins_are_live)\n");
+ fprintf (init_file, " {\n");
+ fprintf (init_file,
+ " rs6000_builtin_decls_x[(int)RS6000_OVLD_%s] = t\n",
+ stanza->stanza_id);
+ fprintf (init_file,
+ " = add_builtin_function (\"%s\",\n",
+ stanza->intern_name);
+ fprintf (init_file,
+ " %s,\n",
+ ovlds[i].fndecl);
+ fprintf (init_file,
+ " (int)RS6000_OVLD_%s,"
+ " BUILT_IN_MD,\n",
+ stanza->stanza_id);
+ fprintf (init_file,
+ " NULL, NULL_TREE);\n");
+ fprintf (init_file, " }\n\n");
+
+ fprintf (init_file,
+ " rs6000_overload_info[RS6000_OVLD_%s - base]"
+ ".first_instance\n",
+ stanza->stanza_id);
+ fprintf (init_file,
+ " = &rs6000_instance_info[RS6000_INST_%s];\n\n",
+ ovlds[i].ovld_id_name);
+ }
+ }
+}
+
/* Write everything to the initialization file (rs6000-builtins.c). */
static int
write_init_file ()
{
+ write_autogenerated_header (init_file);
+
+ fprintf (init_file, "#include \"config.h\"\n");
+ fprintf (init_file, "#include \"system.h\"\n");
+ fprintf (init_file, "#include \"coretypes.h\"\n");
+ fprintf (init_file, "#include \"backend.h\"\n");
+ fprintf (init_file, "#include \"rtl.h\"\n");
+ fprintf (init_file, "#include \"tree.h\"\n");
+ fprintf (init_file, "#include \"langhooks.h\"\n");
+ fprintf (init_file, "#include \"insn-codes.h\"\n");
+ fprintf (init_file, "#include \"rs6000-builtins.h\"\n");
+ fprintf (init_file, "\n");
+
+ fprintf (init_file, "int new_builtins_are_live = 0;\n\n");
+
+ fprintf (init_file, "tree rs6000_builtin_decls_x[RS6000_OVLD_MAX];\n\n");
+
+ rbt_inorder_callback (&fntype_rbt, fntype_rbt.rbt_root, write_fntype);
+ fprintf (init_file, "\n");
+
+ fprintf (init_file, "void\n");
+ fprintf (init_file, "rs6000_autoinit_builtins ()\n");
+ fprintf (init_file, "{\n");
+ fprintf (init_file, " tree t;\n");
+ rbt_inorder_callback (&fntype_rbt, fntype_rbt.rbt_root, write_fntype_init);
+ fprintf (init_file, "\n");
+
+ fprintf (init_file,
+ " rs6000_builtin_decls_x[RS6000_BIF_NONE] = NULL_TREE;\n");
+ fprintf (init_file,
+ " rs6000_builtin_decls_x[RS6000_BIF_MAX] = NULL_TREE;\n");
+ fprintf (init_file,
+ " rs6000_builtin_decls_x[RS6000_OVLD_NONE] = NULL_TREE;\n\n");
+
+ write_init_bif_table ();
+ write_init_ovld_table ();
+
+ fprintf (init_file, "}\n\n");
+
+ fprintf (init_file,
+ "void gt_ggc_mx (bifdata *bd)\n");
+ fprintf (init_file,
+ "{\n gt_ggc_mx (bd->fntype);\n}\n\n");
+ fprintf (init_file,
+ "void gt_pch_nx (bifdata *bd)\n");
+ fprintf (init_file,
+ "{\n gt_pch_nx (bd->fntype);\n}\n\n");
+ fprintf (init_file,
+ "void gt_pch_nx (bifdata *bd, gt_pointer_operator op, "
+ "void *cookie)\n");
+ fprintf (init_file,
+ "{\n op(&(bd->fntype), cookie);\n}\n\n");
+ fprintf (init_file,
+ "void gt_ggc_mx (ovlddata *od)\n");
+ fprintf (init_file,
+ "{\n gt_ggc_mx (od->fntype);\n}\n\n");
+ fprintf (init_file,
+ "void gt_pch_nx (ovlddata *od)\n");
+ fprintf (init_file,
+ "{\n gt_pch_nx (od->fntype);\n}\n\n");
+ fprintf (init_file,
+ "void gt_pch_nx (ovlddata *od, gt_pointer_operator op, "
+ "void *cookie)\n");
+ fprintf (init_file,
+ "{\n op(&(od->fntype), cookie);\n}\n");
+
return 1;
}
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-06-25 16:16 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-15 17:17 [gcc(refs/users/wschmidt/heads/builtins10)] rs6000: Write output to the builtins init file, part 1 of 3 William Schmidt
-- strict thread matches above, loose matches on Subject: below --
2021-06-25 16:16 William Schmidt
2021-04-26 20:49 William Schmidt
2021-04-02 22:10 William Schmidt
2021-04-01 19:48 William Schmidt
2021-03-25 15:45 William Schmidt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).