public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/wschmidt/heads/builtins4)] rs6000: Statically initialize overload data
@ 2020-11-24 16:45 William Schmidt
0 siblings, 0 replies; 4+ messages in thread
From: William Schmidt @ 2020-11-24 16:45 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:1f08fcc58344c22f5e6a2286a944c679641b685f
commit 1f08fcc58344c22f5e6a2286a944c679641b685f
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date: Mon Nov 9 10:08:46 2020 -0500
rs6000: Statically initialize overload data
Note that we need alphabetic order to support the chaining from one
overload to the next in the same group.
2020-11-09 Bill Schmidt <wschmidt@linux.ibm.com>
* config/rs6000/rs6000-gen-builtins.c (write_ovld_enum): Remove.
(write_decls): Change overloads from alphabetic order to encounter
order.
(write_ovld_static_init): New function.
(write_init_ovld_table): Move some initialization from here to
write_ovld_static_init; separate table numbering for bifs and
overloads.
(write_init_file): Call write_ovld_static_init; remove decl of
rs6000_overload_info.
Diff:
---
gcc/config/rs6000/rs6000-gen-builtins.c | 84 ++++++++++++++++-----------------
1 file changed, 40 insertions(+), 44 deletions(-)
diff --git a/gcc/config/rs6000/rs6000-gen-builtins.c b/gcc/config/rs6000/rs6000-gen-builtins.c
index 3062d10531a..b44abf37e15 100644
--- a/gcc/config/rs6000/rs6000-gen-builtins.c
+++ b/gcc/config/rs6000/rs6000-gen-builtins.c
@@ -2101,17 +2101,12 @@ write_autogenerated_header (FILE *file)
bif_path, ovld_path);
}
-/* Callback functions used in creating enumerations. */
+/* Callback function used in creating the built-in function enumeration. */
void write_bif_enum (char *str)
{
fprintf (header_file, " RS6000_BIF_%s,\n", str);
}
-void write_ovld_enum (char *str)
-{
- fprintf (header_file, " RS6000_OVLD_%s,\n", str);
-}
-
/* Write declarations into the header file. */
static void
write_decls ()
@@ -2241,14 +2236,10 @@ write_decls ()
fprintf (header_file, "extern hash_table<rs6000_bif_hasher> bif_hash;\n\n");
- /* Right now we use nonoverlapping numbers for rs6000_gen_builtins
- and rs6000_gen_overloads. In the old design, these were all in the
- same enum, and I can't yet prove there isn't a dependency on these
- numbers being distinct. Once this is more clear, I may change
- this to start at zero. */
fprintf (header_file, "enum rs6000_gen_overloads\n{\n");
- fprintf (header_file, " RS6000_OVLD_NONE = RS6000_BIF_MAX + 1,\n");
- rbt_inorder_callback (&ovld_rbt, ovld_rbt.rbt_root, write_ovld_enum);
+ fprintf (header_file, " RS6000_OVLD_NONE,\n");
+ for (int i = 0; i < num_ovlds; i++)
+ fprintf (header_file, " RS6000_OVLD_%s,\n", ovlds[i].ovld_id_name);
fprintf (header_file, " RS6000_OVLD_MAX\n};\n\n");
fprintf (header_file, "struct ovlddata\n");
@@ -2471,6 +2462,38 @@ write_bif_static_init ()
fprintf (init_file, " };\n\n");
}
+/* Write the decl and initializer for rs6000_overload_info[]. */
+static void
+write_ovld_static_init ()
+{
+ fprintf (init_file, "ovlddata rs6000_overload_info[RS6000_OVLD_MAX] =\n");
+ fprintf (init_file, " {\n");
+ fprintf (init_file, " { /* RS6000_OVLD_NONE: */\n");
+ fprintf (init_file, " \"\", RS6000_BIF_NONE, NULL_TREE, NULL\n");
+ fprintf (init_file, " },\n");
+ for (int i = 0; i <= curr_ovld; i++)
+ {
+ fprintf (init_file, " { /* RS6000_OVLD_%s: */\n",
+ ovlds[i].ovld_id_name);
+ fprintf (init_file, " /* bifname */\t\"%s\",\n",
+ 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_overload_info[RS6000_OVLD_%s]\n",
+ ovlds[i+1].ovld_id_name);
+ else
+ fprintf (init_file, "NULL\n");
+ fprintf (init_file, " },\n");
+ }
+ fprintf (init_file, " };\n\n");
+}
+
/* Write code to initialize the built-in function table. */
static void
write_init_bif_table ()
@@ -2541,40 +2564,19 @@ write_init_bif_table ()
static void
write_init_ovld_table ()
{
- fprintf (init_file, " int base = RS6000_BIF_MAX;\n\n");
-
for (int i = 0; i <= curr_ovld; i++)
{
fprintf (init_file,
- " rs6000_overload_info[RS6000_OVLD_%s - base].bifname"
- "\n = \"%s\";\n",
- ovlds[i].ovld_id_name, ovlds[i].proto.bifname);
- fprintf (init_file,
- " rs6000_overload_info[RS6000_OVLD_%s - base].bifid"
- "\n = RS6000_BIF_%s;\n",
- ovlds[i].ovld_id_name, ovlds[i].bif_id_name);
- fprintf (init_file,
- " rs6000_overload_info[RS6000_OVLD_%s - base].fntype"
+ " rs6000_overload_info[RS6000_OVLD_%s].fntype"
"\n = %s;\n",
ovlds[i].ovld_id_name, ovlds[i].fndecl);
- fprintf (init_file,
- " rs6000_overload_info[RS6000_OVLD_%s - base].next"
- "\n = ", ovlds[i].ovld_id_name);
- if (i < curr_ovld
- && !strcmp (ovlds[i+1].proto.bifname, ovlds[i].proto.bifname))
- fprintf (init_file,
- "&rs6000_overload_info[RS6000_OVLD_%s - base];\n",
- ovlds[i+1].ovld_id_name);
- else
- fprintf (init_file, "NULL;\n");
if (i == 0 || ovlds[i].stanza != ovlds[i-1].stanza)
{
fprintf (init_file, "\n");
-
fprintf (init_file,
" ovldaddr = &rs6000_overload_info"
- "[RS6000_OVLD_%s - base];\n",
+ "[RS6000_OVLD_%s];\n",
ovlds[i].ovld_id_name);
fprintf (init_file,
" hash = rs6000_ovld_hasher::hash (ovldaddr);\n");
@@ -2586,11 +2588,8 @@ write_init_ovld_table ()
fprintf (init_file,
" );\n");
fprintf (init_file,
- " *oslot = ovldaddr;\n");
+ " *oslot = ovldaddr;\n\n");
}
-
- if (i < curr_ovld)
- fprintf (init_file, "\n");
}
}
@@ -2619,10 +2618,7 @@ write_init_file ()
#endif
write_bif_static_init ();
-
- fprintf (init_file,
- "ovlddata rs6000_overload_info[RS6000_OVLD_MAX"
- " - RS6000_BIF_MAX];\n\n");
+ write_ovld_static_init ();
rbt_inorder_callback (&fntype_rbt, fntype_rbt.rbt_root, write_fntype);
fprintf (init_file, "\n");
^ permalink raw reply [flat|nested] 4+ messages in thread
* [gcc(refs/users/wschmidt/heads/builtins4)] rs6000: Statically initialize overload data
@ 2021-02-07 18:14 William Schmidt
0 siblings, 0 replies; 4+ messages in thread
From: William Schmidt @ 2021-02-07 18:14 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:73636eb84651524026575d1efd1f26ade3ee0291
commit 73636eb84651524026575d1efd1f26ade3ee0291
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date: Mon Nov 9 10:08:46 2020 -0500
rs6000: Statically initialize overload data
Note that we need alphabetic order to support the chaining from one
overload to the next in the same group.
2020-11-09 Bill Schmidt <wschmidt@linux.ibm.com>
* config/rs6000/rs6000-gen-builtins.c (write_ovld_enum): Remove.
(write_decls): Change overloads from alphabetic order to encounter
order.
(write_ovld_static_init): New function.
(write_init_ovld_table): Move some initialization from here to
write_ovld_static_init; separate table numbering for bifs and
overloads.
(write_init_file): Call write_ovld_static_init; remove decl of
rs6000_overload_info.
Diff:
---
gcc/config/rs6000/rs6000-gen-builtins.c | 84 ++++++++++++++++-----------------
1 file changed, 40 insertions(+), 44 deletions(-)
diff --git a/gcc/config/rs6000/rs6000-gen-builtins.c b/gcc/config/rs6000/rs6000-gen-builtins.c
index 3062d10531a..b44abf37e15 100644
--- a/gcc/config/rs6000/rs6000-gen-builtins.c
+++ b/gcc/config/rs6000/rs6000-gen-builtins.c
@@ -2101,17 +2101,12 @@ write_autogenerated_header (FILE *file)
bif_path, ovld_path);
}
-/* Callback functions used in creating enumerations. */
+/* Callback function used in creating the built-in function enumeration. */
void write_bif_enum (char *str)
{
fprintf (header_file, " RS6000_BIF_%s,\n", str);
}
-void write_ovld_enum (char *str)
-{
- fprintf (header_file, " RS6000_OVLD_%s,\n", str);
-}
-
/* Write declarations into the header file. */
static void
write_decls ()
@@ -2241,14 +2236,10 @@ write_decls ()
fprintf (header_file, "extern hash_table<rs6000_bif_hasher> bif_hash;\n\n");
- /* Right now we use nonoverlapping numbers for rs6000_gen_builtins
- and rs6000_gen_overloads. In the old design, these were all in the
- same enum, and I can't yet prove there isn't a dependency on these
- numbers being distinct. Once this is more clear, I may change
- this to start at zero. */
fprintf (header_file, "enum rs6000_gen_overloads\n{\n");
- fprintf (header_file, " RS6000_OVLD_NONE = RS6000_BIF_MAX + 1,\n");
- rbt_inorder_callback (&ovld_rbt, ovld_rbt.rbt_root, write_ovld_enum);
+ fprintf (header_file, " RS6000_OVLD_NONE,\n");
+ for (int i = 0; i < num_ovlds; i++)
+ fprintf (header_file, " RS6000_OVLD_%s,\n", ovlds[i].ovld_id_name);
fprintf (header_file, " RS6000_OVLD_MAX\n};\n\n");
fprintf (header_file, "struct ovlddata\n");
@@ -2471,6 +2462,38 @@ write_bif_static_init ()
fprintf (init_file, " };\n\n");
}
+/* Write the decl and initializer for rs6000_overload_info[]. */
+static void
+write_ovld_static_init ()
+{
+ fprintf (init_file, "ovlddata rs6000_overload_info[RS6000_OVLD_MAX] =\n");
+ fprintf (init_file, " {\n");
+ fprintf (init_file, " { /* RS6000_OVLD_NONE: */\n");
+ fprintf (init_file, " \"\", RS6000_BIF_NONE, NULL_TREE, NULL\n");
+ fprintf (init_file, " },\n");
+ for (int i = 0; i <= curr_ovld; i++)
+ {
+ fprintf (init_file, " { /* RS6000_OVLD_%s: */\n",
+ ovlds[i].ovld_id_name);
+ fprintf (init_file, " /* bifname */\t\"%s\",\n",
+ 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_overload_info[RS6000_OVLD_%s]\n",
+ ovlds[i+1].ovld_id_name);
+ else
+ fprintf (init_file, "NULL\n");
+ fprintf (init_file, " },\n");
+ }
+ fprintf (init_file, " };\n\n");
+}
+
/* Write code to initialize the built-in function table. */
static void
write_init_bif_table ()
@@ -2541,40 +2564,19 @@ write_init_bif_table ()
static void
write_init_ovld_table ()
{
- fprintf (init_file, " int base = RS6000_BIF_MAX;\n\n");
-
for (int i = 0; i <= curr_ovld; i++)
{
fprintf (init_file,
- " rs6000_overload_info[RS6000_OVLD_%s - base].bifname"
- "\n = \"%s\";\n",
- ovlds[i].ovld_id_name, ovlds[i].proto.bifname);
- fprintf (init_file,
- " rs6000_overload_info[RS6000_OVLD_%s - base].bifid"
- "\n = RS6000_BIF_%s;\n",
- ovlds[i].ovld_id_name, ovlds[i].bif_id_name);
- fprintf (init_file,
- " rs6000_overload_info[RS6000_OVLD_%s - base].fntype"
+ " rs6000_overload_info[RS6000_OVLD_%s].fntype"
"\n = %s;\n",
ovlds[i].ovld_id_name, ovlds[i].fndecl);
- fprintf (init_file,
- " rs6000_overload_info[RS6000_OVLD_%s - base].next"
- "\n = ", ovlds[i].ovld_id_name);
- if (i < curr_ovld
- && !strcmp (ovlds[i+1].proto.bifname, ovlds[i].proto.bifname))
- fprintf (init_file,
- "&rs6000_overload_info[RS6000_OVLD_%s - base];\n",
- ovlds[i+1].ovld_id_name);
- else
- fprintf (init_file, "NULL;\n");
if (i == 0 || ovlds[i].stanza != ovlds[i-1].stanza)
{
fprintf (init_file, "\n");
-
fprintf (init_file,
" ovldaddr = &rs6000_overload_info"
- "[RS6000_OVLD_%s - base];\n",
+ "[RS6000_OVLD_%s];\n",
ovlds[i].ovld_id_name);
fprintf (init_file,
" hash = rs6000_ovld_hasher::hash (ovldaddr);\n");
@@ -2586,11 +2588,8 @@ write_init_ovld_table ()
fprintf (init_file,
" );\n");
fprintf (init_file,
- " *oslot = ovldaddr;\n");
+ " *oslot = ovldaddr;\n\n");
}
-
- if (i < curr_ovld)
- fprintf (init_file, "\n");
}
}
@@ -2619,10 +2618,7 @@ write_init_file ()
#endif
write_bif_static_init ();
-
- fprintf (init_file,
- "ovlddata rs6000_overload_info[RS6000_OVLD_MAX"
- " - RS6000_BIF_MAX];\n\n");
+ write_ovld_static_init ();
rbt_inorder_callback (&fntype_rbt, fntype_rbt.rbt_root, write_fntype);
fprintf (init_file, "\n");
^ permalink raw reply [flat|nested] 4+ messages in thread
* [gcc(refs/users/wschmidt/heads/builtins4)] rs6000: Statically initialize overload data
@ 2020-12-16 18:08 William Schmidt
0 siblings, 0 replies; 4+ messages in thread
From: William Schmidt @ 2020-12-16 18:08 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:8090c999d4ec5e996d69a17102a027d788725371
commit 8090c999d4ec5e996d69a17102a027d788725371
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date: Mon Nov 9 10:08:46 2020 -0500
rs6000: Statically initialize overload data
Note that we need alphabetic order to support the chaining from one
overload to the next in the same group.
2020-11-09 Bill Schmidt <wschmidt@linux.ibm.com>
* config/rs6000/rs6000-gen-builtins.c (write_ovld_enum): Remove.
(write_decls): Change overloads from alphabetic order to encounter
order.
(write_ovld_static_init): New function.
(write_init_ovld_table): Move some initialization from here to
write_ovld_static_init; separate table numbering for bifs and
overloads.
(write_init_file): Call write_ovld_static_init; remove decl of
rs6000_overload_info.
Diff:
---
gcc/config/rs6000/rs6000-gen-builtins.c | 84 ++++++++++++++++-----------------
1 file changed, 40 insertions(+), 44 deletions(-)
diff --git a/gcc/config/rs6000/rs6000-gen-builtins.c b/gcc/config/rs6000/rs6000-gen-builtins.c
index 3062d10531a..b44abf37e15 100644
--- a/gcc/config/rs6000/rs6000-gen-builtins.c
+++ b/gcc/config/rs6000/rs6000-gen-builtins.c
@@ -2101,17 +2101,12 @@ write_autogenerated_header (FILE *file)
bif_path, ovld_path);
}
-/* Callback functions used in creating enumerations. */
+/* Callback function used in creating the built-in function enumeration. */
void write_bif_enum (char *str)
{
fprintf (header_file, " RS6000_BIF_%s,\n", str);
}
-void write_ovld_enum (char *str)
-{
- fprintf (header_file, " RS6000_OVLD_%s,\n", str);
-}
-
/* Write declarations into the header file. */
static void
write_decls ()
@@ -2241,14 +2236,10 @@ write_decls ()
fprintf (header_file, "extern hash_table<rs6000_bif_hasher> bif_hash;\n\n");
- /* Right now we use nonoverlapping numbers for rs6000_gen_builtins
- and rs6000_gen_overloads. In the old design, these were all in the
- same enum, and I can't yet prove there isn't a dependency on these
- numbers being distinct. Once this is more clear, I may change
- this to start at zero. */
fprintf (header_file, "enum rs6000_gen_overloads\n{\n");
- fprintf (header_file, " RS6000_OVLD_NONE = RS6000_BIF_MAX + 1,\n");
- rbt_inorder_callback (&ovld_rbt, ovld_rbt.rbt_root, write_ovld_enum);
+ fprintf (header_file, " RS6000_OVLD_NONE,\n");
+ for (int i = 0; i < num_ovlds; i++)
+ fprintf (header_file, " RS6000_OVLD_%s,\n", ovlds[i].ovld_id_name);
fprintf (header_file, " RS6000_OVLD_MAX\n};\n\n");
fprintf (header_file, "struct ovlddata\n");
@@ -2471,6 +2462,38 @@ write_bif_static_init ()
fprintf (init_file, " };\n\n");
}
+/* Write the decl and initializer for rs6000_overload_info[]. */
+static void
+write_ovld_static_init ()
+{
+ fprintf (init_file, "ovlddata rs6000_overload_info[RS6000_OVLD_MAX] =\n");
+ fprintf (init_file, " {\n");
+ fprintf (init_file, " { /* RS6000_OVLD_NONE: */\n");
+ fprintf (init_file, " \"\", RS6000_BIF_NONE, NULL_TREE, NULL\n");
+ fprintf (init_file, " },\n");
+ for (int i = 0; i <= curr_ovld; i++)
+ {
+ fprintf (init_file, " { /* RS6000_OVLD_%s: */\n",
+ ovlds[i].ovld_id_name);
+ fprintf (init_file, " /* bifname */\t\"%s\",\n",
+ 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_overload_info[RS6000_OVLD_%s]\n",
+ ovlds[i+1].ovld_id_name);
+ else
+ fprintf (init_file, "NULL\n");
+ fprintf (init_file, " },\n");
+ }
+ fprintf (init_file, " };\n\n");
+}
+
/* Write code to initialize the built-in function table. */
static void
write_init_bif_table ()
@@ -2541,40 +2564,19 @@ write_init_bif_table ()
static void
write_init_ovld_table ()
{
- fprintf (init_file, " int base = RS6000_BIF_MAX;\n\n");
-
for (int i = 0; i <= curr_ovld; i++)
{
fprintf (init_file,
- " rs6000_overload_info[RS6000_OVLD_%s - base].bifname"
- "\n = \"%s\";\n",
- ovlds[i].ovld_id_name, ovlds[i].proto.bifname);
- fprintf (init_file,
- " rs6000_overload_info[RS6000_OVLD_%s - base].bifid"
- "\n = RS6000_BIF_%s;\n",
- ovlds[i].ovld_id_name, ovlds[i].bif_id_name);
- fprintf (init_file,
- " rs6000_overload_info[RS6000_OVLD_%s - base].fntype"
+ " rs6000_overload_info[RS6000_OVLD_%s].fntype"
"\n = %s;\n",
ovlds[i].ovld_id_name, ovlds[i].fndecl);
- fprintf (init_file,
- " rs6000_overload_info[RS6000_OVLD_%s - base].next"
- "\n = ", ovlds[i].ovld_id_name);
- if (i < curr_ovld
- && !strcmp (ovlds[i+1].proto.bifname, ovlds[i].proto.bifname))
- fprintf (init_file,
- "&rs6000_overload_info[RS6000_OVLD_%s - base];\n",
- ovlds[i+1].ovld_id_name);
- else
- fprintf (init_file, "NULL;\n");
if (i == 0 || ovlds[i].stanza != ovlds[i-1].stanza)
{
fprintf (init_file, "\n");
-
fprintf (init_file,
" ovldaddr = &rs6000_overload_info"
- "[RS6000_OVLD_%s - base];\n",
+ "[RS6000_OVLD_%s];\n",
ovlds[i].ovld_id_name);
fprintf (init_file,
" hash = rs6000_ovld_hasher::hash (ovldaddr);\n");
@@ -2586,11 +2588,8 @@ write_init_ovld_table ()
fprintf (init_file,
" );\n");
fprintf (init_file,
- " *oslot = ovldaddr;\n");
+ " *oslot = ovldaddr;\n\n");
}
-
- if (i < curr_ovld)
- fprintf (init_file, "\n");
}
}
@@ -2619,10 +2618,7 @@ write_init_file ()
#endif
write_bif_static_init ();
-
- fprintf (init_file,
- "ovlddata rs6000_overload_info[RS6000_OVLD_MAX"
- " - RS6000_BIF_MAX];\n\n");
+ write_ovld_static_init ();
rbt_inorder_callback (&fntype_rbt, fntype_rbt.rbt_root, write_fntype);
fprintf (init_file, "\n");
^ permalink raw reply [flat|nested] 4+ messages in thread
* [gcc(refs/users/wschmidt/heads/builtins4)] rs6000: Statically initialize overload data
@ 2020-11-09 15:09 William Schmidt
0 siblings, 0 replies; 4+ messages in thread
From: William Schmidt @ 2020-11-09 15:09 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:26a833f041e8ca5c56d7c9d83f58221c5fe78d9d
commit 26a833f041e8ca5c56d7c9d83f58221c5fe78d9d
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date: Mon Nov 9 10:08:46 2020 -0500
rs6000: Statically initialize overload data
Note that we need alphabetic order to support the chaining from one
overload to the next in the same group.
2020-11-09 Bill Schmidt <wschmidt@linux.ibm.com>
* config/rs6000/rs6000-gen-builtins.c (write_ovld_enum): Remove.
(write_decls): Change overloads from alphabetic order to encounter
order.
(write_ovld_static_init): New function.
(write_init_ovld_table): Move some initialization from here to
write_ovld_static_init; separate table numbering for bifs and
overloads.
(write_init_file): Call write_ovld_static_init; remove decl of
rs6000_overload_info.
Diff:
---
gcc/config/rs6000/rs6000-gen-builtins.c | 84 ++++++++++++++++-----------------
1 file changed, 40 insertions(+), 44 deletions(-)
diff --git a/gcc/config/rs6000/rs6000-gen-builtins.c b/gcc/config/rs6000/rs6000-gen-builtins.c
index 3062d10531a..b44abf37e15 100644
--- a/gcc/config/rs6000/rs6000-gen-builtins.c
+++ b/gcc/config/rs6000/rs6000-gen-builtins.c
@@ -2101,17 +2101,12 @@ write_autogenerated_header (FILE *file)
bif_path, ovld_path);
}
-/* Callback functions used in creating enumerations. */
+/* Callback function used in creating the built-in function enumeration. */
void write_bif_enum (char *str)
{
fprintf (header_file, " RS6000_BIF_%s,\n", str);
}
-void write_ovld_enum (char *str)
-{
- fprintf (header_file, " RS6000_OVLD_%s,\n", str);
-}
-
/* Write declarations into the header file. */
static void
write_decls ()
@@ -2241,14 +2236,10 @@ write_decls ()
fprintf (header_file, "extern hash_table<rs6000_bif_hasher> bif_hash;\n\n");
- /* Right now we use nonoverlapping numbers for rs6000_gen_builtins
- and rs6000_gen_overloads. In the old design, these were all in the
- same enum, and I can't yet prove there isn't a dependency on these
- numbers being distinct. Once this is more clear, I may change
- this to start at zero. */
fprintf (header_file, "enum rs6000_gen_overloads\n{\n");
- fprintf (header_file, " RS6000_OVLD_NONE = RS6000_BIF_MAX + 1,\n");
- rbt_inorder_callback (&ovld_rbt, ovld_rbt.rbt_root, write_ovld_enum);
+ fprintf (header_file, " RS6000_OVLD_NONE,\n");
+ for (int i = 0; i < num_ovlds; i++)
+ fprintf (header_file, " RS6000_OVLD_%s,\n", ovlds[i].ovld_id_name);
fprintf (header_file, " RS6000_OVLD_MAX\n};\n\n");
fprintf (header_file, "struct ovlddata\n");
@@ -2471,6 +2462,38 @@ write_bif_static_init ()
fprintf (init_file, " };\n\n");
}
+/* Write the decl and initializer for rs6000_overload_info[]. */
+static void
+write_ovld_static_init ()
+{
+ fprintf (init_file, "ovlddata rs6000_overload_info[RS6000_OVLD_MAX] =\n");
+ fprintf (init_file, " {\n");
+ fprintf (init_file, " { /* RS6000_OVLD_NONE: */\n");
+ fprintf (init_file, " \"\", RS6000_BIF_NONE, NULL_TREE, NULL\n");
+ fprintf (init_file, " },\n");
+ for (int i = 0; i <= curr_ovld; i++)
+ {
+ fprintf (init_file, " { /* RS6000_OVLD_%s: */\n",
+ ovlds[i].ovld_id_name);
+ fprintf (init_file, " /* bifname */\t\"%s\",\n",
+ 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_overload_info[RS6000_OVLD_%s]\n",
+ ovlds[i+1].ovld_id_name);
+ else
+ fprintf (init_file, "NULL\n");
+ fprintf (init_file, " },\n");
+ }
+ fprintf (init_file, " };\n\n");
+}
+
/* Write code to initialize the built-in function table. */
static void
write_init_bif_table ()
@@ -2541,40 +2564,19 @@ write_init_bif_table ()
static void
write_init_ovld_table ()
{
- fprintf (init_file, " int base = RS6000_BIF_MAX;\n\n");
-
for (int i = 0; i <= curr_ovld; i++)
{
fprintf (init_file,
- " rs6000_overload_info[RS6000_OVLD_%s - base].bifname"
- "\n = \"%s\";\n",
- ovlds[i].ovld_id_name, ovlds[i].proto.bifname);
- fprintf (init_file,
- " rs6000_overload_info[RS6000_OVLD_%s - base].bifid"
- "\n = RS6000_BIF_%s;\n",
- ovlds[i].ovld_id_name, ovlds[i].bif_id_name);
- fprintf (init_file,
- " rs6000_overload_info[RS6000_OVLD_%s - base].fntype"
+ " rs6000_overload_info[RS6000_OVLD_%s].fntype"
"\n = %s;\n",
ovlds[i].ovld_id_name, ovlds[i].fndecl);
- fprintf (init_file,
- " rs6000_overload_info[RS6000_OVLD_%s - base].next"
- "\n = ", ovlds[i].ovld_id_name);
- if (i < curr_ovld
- && !strcmp (ovlds[i+1].proto.bifname, ovlds[i].proto.bifname))
- fprintf (init_file,
- "&rs6000_overload_info[RS6000_OVLD_%s - base];\n",
- ovlds[i+1].ovld_id_name);
- else
- fprintf (init_file, "NULL;\n");
if (i == 0 || ovlds[i].stanza != ovlds[i-1].stanza)
{
fprintf (init_file, "\n");
-
fprintf (init_file,
" ovldaddr = &rs6000_overload_info"
- "[RS6000_OVLD_%s - base];\n",
+ "[RS6000_OVLD_%s];\n",
ovlds[i].ovld_id_name);
fprintf (init_file,
" hash = rs6000_ovld_hasher::hash (ovldaddr);\n");
@@ -2586,11 +2588,8 @@ write_init_ovld_table ()
fprintf (init_file,
" );\n");
fprintf (init_file,
- " *oslot = ovldaddr;\n");
+ " *oslot = ovldaddr;\n\n");
}
-
- if (i < curr_ovld)
- fprintf (init_file, "\n");
}
}
@@ -2619,10 +2618,7 @@ write_init_file ()
#endif
write_bif_static_init ();
-
- fprintf (init_file,
- "ovlddata rs6000_overload_info[RS6000_OVLD_MAX"
- " - RS6000_BIF_MAX];\n\n");
+ write_ovld_static_init ();
rbt_inorder_callback (&fntype_rbt, fntype_rbt.rbt_root, write_fntype);
fprintf (init_file, "\n");
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-02-07 18:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-24 16:45 [gcc(refs/users/wschmidt/heads/builtins4)] rs6000: Statically initialize overload data William Schmidt
-- strict thread matches above, loose matches on Subject: below --
2021-02-07 18:14 William Schmidt
2020-12-16 18:08 William Schmidt
2020-11-09 15:09 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).