Some of the diagnostics reported for SVE builtins would also be
useful for Advanced SIMD builtins, so this patch moves them from
aarch64-sve-builtins.cc to aarch64.cc.  I put them in a new aarch64
namespace for now -- perhaps in future they should be generic.

Bootstrapped & regression-tested on aarch64-linux-gnu.

This is a prerequisite for the comments I have about the LUTI support
(which was originally posted in stage 1).  I'll commit tomorrow if there
are no comments before then.

Richard


gcc/
        * config/aarch64/aarch64-sve-builtins.cc (report_non_ice)
        (report_out_of_range, report_neither_nor, report_not_one_of)
        (report_not_enum): Move to...
        * config/aarch64/aarch64.cc: ...here, putting them in the aarch64
        namespace, and...
        * config/aarch64/aarch64-protos.h: ...declare them here.
---
 gcc/config/aarch64/aarch64-protos.h        | 12 ++++
 gcc/config/aarch64/aarch64-sve-builtins.cc | 65 +---------------------
 gcc/config/aarch64/aarch64.cc              | 64 +++++++++++++++++++++
 3 files changed, 78 insertions(+), 63 deletions(-)

diff --git a/gcc/config/aarch64/aarch64-protos.h 
b/gcc/config/aarch64/aarch64-protos.h
index c6ce62190bc..cad6e0b0a6f 100644
--- a/gcc/config/aarch64/aarch64-protos.h
+++ b/gcc/config/aarch64/aarch64-protos.h
@@ -1119,6 +1119,18 @@ bool aarch64_general_check_builtin_call (location_t, 
vec<location_t>,
                                         unsigned int, tree, unsigned int,
                                         tree *);
 
+namespace aarch64 {
+  void report_non_ice (location_t, tree, unsigned int);
+  void report_out_of_range (location_t, tree, unsigned int, HOST_WIDE_INT,
+                           HOST_WIDE_INT, HOST_WIDE_INT);
+  void report_neither_nor (location_t, tree, unsigned int, HOST_WIDE_INT,
+                          HOST_WIDE_INT, HOST_WIDE_INT);
+  void report_not_one_of (location_t, tree, unsigned int, HOST_WIDE_INT,
+                         HOST_WIDE_INT, HOST_WIDE_INT, HOST_WIDE_INT,
+                         HOST_WIDE_INT);
+  void report_not_enum (location_t, tree, unsigned int, HOST_WIDE_INT, tree);
+}
+
 namespace aarch64_sve {
   void init_builtins ();
   void handle_arm_sve_h (bool);
diff --git a/gcc/config/aarch64/aarch64-sve-builtins.cc 
b/gcc/config/aarch64/aarch64-sve-builtins.cc
index 79dc81fcbb7..8e94a2d2cfe 100644
--- a/gcc/config/aarch64/aarch64-sve-builtins.cc
+++ b/gcc/config/aarch64/aarch64-sve-builtins.cc
@@ -55,6 +55,8 @@
 #include "aarch64-sve-builtins-shapes.h"
 #include "aarch64-builtins.h"
 
+using namespace aarch64;
+
 namespace aarch64_sve {
 
 /* Static information about each single-predicate or single-vector
@@ -1150,69 +1152,6 @@ lookup_fndecl (tree fndecl)
 }
 
 
-/* Report that LOCATION has a call to FNDECL in which argument ARGNO
-   was not an integer constant expression.  ARGNO counts from zero.  */
-static void
-report_non_ice (location_t location, tree fndecl, unsigned int argno)
-{
-  error_at (location, "argument %d of %qE must be an integer constant"
-           " expression", argno + 1, fndecl);
-}
-
-/* Report that LOCATION has a call to FNDECL in which argument ARGNO has
-   the value ACTUAL, whereas the function requires a value in the range
-   [MIN, MAX].  ARGNO counts from zero.  */
-static void
-report_out_of_range (location_t location, tree fndecl, unsigned int argno,
-                    HOST_WIDE_INT actual, HOST_WIDE_INT min,
-                    HOST_WIDE_INT max)
-{
-  if (min == max)
-    error_at (location, "passing %wd to argument %d of %qE, which expects"
-             " the value %wd", actual, argno + 1, fndecl, min);
-  else
-    error_at (location, "passing %wd to argument %d of %qE, which expects"
-             " a value in the range [%wd, %wd]", actual, argno + 1, fndecl,
-             min, max);
-}
-
-/* Report that LOCATION has a call to FNDECL in which argument ARGNO has
-   the value ACTUAL, whereas the function requires either VALUE0 or
-   VALUE1.  ARGNO counts from zero.  */
-static void
-report_neither_nor (location_t location, tree fndecl, unsigned int argno,
-                   HOST_WIDE_INT actual, HOST_WIDE_INT value0,
-                   HOST_WIDE_INT value1)
-{
-  error_at (location, "passing %wd to argument %d of %qE, which expects"
-           " either %wd or %wd", actual, argno + 1, fndecl, value0, value1);
-}
-
-/* Report that LOCATION has a call to FNDECL in which argument ARGNO has
-   the value ACTUAL, whereas the function requires one of VALUE0..3.
-   ARGNO counts from zero.  */
-static void
-report_not_one_of (location_t location, tree fndecl, unsigned int argno,
-                  HOST_WIDE_INT actual, HOST_WIDE_INT value0,
-                  HOST_WIDE_INT value1, HOST_WIDE_INT value2,
-                  HOST_WIDE_INT value3)
-{
-  error_at (location, "passing %wd to argument %d of %qE, which expects"
-           " %wd, %wd, %wd or %wd", actual, argno + 1, fndecl, value0, value1,
-           value2, value3);
-}
-
-/* Report that LOCATION has a call to FNDECL in which argument ARGNO has
-   the value ACTUAL, whereas the function requires a valid value of
-   enum type ENUMTYPE.  ARGNO counts from zero.  */
-static void
-report_not_enum (location_t location, tree fndecl, unsigned int argno,
-                HOST_WIDE_INT actual, tree enumtype)
-{
-  error_at (location, "passing %wd to argument %d of %qE, which expects"
-           " a valid %qT value", actual, argno + 1, fndecl, enumtype);
-}
-
 /* Try to fold constant arguments ARG1 and ARG2 using the given tree_code.
    Operations are not treated as overflowing.  */
 static tree
diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
index 24c207cc8e0..cc401befde4 100644
--- a/gcc/config/aarch64/aarch64.cc
+++ b/gcc/config/aarch64/aarch64.cc
@@ -30944,6 +30944,70 @@ aarch64_retrieve_sysreg (const char *regname, bool 
write_p, bool is128op)
   return sysreg->encoding;
 }
 
+/* Report that LOCATION has a call to FNDECL in which argument ARGNO
+   was not an integer constant expression.  ARGNO counts from zero.  */
+void
+aarch64::report_non_ice (location_t location, tree fndecl, unsigned int argno)
+{
+  error_at (location, "argument %d of %qE must be an integer constant"
+           " expression", argno + 1, fndecl);
+}
+
+/* Report that LOCATION has a call to FNDECL in which argument ARGNO has
+   the value ACTUAL, whereas the function requires a value in the range
+   [MIN, MAX].  ARGNO counts from zero.  */
+void
+aarch64::report_out_of_range (location_t location, tree fndecl,
+                             unsigned int argno, HOST_WIDE_INT actual,
+                             HOST_WIDE_INT min, HOST_WIDE_INT max)
+{
+  if (min == max)
+    error_at (location, "passing %wd to argument %d of %qE, which expects"
+             " the value %wd", actual, argno + 1, fndecl, min);
+  else
+    error_at (location, "passing %wd to argument %d of %qE, which expects"
+             " a value in the range [%wd, %wd]", actual, argno + 1, fndecl,
+             min, max);
+}
+
+/* Report that LOCATION has a call to FNDECL in which argument ARGNO has
+   the value ACTUAL, whereas the function requires either VALUE0 or
+   VALUE1.  ARGNO counts from zero.  */
+void
+aarch64::report_neither_nor (location_t location, tree fndecl,
+                            unsigned int argno, HOST_WIDE_INT actual,
+                            HOST_WIDE_INT value0, HOST_WIDE_INT value1)
+{
+  error_at (location, "passing %wd to argument %d of %qE, which expects"
+           " either %wd or %wd", actual, argno + 1, fndecl, value0, value1);
+}
+
+/* Report that LOCATION has a call to FNDECL in which argument ARGNO has
+   the value ACTUAL, whereas the function requires one of VALUE0..3.
+   ARGNO counts from zero.  */
+void
+aarch64::report_not_one_of (location_t location, tree fndecl,
+                           unsigned int argno, HOST_WIDE_INT actual,
+                           HOST_WIDE_INT value0, HOST_WIDE_INT value1,
+                           HOST_WIDE_INT value2,
+                           HOST_WIDE_INT value3)
+{
+  error_at (location, "passing %wd to argument %d of %qE, which expects"
+           " %wd, %wd, %wd or %wd", actual, argno + 1, fndecl, value0, value1,
+           value2, value3);
+}
+
+/* Report that LOCATION has a call to FNDECL in which argument ARGNO has
+   the value ACTUAL, whereas the function requires a valid value of
+   enum type ENUMTYPE.  ARGNO counts from zero.  */
+void
+aarch64::report_not_enum (location_t location, tree fndecl, unsigned int argno,
+                         HOST_WIDE_INT actual, tree enumtype)
+{
+  error_at (location, "passing %wd to argument %d of %qE, which expects"
+           " a valid %qT value", actual, argno + 1, fndecl, enumtype);
+}
+
 /* Target-specific selftests.  */
 
 #if CHECKING_P
-- 
2.25.1

Reply via email to