public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/wschmidt/heads/builtins3)] rs6000: More progress on built-in debug support
@ 2020-09-14 14:00 William Schmidt
  0 siblings, 0 replies; 6+ messages in thread
From: William Schmidt @ 2020-09-14 14:00 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:8b101122e2dbd43f960d8ef924c08c45c9a1dff0

commit 8b101122e2dbd43f960d8ef924c08c45c9a1dff0
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date:   Thu Aug 20 17:05:42 2020 -0500

    rs6000: More progress on built-in debug support
    
    2020-08-20  Bill Schmidt  <wschmidt@linux.ibm.com>
    
    gcc/
            * config/rs6000/rs6000-call.c (rs6000_debug_type): Handle
            vector_pair and vector_quad.
            (rs6000_init_builtins): Dump autoinitialized built-ins.
            * config/rs6000/rs6000-gen-builtins.c (write_decls): Add
            attr_string to bifdata.
            (write_init_bif_table): Write attr_string; remove code for old
            debug strategy.

Diff:
---
 gcc/config/rs6000/rs6000-call.c         | 63 +++++++++++++++++++++++++++++++++
 gcc/config/rs6000/rs6000-gen-builtins.c | 43 +++++-----------------
 2 files changed, 72 insertions(+), 34 deletions(-)

diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c
index a1f3ac106b1..f5358924cec 100644
--- a/gcc/config/rs6000/rs6000-call.c
+++ b/gcc/config/rs6000/rs6000-call.c
@@ -8853,6 +8853,10 @@ const char *rs6000_debug_type (tree type)
     return "voidc*";
   else if (type == float128_type_node)
     return "_Float128";
+  else if (type == vector_pair_type_node)
+    return "__vector_pair";
+  else if (type == vector_quad_type_node)
+    return "__vector_quad";
   else
     return "unknown";
 }
@@ -14033,6 +14037,65 @@ rs6000_init_builtins (void)
   /* Execute the autogenerated initialization code for builtins.  */
   rs6000_autoinit_builtins ();
 
+  if (TARGET_DEBUG_BUILTIN)
+    {
+      fprintf (stderr, "\nAutogenerated built-in functions:\n\n");
+      for (int i = 1; i < (int) RS6000_BIF_MAX; i++)
+	{
+	  bif_enable e = rs6000_builtin_info_x[i].enable;
+	  if (e == ENB_P5 && !TARGET_POPCNTB)
+	    continue;
+	  if (e == ENB_P6 && !TARGET_CMPB)
+	    continue;
+	  if (e == ENB_ALTIVEC && !TARGET_ALTIVEC)
+	    continue;
+	  if (e == ENB_VSX && !TARGET_VSX)
+	    continue;
+	  if (e == ENB_P7 && !TARGET_POPCNTD)
+	    continue;
+	  if (e == ENB_P7_64 && (!TARGET_POPCNTD || !TARGET_POWERPC64))
+	    continue;
+	  if (e == ENB_P8 && !TARGET_DIRECT_MOVE)
+	    continue;
+	  if (e == ENB_P8V && !TARGET_P8_VECTOR)
+	    continue;
+	  if (e == ENB_P9 && !TARGET_MODULO)
+	    continue;
+	  if (e == ENB_P9_64 && (!TARGET_MODULO || !TARGET_POWERPC64))
+	    continue;
+	  if (e == ENB_P9V && !TARGET_P9_VECTOR)
+	    continue;
+	  if (e == ENB_IEEE128_HW && !TARGET_FLOAT128_HW)
+	    continue;
+	  if (e == ENB_DFP && !TARGET_DFP)
+	    continue;
+	  if (e == ENB_CRYPTO && !TARGET_CRYPTO)
+	    continue;
+	  if (e == ENB_HTM && !TARGET_HTM)
+	    continue;
+	  if (e == ENB_P10 && !TARGET_POWER10)
+	    continue;
+	  if (e == ENB_MMA && !TARGET_MMA)
+	    continue;
+	  tree fntype = rs6000_builtin_info_x[i].fntype;
+	  tree t = TREE_TYPE (fntype);
+	  fprintf (stderr, "%s %s (", rs6000_debug_type (t),
+		   rs6000_builtin_info_x[i].bifname);
+	  t = TYPE_ARG_TYPES (fntype);
+	  while (t && TREE_VALUE (t) != void_type_node)
+	    {
+	      fprintf (stderr, "%s",
+		       rs6000_debug_type (TREE_VALUE (t)));
+	      t = TREE_CHAIN (t);
+	      if (t && TREE_VALUE (t) != void_type_node)
+		fprintf (stderr, ", ");
+	    }
+	  fprintf (stderr, "); %s [%4d]\n",
+		   rs6000_builtin_info_x[i].attr_string, (int) i);
+	}
+      fprintf (stderr, "\nEnd autogenerated built-in functions.\n\n\n");
+    }
+
   if (!new_builtins_are_live)
     {
       /* Create Altivec, VSX and MMA builtins on machines with at least the
diff --git a/gcc/config/rs6000/rs6000-gen-builtins.c b/gcc/config/rs6000/rs6000-gen-builtins.c
index 75c9ed69ce5..ba64d90cda3 100644
--- a/gcc/config/rs6000/rs6000-gen-builtins.c
+++ b/gcc/config/rs6000/rs6000-gen-builtins.c
@@ -2045,6 +2045,7 @@ write_decls ()
   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, "};\n\n");
 
   fprintf (header_file, "#define bif_init_bit\t\t(0x00000001)\n");
@@ -2259,8 +2260,6 @@ write_header_file ()
 static void
 write_init_bif_table ()
 {
-  const char *attr_string;
-
   for (int i = 0; i <= curr_bif; i++)
     {
       fprintf (init_file,
@@ -2349,6 +2348,14 @@ write_init_bif_table ()
 		       "\n    = %d;\n",
 		       bifs[i].idname, j, bifs[i].proto.restr_val2[j]);
 	    }
+	  fprintf (init_file,
+		   "  rs6000_builtin_info_x[RS6000_BIF_%s].attr_string"
+		   "\n    = %s;\n",
+		   bifs[i].idname,
+		   bifs[i].kind == FNK_CONST ? "\"= const\""
+		   : (bifs[i].kind == FNK_PURE ? "\"= pure\""
+		      : (bifs[i].kind == FNK_FPMATH ? "\"= fp, const\""
+			 : "\"\"")));
 	  fprintf (init_file, "\n");
 	}
 
@@ -2389,13 +2396,11 @@ write_init_bif_table ()
 	{
 	  fprintf (init_file, "      TREE_READONLY (t) = 1;\n");
 	  fprintf (init_file, "      TREE_NOTHROW (t) = 1;\n");
-	  attr_string = "= const";
 	}
       else if (bifs[i].kind == FNK_PURE)
 	{
 	  fprintf (init_file, "      DECL_PURE_P (t) = 1;\n");
 	  fprintf (init_file, "      TREE_NOTHROW (t) = 1;\n");
-	  attr_string = "= pure";
 	}
       else if (bifs[i].kind == FNK_FPMATH)
 	{
@@ -2405,37 +2410,7 @@ write_init_bif_table ()
 	  fprintf (init_file, "          DECL_PURE_P (t) = 1;\n");
 	  fprintf (init_file, "          DECL_IS_NOVOPS (t) = 1;\n");
 	  fprintf (init_file, "        }\n");
-	  attr_string = "= fp, const";
 	}
-      else
-	attr_string = "";
-
-#ifdef BILLDEBUG
-      char *buf = (char *) malloc (strlen (bifs[i].fndecl) + 1);
-      strcpy (buf, bifs[i].fndecl);
-      char *tok = strtok (buf, "_");
-      const char *str = map_token_to_type_node (tok);
-      fprintf (stderr, "%s %s (", str, bifs[i].proto.bifname);
-      tok = strtok (0, "_");
-      assert (tok);
-      assert (!strcmp (tok, "ftype"));
-      tok = strtok (0, "_");
-      while (tok && strcmp (tok, "v"))
-	{
-	  str = map_token_to_type_node (tok);
-	  fprintf (stderr, "%s", str);
-	  tok = strtok (0, "_");
-	  if (tok)
-	    fprintf (stderr, ", ");
-	}
-      fprintf (stderr, "); %s [%4d] %s\n", attr_string, i,
-	       enable_string[bifs[i].stanza]);
-#endif
-
-      fprintf (init_file, "      if (TARGET_DEBUG_BUILTIN)\n");
-      fprintf (init_file, "        fprintf (stderr, \"rs6000_builtin"
-	       ", code = %4d, \"\n                  \"%s%s\\n\");\n",
-	       i, bifs[i].proto.bifname, attr_string);
       fprintf (init_file, "    }\n\n");
     }
 }


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [gcc(refs/users/wschmidt/heads/builtins3)] rs6000: More progress on built-in debug support
@ 2020-10-29 19:52 William Schmidt
  0 siblings, 0 replies; 6+ messages in thread
From: William Schmidt @ 2020-10-29 19:52 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:3265db5e2344173d52e433bb8b2fb0de7cf336da

commit 3265db5e2344173d52e433bb8b2fb0de7cf336da
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date:   Thu Aug 20 17:05:42 2020 -0500

    rs6000: More progress on built-in debug support
    
    2020-08-20  Bill Schmidt  <wschmidt@linux.ibm.com>
    
    gcc/
            * config/rs6000/rs6000-call.c (rs6000_debug_type): Handle
            vector_pair and vector_quad.
            (rs6000_init_builtins): Dump autoinitialized built-ins.
            * config/rs6000/rs6000-gen-builtins.c (write_decls): Add
            attr_string to bifdata.
            (write_init_bif_table): Write attr_string; remove code for old
            debug strategy.

Diff:
---
 gcc/config/rs6000/rs6000-call.c         | 63 +++++++++++++++++++++++++++++++++
 gcc/config/rs6000/rs6000-gen-builtins.c | 43 +++++-----------------
 2 files changed, 72 insertions(+), 34 deletions(-)

diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c
index 6038a537825..0a7286b560b 100644
--- a/gcc/config/rs6000/rs6000-call.c
+++ b/gcc/config/rs6000/rs6000-call.c
@@ -8910,6 +8910,10 @@ const char *rs6000_debug_type (tree type)
     return "voidc*";
   else if (type == float128_type_node)
     return "_Float128";
+  else if (type == vector_pair_type_node)
+    return "__vector_pair";
+  else if (type == vector_quad_type_node)
+    return "__vector_quad";
   else
     return "unknown";
 }
@@ -14220,6 +14224,65 @@ rs6000_init_builtins (void)
   /* Execute the autogenerated initialization code for builtins.  */
   rs6000_autoinit_builtins ();
 
+  if (TARGET_DEBUG_BUILTIN)
+    {
+      fprintf (stderr, "\nAutogenerated built-in functions:\n\n");
+      for (int i = 1; i < (int) RS6000_BIF_MAX; i++)
+	{
+	  bif_enable e = rs6000_builtin_info_x[i].enable;
+	  if (e == ENB_P5 && !TARGET_POPCNTB)
+	    continue;
+	  if (e == ENB_P6 && !TARGET_CMPB)
+	    continue;
+	  if (e == ENB_ALTIVEC && !TARGET_ALTIVEC)
+	    continue;
+	  if (e == ENB_VSX && !TARGET_VSX)
+	    continue;
+	  if (e == ENB_P7 && !TARGET_POPCNTD)
+	    continue;
+	  if (e == ENB_P7_64 && (!TARGET_POPCNTD || !TARGET_POWERPC64))
+	    continue;
+	  if (e == ENB_P8 && !TARGET_DIRECT_MOVE)
+	    continue;
+	  if (e == ENB_P8V && !TARGET_P8_VECTOR)
+	    continue;
+	  if (e == ENB_P9 && !TARGET_MODULO)
+	    continue;
+	  if (e == ENB_P9_64 && (!TARGET_MODULO || !TARGET_POWERPC64))
+	    continue;
+	  if (e == ENB_P9V && !TARGET_P9_VECTOR)
+	    continue;
+	  if (e == ENB_IEEE128_HW && !TARGET_FLOAT128_HW)
+	    continue;
+	  if (e == ENB_DFP && !TARGET_DFP)
+	    continue;
+	  if (e == ENB_CRYPTO && !TARGET_CRYPTO)
+	    continue;
+	  if (e == ENB_HTM && !TARGET_HTM)
+	    continue;
+	  if (e == ENB_P10 && !TARGET_POWER10)
+	    continue;
+	  if (e == ENB_MMA && !TARGET_MMA)
+	    continue;
+	  tree fntype = rs6000_builtin_info_x[i].fntype;
+	  tree t = TREE_TYPE (fntype);
+	  fprintf (stderr, "%s %s (", rs6000_debug_type (t),
+		   rs6000_builtin_info_x[i].bifname);
+	  t = TYPE_ARG_TYPES (fntype);
+	  while (t && TREE_VALUE (t) != void_type_node)
+	    {
+	      fprintf (stderr, "%s",
+		       rs6000_debug_type (TREE_VALUE (t)));
+	      t = TREE_CHAIN (t);
+	      if (t && TREE_VALUE (t) != void_type_node)
+		fprintf (stderr, ", ");
+	    }
+	  fprintf (stderr, "); %s [%4d]\n",
+		   rs6000_builtin_info_x[i].attr_string, (int) i);
+	}
+      fprintf (stderr, "\nEnd autogenerated built-in functions.\n\n\n");
+    }
+
   if (!new_builtins_are_live)
     {
       /* Create Altivec, VSX and MMA builtins on machines with at least the
diff --git a/gcc/config/rs6000/rs6000-gen-builtins.c b/gcc/config/rs6000/rs6000-gen-builtins.c
index 75c9ed69ce5..ba64d90cda3 100644
--- a/gcc/config/rs6000/rs6000-gen-builtins.c
+++ b/gcc/config/rs6000/rs6000-gen-builtins.c
@@ -2045,6 +2045,7 @@ write_decls ()
   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, "};\n\n");
 
   fprintf (header_file, "#define bif_init_bit\t\t(0x00000001)\n");
@@ -2259,8 +2260,6 @@ write_header_file ()
 static void
 write_init_bif_table ()
 {
-  const char *attr_string;
-
   for (int i = 0; i <= curr_bif; i++)
     {
       fprintf (init_file,
@@ -2349,6 +2348,14 @@ write_init_bif_table ()
 		       "\n    = %d;\n",
 		       bifs[i].idname, j, bifs[i].proto.restr_val2[j]);
 	    }
+	  fprintf (init_file,
+		   "  rs6000_builtin_info_x[RS6000_BIF_%s].attr_string"
+		   "\n    = %s;\n",
+		   bifs[i].idname,
+		   bifs[i].kind == FNK_CONST ? "\"= const\""
+		   : (bifs[i].kind == FNK_PURE ? "\"= pure\""
+		      : (bifs[i].kind == FNK_FPMATH ? "\"= fp, const\""
+			 : "\"\"")));
 	  fprintf (init_file, "\n");
 	}
 
@@ -2389,13 +2396,11 @@ write_init_bif_table ()
 	{
 	  fprintf (init_file, "      TREE_READONLY (t) = 1;\n");
 	  fprintf (init_file, "      TREE_NOTHROW (t) = 1;\n");
-	  attr_string = "= const";
 	}
       else if (bifs[i].kind == FNK_PURE)
 	{
 	  fprintf (init_file, "      DECL_PURE_P (t) = 1;\n");
 	  fprintf (init_file, "      TREE_NOTHROW (t) = 1;\n");
-	  attr_string = "= pure";
 	}
       else if (bifs[i].kind == FNK_FPMATH)
 	{
@@ -2405,37 +2410,7 @@ write_init_bif_table ()
 	  fprintf (init_file, "          DECL_PURE_P (t) = 1;\n");
 	  fprintf (init_file, "          DECL_IS_NOVOPS (t) = 1;\n");
 	  fprintf (init_file, "        }\n");
-	  attr_string = "= fp, const";
 	}
-      else
-	attr_string = "";
-
-#ifdef BILLDEBUG
-      char *buf = (char *) malloc (strlen (bifs[i].fndecl) + 1);
-      strcpy (buf, bifs[i].fndecl);
-      char *tok = strtok (buf, "_");
-      const char *str = map_token_to_type_node (tok);
-      fprintf (stderr, "%s %s (", str, bifs[i].proto.bifname);
-      tok = strtok (0, "_");
-      assert (tok);
-      assert (!strcmp (tok, "ftype"));
-      tok = strtok (0, "_");
-      while (tok && strcmp (tok, "v"))
-	{
-	  str = map_token_to_type_node (tok);
-	  fprintf (stderr, "%s", str);
-	  tok = strtok (0, "_");
-	  if (tok)
-	    fprintf (stderr, ", ");
-	}
-      fprintf (stderr, "); %s [%4d] %s\n", attr_string, i,
-	       enable_string[bifs[i].stanza]);
-#endif
-
-      fprintf (init_file, "      if (TARGET_DEBUG_BUILTIN)\n");
-      fprintf (init_file, "        fprintf (stderr, \"rs6000_builtin"
-	       ", code = %4d, \"\n                  \"%s%s\\n\");\n",
-	       i, bifs[i].proto.bifname, attr_string);
       fprintf (init_file, "    }\n\n");
     }
 }


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [gcc(refs/users/wschmidt/heads/builtins3)] rs6000: More progress on built-in debug support
@ 2020-10-27 16:30 William Schmidt
  0 siblings, 0 replies; 6+ messages in thread
From: William Schmidt @ 2020-10-27 16:30 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:730d80b163f4f6fb890bdc4ac3f5407b4bae0925

commit 730d80b163f4f6fb890bdc4ac3f5407b4bae0925
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date:   Thu Aug 20 17:05:42 2020 -0500

    rs6000: More progress on built-in debug support
    
    2020-08-20  Bill Schmidt  <wschmidt@linux.ibm.com>
    
    gcc/
            * config/rs6000/rs6000-call.c (rs6000_debug_type): Handle
            vector_pair and vector_quad.
            (rs6000_init_builtins): Dump autoinitialized built-ins.
            * config/rs6000/rs6000-gen-builtins.c (write_decls): Add
            attr_string to bifdata.
            (write_init_bif_table): Write attr_string; remove code for old
            debug strategy.

Diff:
---
 gcc/config/rs6000/rs6000-call.c         | 63 +++++++++++++++++++++++++++++++++
 gcc/config/rs6000/rs6000-gen-builtins.c | 43 +++++-----------------
 2 files changed, 72 insertions(+), 34 deletions(-)

diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c
index 6038a537825..0a7286b560b 100644
--- a/gcc/config/rs6000/rs6000-call.c
+++ b/gcc/config/rs6000/rs6000-call.c
@@ -8910,6 +8910,10 @@ const char *rs6000_debug_type (tree type)
     return "voidc*";
   else if (type == float128_type_node)
     return "_Float128";
+  else if (type == vector_pair_type_node)
+    return "__vector_pair";
+  else if (type == vector_quad_type_node)
+    return "__vector_quad";
   else
     return "unknown";
 }
@@ -14220,6 +14224,65 @@ rs6000_init_builtins (void)
   /* Execute the autogenerated initialization code for builtins.  */
   rs6000_autoinit_builtins ();
 
+  if (TARGET_DEBUG_BUILTIN)
+    {
+      fprintf (stderr, "\nAutogenerated built-in functions:\n\n");
+      for (int i = 1; i < (int) RS6000_BIF_MAX; i++)
+	{
+	  bif_enable e = rs6000_builtin_info_x[i].enable;
+	  if (e == ENB_P5 && !TARGET_POPCNTB)
+	    continue;
+	  if (e == ENB_P6 && !TARGET_CMPB)
+	    continue;
+	  if (e == ENB_ALTIVEC && !TARGET_ALTIVEC)
+	    continue;
+	  if (e == ENB_VSX && !TARGET_VSX)
+	    continue;
+	  if (e == ENB_P7 && !TARGET_POPCNTD)
+	    continue;
+	  if (e == ENB_P7_64 && (!TARGET_POPCNTD || !TARGET_POWERPC64))
+	    continue;
+	  if (e == ENB_P8 && !TARGET_DIRECT_MOVE)
+	    continue;
+	  if (e == ENB_P8V && !TARGET_P8_VECTOR)
+	    continue;
+	  if (e == ENB_P9 && !TARGET_MODULO)
+	    continue;
+	  if (e == ENB_P9_64 && (!TARGET_MODULO || !TARGET_POWERPC64))
+	    continue;
+	  if (e == ENB_P9V && !TARGET_P9_VECTOR)
+	    continue;
+	  if (e == ENB_IEEE128_HW && !TARGET_FLOAT128_HW)
+	    continue;
+	  if (e == ENB_DFP && !TARGET_DFP)
+	    continue;
+	  if (e == ENB_CRYPTO && !TARGET_CRYPTO)
+	    continue;
+	  if (e == ENB_HTM && !TARGET_HTM)
+	    continue;
+	  if (e == ENB_P10 && !TARGET_POWER10)
+	    continue;
+	  if (e == ENB_MMA && !TARGET_MMA)
+	    continue;
+	  tree fntype = rs6000_builtin_info_x[i].fntype;
+	  tree t = TREE_TYPE (fntype);
+	  fprintf (stderr, "%s %s (", rs6000_debug_type (t),
+		   rs6000_builtin_info_x[i].bifname);
+	  t = TYPE_ARG_TYPES (fntype);
+	  while (t && TREE_VALUE (t) != void_type_node)
+	    {
+	      fprintf (stderr, "%s",
+		       rs6000_debug_type (TREE_VALUE (t)));
+	      t = TREE_CHAIN (t);
+	      if (t && TREE_VALUE (t) != void_type_node)
+		fprintf (stderr, ", ");
+	    }
+	  fprintf (stderr, "); %s [%4d]\n",
+		   rs6000_builtin_info_x[i].attr_string, (int) i);
+	}
+      fprintf (stderr, "\nEnd autogenerated built-in functions.\n\n\n");
+    }
+
   if (!new_builtins_are_live)
     {
       /* Create Altivec, VSX and MMA builtins on machines with at least the
diff --git a/gcc/config/rs6000/rs6000-gen-builtins.c b/gcc/config/rs6000/rs6000-gen-builtins.c
index 75c9ed69ce5..ba64d90cda3 100644
--- a/gcc/config/rs6000/rs6000-gen-builtins.c
+++ b/gcc/config/rs6000/rs6000-gen-builtins.c
@@ -2045,6 +2045,7 @@ write_decls ()
   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, "};\n\n");
 
   fprintf (header_file, "#define bif_init_bit\t\t(0x00000001)\n");
@@ -2259,8 +2260,6 @@ write_header_file ()
 static void
 write_init_bif_table ()
 {
-  const char *attr_string;
-
   for (int i = 0; i <= curr_bif; i++)
     {
       fprintf (init_file,
@@ -2349,6 +2348,14 @@ write_init_bif_table ()
 		       "\n    = %d;\n",
 		       bifs[i].idname, j, bifs[i].proto.restr_val2[j]);
 	    }
+	  fprintf (init_file,
+		   "  rs6000_builtin_info_x[RS6000_BIF_%s].attr_string"
+		   "\n    = %s;\n",
+		   bifs[i].idname,
+		   bifs[i].kind == FNK_CONST ? "\"= const\""
+		   : (bifs[i].kind == FNK_PURE ? "\"= pure\""
+		      : (bifs[i].kind == FNK_FPMATH ? "\"= fp, const\""
+			 : "\"\"")));
 	  fprintf (init_file, "\n");
 	}
 
@@ -2389,13 +2396,11 @@ write_init_bif_table ()
 	{
 	  fprintf (init_file, "      TREE_READONLY (t) = 1;\n");
 	  fprintf (init_file, "      TREE_NOTHROW (t) = 1;\n");
-	  attr_string = "= const";
 	}
       else if (bifs[i].kind == FNK_PURE)
 	{
 	  fprintf (init_file, "      DECL_PURE_P (t) = 1;\n");
 	  fprintf (init_file, "      TREE_NOTHROW (t) = 1;\n");
-	  attr_string = "= pure";
 	}
       else if (bifs[i].kind == FNK_FPMATH)
 	{
@@ -2405,37 +2410,7 @@ write_init_bif_table ()
 	  fprintf (init_file, "          DECL_PURE_P (t) = 1;\n");
 	  fprintf (init_file, "          DECL_IS_NOVOPS (t) = 1;\n");
 	  fprintf (init_file, "        }\n");
-	  attr_string = "= fp, const";
 	}
-      else
-	attr_string = "";
-
-#ifdef BILLDEBUG
-      char *buf = (char *) malloc (strlen (bifs[i].fndecl) + 1);
-      strcpy (buf, bifs[i].fndecl);
-      char *tok = strtok (buf, "_");
-      const char *str = map_token_to_type_node (tok);
-      fprintf (stderr, "%s %s (", str, bifs[i].proto.bifname);
-      tok = strtok (0, "_");
-      assert (tok);
-      assert (!strcmp (tok, "ftype"));
-      tok = strtok (0, "_");
-      while (tok && strcmp (tok, "v"))
-	{
-	  str = map_token_to_type_node (tok);
-	  fprintf (stderr, "%s", str);
-	  tok = strtok (0, "_");
-	  if (tok)
-	    fprintf (stderr, ", ");
-	}
-      fprintf (stderr, "); %s [%4d] %s\n", attr_string, i,
-	       enable_string[bifs[i].stanza]);
-#endif
-
-      fprintf (init_file, "      if (TARGET_DEBUG_BUILTIN)\n");
-      fprintf (init_file, "        fprintf (stderr, \"rs6000_builtin"
-	       ", code = %4d, \"\n                  \"%s%s\\n\");\n",
-	       i, bifs[i].proto.bifname, attr_string);
       fprintf (init_file, "    }\n\n");
     }
 }


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [gcc(refs/users/wschmidt/heads/builtins3)] rs6000: More progress on built-in debug support
@ 2020-09-16 21:31 William Schmidt
  0 siblings, 0 replies; 6+ messages in thread
From: William Schmidt @ 2020-09-16 21:31 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:3b3790190330229b358001793f75c2f3d456df8a

commit 3b3790190330229b358001793f75c2f3d456df8a
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date:   Thu Aug 20 17:05:42 2020 -0500

    rs6000: More progress on built-in debug support
    
    2020-08-20  Bill Schmidt  <wschmidt@linux.ibm.com>
    
    gcc/
            * config/rs6000/rs6000-call.c (rs6000_debug_type): Handle
            vector_pair and vector_quad.
            (rs6000_init_builtins): Dump autoinitialized built-ins.
            * config/rs6000/rs6000-gen-builtins.c (write_decls): Add
            attr_string to bifdata.
            (write_init_bif_table): Write attr_string; remove code for old
            debug strategy.

Diff:
---
 gcc/config/rs6000/rs6000-call.c         | 63 +++++++++++++++++++++++++++++++++
 gcc/config/rs6000/rs6000-gen-builtins.c | 43 +++++-----------------
 2 files changed, 72 insertions(+), 34 deletions(-)

diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c
index c3d992085db..304481f1b24 100644
--- a/gcc/config/rs6000/rs6000-call.c
+++ b/gcc/config/rs6000/rs6000-call.c
@@ -8853,6 +8853,10 @@ const char *rs6000_debug_type (tree type)
     return "voidc*";
   else if (type == float128_type_node)
     return "_Float128";
+  else if (type == vector_pair_type_node)
+    return "__vector_pair";
+  else if (type == vector_quad_type_node)
+    return "__vector_quad";
   else
     return "unknown";
 }
@@ -14033,6 +14037,65 @@ rs6000_init_builtins (void)
   /* Execute the autogenerated initialization code for builtins.  */
   rs6000_autoinit_builtins ();
 
+  if (TARGET_DEBUG_BUILTIN)
+    {
+      fprintf (stderr, "\nAutogenerated built-in functions:\n\n");
+      for (int i = 1; i < (int) RS6000_BIF_MAX; i++)
+	{
+	  bif_enable e = rs6000_builtin_info_x[i].enable;
+	  if (e == ENB_P5 && !TARGET_POPCNTB)
+	    continue;
+	  if (e == ENB_P6 && !TARGET_CMPB)
+	    continue;
+	  if (e == ENB_ALTIVEC && !TARGET_ALTIVEC)
+	    continue;
+	  if (e == ENB_VSX && !TARGET_VSX)
+	    continue;
+	  if (e == ENB_P7 && !TARGET_POPCNTD)
+	    continue;
+	  if (e == ENB_P7_64 && (!TARGET_POPCNTD || !TARGET_POWERPC64))
+	    continue;
+	  if (e == ENB_P8 && !TARGET_DIRECT_MOVE)
+	    continue;
+	  if (e == ENB_P8V && !TARGET_P8_VECTOR)
+	    continue;
+	  if (e == ENB_P9 && !TARGET_MODULO)
+	    continue;
+	  if (e == ENB_P9_64 && (!TARGET_MODULO || !TARGET_POWERPC64))
+	    continue;
+	  if (e == ENB_P9V && !TARGET_P9_VECTOR)
+	    continue;
+	  if (e == ENB_IEEE128_HW && !TARGET_FLOAT128_HW)
+	    continue;
+	  if (e == ENB_DFP && !TARGET_DFP)
+	    continue;
+	  if (e == ENB_CRYPTO && !TARGET_CRYPTO)
+	    continue;
+	  if (e == ENB_HTM && !TARGET_HTM)
+	    continue;
+	  if (e == ENB_P10 && !TARGET_POWER10)
+	    continue;
+	  if (e == ENB_MMA && !TARGET_MMA)
+	    continue;
+	  tree fntype = rs6000_builtin_info_x[i].fntype;
+	  tree t = TREE_TYPE (fntype);
+	  fprintf (stderr, "%s %s (", rs6000_debug_type (t),
+		   rs6000_builtin_info_x[i].bifname);
+	  t = TYPE_ARG_TYPES (fntype);
+	  while (t && TREE_VALUE (t) != void_type_node)
+	    {
+	      fprintf (stderr, "%s",
+		       rs6000_debug_type (TREE_VALUE (t)));
+	      t = TREE_CHAIN (t);
+	      if (t && TREE_VALUE (t) != void_type_node)
+		fprintf (stderr, ", ");
+	    }
+	  fprintf (stderr, "); %s [%4d]\n",
+		   rs6000_builtin_info_x[i].attr_string, (int) i);
+	}
+      fprintf (stderr, "\nEnd autogenerated built-in functions.\n\n\n");
+    }
+
   if (!new_builtins_are_live)
     {
       /* Create Altivec, VSX and MMA builtins on machines with at least the
diff --git a/gcc/config/rs6000/rs6000-gen-builtins.c b/gcc/config/rs6000/rs6000-gen-builtins.c
index 75c9ed69ce5..ba64d90cda3 100644
--- a/gcc/config/rs6000/rs6000-gen-builtins.c
+++ b/gcc/config/rs6000/rs6000-gen-builtins.c
@@ -2045,6 +2045,7 @@ write_decls ()
   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, "};\n\n");
 
   fprintf (header_file, "#define bif_init_bit\t\t(0x00000001)\n");
@@ -2259,8 +2260,6 @@ write_header_file ()
 static void
 write_init_bif_table ()
 {
-  const char *attr_string;
-
   for (int i = 0; i <= curr_bif; i++)
     {
       fprintf (init_file,
@@ -2349,6 +2348,14 @@ write_init_bif_table ()
 		       "\n    = %d;\n",
 		       bifs[i].idname, j, bifs[i].proto.restr_val2[j]);
 	    }
+	  fprintf (init_file,
+		   "  rs6000_builtin_info_x[RS6000_BIF_%s].attr_string"
+		   "\n    = %s;\n",
+		   bifs[i].idname,
+		   bifs[i].kind == FNK_CONST ? "\"= const\""
+		   : (bifs[i].kind == FNK_PURE ? "\"= pure\""
+		      : (bifs[i].kind == FNK_FPMATH ? "\"= fp, const\""
+			 : "\"\"")));
 	  fprintf (init_file, "\n");
 	}
 
@@ -2389,13 +2396,11 @@ write_init_bif_table ()
 	{
 	  fprintf (init_file, "      TREE_READONLY (t) = 1;\n");
 	  fprintf (init_file, "      TREE_NOTHROW (t) = 1;\n");
-	  attr_string = "= const";
 	}
       else if (bifs[i].kind == FNK_PURE)
 	{
 	  fprintf (init_file, "      DECL_PURE_P (t) = 1;\n");
 	  fprintf (init_file, "      TREE_NOTHROW (t) = 1;\n");
-	  attr_string = "= pure";
 	}
       else if (bifs[i].kind == FNK_FPMATH)
 	{
@@ -2405,37 +2410,7 @@ write_init_bif_table ()
 	  fprintf (init_file, "          DECL_PURE_P (t) = 1;\n");
 	  fprintf (init_file, "          DECL_IS_NOVOPS (t) = 1;\n");
 	  fprintf (init_file, "        }\n");
-	  attr_string = "= fp, const";
 	}
-      else
-	attr_string = "";
-
-#ifdef BILLDEBUG
-      char *buf = (char *) malloc (strlen (bifs[i].fndecl) + 1);
-      strcpy (buf, bifs[i].fndecl);
-      char *tok = strtok (buf, "_");
-      const char *str = map_token_to_type_node (tok);
-      fprintf (stderr, "%s %s (", str, bifs[i].proto.bifname);
-      tok = strtok (0, "_");
-      assert (tok);
-      assert (!strcmp (tok, "ftype"));
-      tok = strtok (0, "_");
-      while (tok && strcmp (tok, "v"))
-	{
-	  str = map_token_to_type_node (tok);
-	  fprintf (stderr, "%s", str);
-	  tok = strtok (0, "_");
-	  if (tok)
-	    fprintf (stderr, ", ");
-	}
-      fprintf (stderr, "); %s [%4d] %s\n", attr_string, i,
-	       enable_string[bifs[i].stanza]);
-#endif
-
-      fprintf (init_file, "      if (TARGET_DEBUG_BUILTIN)\n");
-      fprintf (init_file, "        fprintf (stderr, \"rs6000_builtin"
-	       ", code = %4d, \"\n                  \"%s%s\\n\");\n",
-	       i, bifs[i].proto.bifname, attr_string);
       fprintf (init_file, "    }\n\n");
     }
 }


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [gcc(refs/users/wschmidt/heads/builtins3)] rs6000: More progress on built-in debug support
@ 2020-08-28 20:09 William Schmidt
  0 siblings, 0 replies; 6+ messages in thread
From: William Schmidt @ 2020-08-28 20:09 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:0c8ca4d3d98c6c4137bbe293d401404fac125fc5

commit 0c8ca4d3d98c6c4137bbe293d401404fac125fc5
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date:   Thu Aug 20 17:05:42 2020 -0500

    rs6000: More progress on built-in debug support
    
    2020-08-20  Bill Schmidt  <wschmidt@linux.ibm.com>
    
    gcc/
            * config/rs6000/rs6000-call.c (rs6000_debug_type): Handle
            vector_pair and vector_quad.
            (rs6000_init_builtins): Dump autoinitialized built-ins.
            * config/rs6000/rs6000-gen-builtins.c (write_decls): Add
            attr_string to bifdata.
            (write_init_bif_table): Write attr_string; remove code for old
            debug strategy.

Diff:
---
 gcc/config/rs6000/rs6000-call.c         | 63 +++++++++++++++++++++++++++++++++
 gcc/config/rs6000/rs6000-gen-builtins.c | 43 +++++-----------------
 2 files changed, 72 insertions(+), 34 deletions(-)

diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c
index d41467de41e..d137de7e89c 100644
--- a/gcc/config/rs6000/rs6000-call.c
+++ b/gcc/config/rs6000/rs6000-call.c
@@ -8853,6 +8853,10 @@ const char *rs6000_debug_type (tree type)
     return "voidc*";
   else if (type == float128_type_node)
     return "_Float128";
+  else if (type == vector_pair_type_node)
+    return "__vector_pair";
+  else if (type == vector_quad_type_node)
+    return "__vector_quad";
   else
     return "unknown";
 }
@@ -14037,6 +14041,65 @@ rs6000_init_builtins (void)
   /* Execute the autogenerated initialization code for builtins.  */
   rs6000_autoinit_builtins ();
 
+  if (TARGET_DEBUG_BUILTIN)
+    {
+      fprintf (stderr, "\nAutogenerated built-in functions:\n\n");
+      for (int i = 1; i < (int) RS6000_BIF_MAX; i++)
+	{
+	  bif_enable e = rs6000_builtin_info_x[i].enable;
+	  if (e == ENB_P5 && !TARGET_POPCNTB)
+	    continue;
+	  if (e == ENB_P6 && !TARGET_CMPB)
+	    continue;
+	  if (e == ENB_ALTIVEC && !TARGET_ALTIVEC)
+	    continue;
+	  if (e == ENB_VSX && !TARGET_VSX)
+	    continue;
+	  if (e == ENB_P7 && !TARGET_POPCNTD)
+	    continue;
+	  if (e == ENB_P7_64 && (!TARGET_POPCNTD || !TARGET_POWERPC64))
+	    continue;
+	  if (e == ENB_P8 && !TARGET_DIRECT_MOVE)
+	    continue;
+	  if (e == ENB_P8V && !TARGET_P8_VECTOR)
+	    continue;
+	  if (e == ENB_P9 && !TARGET_MODULO)
+	    continue;
+	  if (e == ENB_P9_64 && (!TARGET_MODULO || !TARGET_POWERPC64))
+	    continue;
+	  if (e == ENB_P9V && !TARGET_P9_VECTOR)
+	    continue;
+	  if (e == ENB_IEEE128_HW && !TARGET_FLOAT128_HW)
+	    continue;
+	  if (e == ENB_DFP && !TARGET_DFP)
+	    continue;
+	  if (e == ENB_CRYPTO && !TARGET_CRYPTO)
+	    continue;
+	  if (e == ENB_HTM && !TARGET_HTM)
+	    continue;
+	  if (e == ENB_P10 && !TARGET_POWER10)
+	    continue;
+	  if (e == ENB_MMA && !TARGET_MMA)
+	    continue;
+	  tree fntype = rs6000_builtin_info_x[i].fntype;
+	  tree t = TREE_TYPE (fntype);
+	  fprintf (stderr, "%s %s (", rs6000_debug_type (t),
+		   rs6000_builtin_info_x[i].bifname);
+	  t = TYPE_ARG_TYPES (fntype);
+	  while (t && TREE_VALUE (t) != void_type_node)
+	    {
+	      fprintf (stderr, "%s",
+		       rs6000_debug_type (TREE_VALUE (t)));
+	      t = TREE_CHAIN (t);
+	      if (t && TREE_VALUE (t) != void_type_node)
+		fprintf (stderr, ", ");
+	    }
+	  fprintf (stderr, "); %s [%4d]\n",
+		   rs6000_builtin_info_x[i].attr_string, (int) i);
+	}
+      fprintf (stderr, "\nEnd autogenerated built-in functions.\n\n\n");
+    }
+
   if (!new_builtins_are_live)
     {
       /* Create Altivec, VSX and MMA builtins on machines with at least the
diff --git a/gcc/config/rs6000/rs6000-gen-builtins.c b/gcc/config/rs6000/rs6000-gen-builtins.c
index 75c9ed69ce5..ba64d90cda3 100644
--- a/gcc/config/rs6000/rs6000-gen-builtins.c
+++ b/gcc/config/rs6000/rs6000-gen-builtins.c
@@ -2045,6 +2045,7 @@ write_decls ()
   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, "};\n\n");
 
   fprintf (header_file, "#define bif_init_bit\t\t(0x00000001)\n");
@@ -2259,8 +2260,6 @@ write_header_file ()
 static void
 write_init_bif_table ()
 {
-  const char *attr_string;
-
   for (int i = 0; i <= curr_bif; i++)
     {
       fprintf (init_file,
@@ -2349,6 +2348,14 @@ write_init_bif_table ()
 		       "\n    = %d;\n",
 		       bifs[i].idname, j, bifs[i].proto.restr_val2[j]);
 	    }
+	  fprintf (init_file,
+		   "  rs6000_builtin_info_x[RS6000_BIF_%s].attr_string"
+		   "\n    = %s;\n",
+		   bifs[i].idname,
+		   bifs[i].kind == FNK_CONST ? "\"= const\""
+		   : (bifs[i].kind == FNK_PURE ? "\"= pure\""
+		      : (bifs[i].kind == FNK_FPMATH ? "\"= fp, const\""
+			 : "\"\"")));
 	  fprintf (init_file, "\n");
 	}
 
@@ -2389,13 +2396,11 @@ write_init_bif_table ()
 	{
 	  fprintf (init_file, "      TREE_READONLY (t) = 1;\n");
 	  fprintf (init_file, "      TREE_NOTHROW (t) = 1;\n");
-	  attr_string = "= const";
 	}
       else if (bifs[i].kind == FNK_PURE)
 	{
 	  fprintf (init_file, "      DECL_PURE_P (t) = 1;\n");
 	  fprintf (init_file, "      TREE_NOTHROW (t) = 1;\n");
-	  attr_string = "= pure";
 	}
       else if (bifs[i].kind == FNK_FPMATH)
 	{
@@ -2405,37 +2410,7 @@ write_init_bif_table ()
 	  fprintf (init_file, "          DECL_PURE_P (t) = 1;\n");
 	  fprintf (init_file, "          DECL_IS_NOVOPS (t) = 1;\n");
 	  fprintf (init_file, "        }\n");
-	  attr_string = "= fp, const";
 	}
-      else
-	attr_string = "";
-
-#ifdef BILLDEBUG
-      char *buf = (char *) malloc (strlen (bifs[i].fndecl) + 1);
-      strcpy (buf, bifs[i].fndecl);
-      char *tok = strtok (buf, "_");
-      const char *str = map_token_to_type_node (tok);
-      fprintf (stderr, "%s %s (", str, bifs[i].proto.bifname);
-      tok = strtok (0, "_");
-      assert (tok);
-      assert (!strcmp (tok, "ftype"));
-      tok = strtok (0, "_");
-      while (tok && strcmp (tok, "v"))
-	{
-	  str = map_token_to_type_node (tok);
-	  fprintf (stderr, "%s", str);
-	  tok = strtok (0, "_");
-	  if (tok)
-	    fprintf (stderr, ", ");
-	}
-      fprintf (stderr, "); %s [%4d] %s\n", attr_string, i,
-	       enable_string[bifs[i].stanza]);
-#endif
-
-      fprintf (init_file, "      if (TARGET_DEBUG_BUILTIN)\n");
-      fprintf (init_file, "        fprintf (stderr, \"rs6000_builtin"
-	       ", code = %4d, \"\n                  \"%s%s\\n\");\n",
-	       i, bifs[i].proto.bifname, attr_string);
       fprintf (init_file, "    }\n\n");
     }
 }


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [gcc(refs/users/wschmidt/heads/builtins3)] rs6000: More progress on built-in debug support
@ 2020-08-20 22:06 William Schmidt
  0 siblings, 0 replies; 6+ messages in thread
From: William Schmidt @ 2020-08-20 22:06 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:8f89981a775af2cc03ef866989b94ce19f3db353

commit 8f89981a775af2cc03ef866989b94ce19f3db353
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date:   Thu Aug 20 17:05:42 2020 -0500

    rs6000: More progress on built-in debug support
    
    2020-08-20  Bill Schmidt  <wschmidt@linux.ibm.com>
    
    gcc/
            * config/rs6000/rs6000-call.c (rs6000_debug_type): Handle
            vector_pair and vector_quad.
            (rs6000_init_builtins): Dump autoinitialized built-ins.
            * config/rs6000/rs6000-gen-builtins.c (write_decls): Add
            attr_string to bifdata.
            (write_init_bif_table): Write attr_string; remove code for old
            debug strategy.

Diff:
---
 gcc/config/rs6000/rs6000-call.c         | 63 +++++++++++++++++++++++++++++++++
 gcc/config/rs6000/rs6000-gen-builtins.c | 43 +++++-----------------
 2 files changed, 72 insertions(+), 34 deletions(-)

diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c
index d41467de41e..d137de7e89c 100644
--- a/gcc/config/rs6000/rs6000-call.c
+++ b/gcc/config/rs6000/rs6000-call.c
@@ -8853,6 +8853,10 @@ const char *rs6000_debug_type (tree type)
     return "voidc*";
   else if (type == float128_type_node)
     return "_Float128";
+  else if (type == vector_pair_type_node)
+    return "__vector_pair";
+  else if (type == vector_quad_type_node)
+    return "__vector_quad";
   else
     return "unknown";
 }
@@ -14037,6 +14041,65 @@ rs6000_init_builtins (void)
   /* Execute the autogenerated initialization code for builtins.  */
   rs6000_autoinit_builtins ();
 
+  if (TARGET_DEBUG_BUILTIN)
+    {
+      fprintf (stderr, "\nAutogenerated built-in functions:\n\n");
+      for (int i = 1; i < (int) RS6000_BIF_MAX; i++)
+	{
+	  bif_enable e = rs6000_builtin_info_x[i].enable;
+	  if (e == ENB_P5 && !TARGET_POPCNTB)
+	    continue;
+	  if (e == ENB_P6 && !TARGET_CMPB)
+	    continue;
+	  if (e == ENB_ALTIVEC && !TARGET_ALTIVEC)
+	    continue;
+	  if (e == ENB_VSX && !TARGET_VSX)
+	    continue;
+	  if (e == ENB_P7 && !TARGET_POPCNTD)
+	    continue;
+	  if (e == ENB_P7_64 && (!TARGET_POPCNTD || !TARGET_POWERPC64))
+	    continue;
+	  if (e == ENB_P8 && !TARGET_DIRECT_MOVE)
+	    continue;
+	  if (e == ENB_P8V && !TARGET_P8_VECTOR)
+	    continue;
+	  if (e == ENB_P9 && !TARGET_MODULO)
+	    continue;
+	  if (e == ENB_P9_64 && (!TARGET_MODULO || !TARGET_POWERPC64))
+	    continue;
+	  if (e == ENB_P9V && !TARGET_P9_VECTOR)
+	    continue;
+	  if (e == ENB_IEEE128_HW && !TARGET_FLOAT128_HW)
+	    continue;
+	  if (e == ENB_DFP && !TARGET_DFP)
+	    continue;
+	  if (e == ENB_CRYPTO && !TARGET_CRYPTO)
+	    continue;
+	  if (e == ENB_HTM && !TARGET_HTM)
+	    continue;
+	  if (e == ENB_P10 && !TARGET_POWER10)
+	    continue;
+	  if (e == ENB_MMA && !TARGET_MMA)
+	    continue;
+	  tree fntype = rs6000_builtin_info_x[i].fntype;
+	  tree t = TREE_TYPE (fntype);
+	  fprintf (stderr, "%s %s (", rs6000_debug_type (t),
+		   rs6000_builtin_info_x[i].bifname);
+	  t = TYPE_ARG_TYPES (fntype);
+	  while (t && TREE_VALUE (t) != void_type_node)
+	    {
+	      fprintf (stderr, "%s",
+		       rs6000_debug_type (TREE_VALUE (t)));
+	      t = TREE_CHAIN (t);
+	      if (t && TREE_VALUE (t) != void_type_node)
+		fprintf (stderr, ", ");
+	    }
+	  fprintf (stderr, "); %s [%4d]\n",
+		   rs6000_builtin_info_x[i].attr_string, (int) i);
+	}
+      fprintf (stderr, "\nEnd autogenerated built-in functions.\n\n\n");
+    }
+
   if (!new_builtins_are_live)
     {
       /* Create Altivec, VSX and MMA builtins on machines with at least the
diff --git a/gcc/config/rs6000/rs6000-gen-builtins.c b/gcc/config/rs6000/rs6000-gen-builtins.c
index 75c9ed69ce5..ba64d90cda3 100644
--- a/gcc/config/rs6000/rs6000-gen-builtins.c
+++ b/gcc/config/rs6000/rs6000-gen-builtins.c
@@ -2045,6 +2045,7 @@ write_decls ()
   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, "};\n\n");
 
   fprintf (header_file, "#define bif_init_bit\t\t(0x00000001)\n");
@@ -2259,8 +2260,6 @@ write_header_file ()
 static void
 write_init_bif_table ()
 {
-  const char *attr_string;
-
   for (int i = 0; i <= curr_bif; i++)
     {
       fprintf (init_file,
@@ -2349,6 +2348,14 @@ write_init_bif_table ()
 		       "\n    = %d;\n",
 		       bifs[i].idname, j, bifs[i].proto.restr_val2[j]);
 	    }
+	  fprintf (init_file,
+		   "  rs6000_builtin_info_x[RS6000_BIF_%s].attr_string"
+		   "\n    = %s;\n",
+		   bifs[i].idname,
+		   bifs[i].kind == FNK_CONST ? "\"= const\""
+		   : (bifs[i].kind == FNK_PURE ? "\"= pure\""
+		      : (bifs[i].kind == FNK_FPMATH ? "\"= fp, const\""
+			 : "\"\"")));
 	  fprintf (init_file, "\n");
 	}
 
@@ -2389,13 +2396,11 @@ write_init_bif_table ()
 	{
 	  fprintf (init_file, "      TREE_READONLY (t) = 1;\n");
 	  fprintf (init_file, "      TREE_NOTHROW (t) = 1;\n");
-	  attr_string = "= const";
 	}
       else if (bifs[i].kind == FNK_PURE)
 	{
 	  fprintf (init_file, "      DECL_PURE_P (t) = 1;\n");
 	  fprintf (init_file, "      TREE_NOTHROW (t) = 1;\n");
-	  attr_string = "= pure";
 	}
       else if (bifs[i].kind == FNK_FPMATH)
 	{
@@ -2405,37 +2410,7 @@ write_init_bif_table ()
 	  fprintf (init_file, "          DECL_PURE_P (t) = 1;\n");
 	  fprintf (init_file, "          DECL_IS_NOVOPS (t) = 1;\n");
 	  fprintf (init_file, "        }\n");
-	  attr_string = "= fp, const";
 	}
-      else
-	attr_string = "";
-
-#ifdef BILLDEBUG
-      char *buf = (char *) malloc (strlen (bifs[i].fndecl) + 1);
-      strcpy (buf, bifs[i].fndecl);
-      char *tok = strtok (buf, "_");
-      const char *str = map_token_to_type_node (tok);
-      fprintf (stderr, "%s %s (", str, bifs[i].proto.bifname);
-      tok = strtok (0, "_");
-      assert (tok);
-      assert (!strcmp (tok, "ftype"));
-      tok = strtok (0, "_");
-      while (tok && strcmp (tok, "v"))
-	{
-	  str = map_token_to_type_node (tok);
-	  fprintf (stderr, "%s", str);
-	  tok = strtok (0, "_");
-	  if (tok)
-	    fprintf (stderr, ", ");
-	}
-      fprintf (stderr, "); %s [%4d] %s\n", attr_string, i,
-	       enable_string[bifs[i].stanza]);
-#endif
-
-      fprintf (init_file, "      if (TARGET_DEBUG_BUILTIN)\n");
-      fprintf (init_file, "        fprintf (stderr, \"rs6000_builtin"
-	       ", code = %4d, \"\n                  \"%s%s\\n\");\n",
-	       i, bifs[i].proto.bifname, attr_string);
       fprintf (init_file, "    }\n\n");
     }
 }


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-10-29 19:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-14 14:00 [gcc(refs/users/wschmidt/heads/builtins3)] rs6000: More progress on built-in debug support William Schmidt
  -- strict thread matches above, loose matches on Subject: below --
2020-10-29 19:52 William Schmidt
2020-10-27 16:30 William Schmidt
2020-09-16 21:31 William Schmidt
2020-08-28 20:09 William Schmidt
2020-08-20 22:06 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).