rs6000: Update rs6000_builtin_decl
authorBill Schmidt <wschmidt@linux.ibm.com>
Mon, 8 Nov 2021 14:17:53 +0000 (08:17 -0600)
committerBill Schmidt <wschmidt@linux.ibm.com>
Mon, 8 Nov 2021 14:49:37 +0000 (08:49 -0600)
Create a new version of this function that uses the new infrastructure,
and particularly checks for supported builtins the new way.

2021-11-08  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
* config/rs6000/rs6000-call.c (rs6000_new_builtin_decl): New function.
(rs6000_builtin_decl): Call it.

gcc/config/rs6000/rs6000-call.c

index c7fdf72..9ddc341 100644 (file)
@@ -16411,11 +16411,31 @@ rs6000_init_builtins (void)
     }
 }
 
+static tree
+rs6000_new_builtin_decl (unsigned code, bool /* initialize_p */)
+{
+  rs6000_gen_builtins fcode = (rs6000_gen_builtins) code;
+
+  if (fcode >= RS6000_OVLD_MAX)
+    return error_mark_node;
+
+  if (!rs6000_new_builtin_is_supported (fcode))
+    {
+      rs6000_invalid_new_builtin (fcode);
+      return error_mark_node;
+    }
+
+  return rs6000_builtin_decls_x[code];
+}
+
 /* Returns the rs6000 builtin decl for CODE.  */
 
 tree
 rs6000_builtin_decl (unsigned code, bool initialize_p ATTRIBUTE_UNUSED)
 {
+  if (new_builtins_are_live)
+    return rs6000_new_builtin_decl (code, initialize_p);
+
   HOST_WIDE_INT fnmask;
 
   if (code >= RS6000_BUILTIN_COUNT)