]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
aarch64: Move some diagnostic functions to aarch64.cc
authorRichard Sandiford <richard.sandiford@arm.com>
Tue, 3 Dec 2024 09:53:59 +0000 (09:53 +0000)
committerRichard Sandiford <richard.sandiford@arm.com>
Tue, 3 Dec 2024 09:53:59 +0000 (09:53 +0000)
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.

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
gcc/config/aarch64/aarch64-sve-builtins.cc
gcc/config/aarch64/aarch64.cc

index c6ce62190bce43fae7b0c9d64202a7c042df6ef4..cad6e0b0a6f00aa19651c7caa150cb4dee332d1c 100644 (file)
@@ -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);
index 79dc81fcbb73641ebab7697fe3deaf9df6f2f62b..8e94a2d2cfe4a0bea03fcec55ea9e96c2763f93b 100644 (file)
@@ -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
index 24c207cc8e03d495b3474a31e04a59f13df48169..cc401befde4f38a9bba2c888fc9bab5fa5c6eadc 100644 (file)
@@ -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