aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2024-12-03 09:53:59 +0000
committerRichard Sandiford <richard.sandiford@arm.com>2024-12-03 09:53:59 +0000
commite8fc954631a85dcb9b1de4d936a5110d72a4986b (patch)
tree4c08db8d139aa1cf6d1a78009394f6b64a88db8b
parentf2d91164a5c54f4c246a7cc73f23aa79bc52222e (diff)
downloadgcc-e8fc954631a85dcb9b1de4d936a5110d72a4986b.zip
gcc-e8fc954631a85dcb9b1de4d936a5110d72a4986b.tar.gz
gcc-e8fc954631a85dcb9b1de4d936a5110d72a4986b.tar.bz2
aarch64: Move some diagnostic functions to aarch64.cc
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.
-rw-r--r--gcc/config/aarch64/aarch64-protos.h12
-rw-r--r--gcc/config/aarch64/aarch64-sve-builtins.cc65
-rw-r--r--gcc/config/aarch64/aarch64.cc64
3 files changed, 78 insertions, 63 deletions
diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h
index c6ce621..cad6e0b 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 79dc81f..8e94a2d 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 24c207c..cc401be 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