diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2019-09-30 16:19:43 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2019-09-30 16:19:43 +0000 |
commit | 002ffd3caa684c3eb30f8f53206439b7aa34b370 (patch) | |
tree | bc1fb384d8c3f5469131ebbe8416b7880c2fc784 /gcc/config/aarch64 | |
parent | bd785b44932274f7067105de417938597289962c (diff) | |
download | gcc-002ffd3caa684c3eb30f8f53206439b7aa34b370.zip gcc-002ffd3caa684c3eb30f8f53206439b7aa34b370.tar.gz gcc-002ffd3caa684c3eb30f8f53206439b7aa34b370.tar.bz2 |
Add a target hook for getting an ABI from a function type
This patch adds a target hook that allows targets to return
the ABI associated with a particular function type. Generally,
when multiple ABIs are in use, it must be possible to tell from
a function type and its attributes which ABI it is using.
2019-09-30 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* target.def (fntype_abi): New target hook.
* doc/tm.texi.in (TARGET_FNTYPE_ABI): Likewise.
* doc/tm.texi: Regenerate.
* target.h (predefined_function_abi): Declare.
* function-abi.cc (fntype_abi): Call targetm.calls.fntype_abi,
if defined.
* config/aarch64/aarch64.h (ARM_PCS_SIMD): New arm_pcs value.
* config/aarch64/aarch64.c: Include function-abi.h.
(aarch64_simd_abi, aarch64_fntype_abi): New functions.
(TARGET_FNTYPE_ABI): Define.
From-SVN: r276308
Diffstat (limited to 'gcc/config/aarch64')
-rw-r--r-- | gcc/config/aarch64/aarch64.c | 32 | ||||
-rw-r--r-- | gcc/config/aarch64/aarch64.h | 1 |
2 files changed, 33 insertions, 0 deletions
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 29c070d..211459c 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -74,6 +74,7 @@ #include "rtx-vector-builder.h" #include "intl.h" #include "expmed.h" +#include "function-abi.h" /* This file should be included last. */ #include "target-def.h" @@ -1365,6 +1366,24 @@ svpattern_token (enum aarch64_svpattern pattern) gcc_unreachable (); } +/* Return the descriptor of the SIMD ABI. */ + +static const predefined_function_abi & +aarch64_simd_abi (void) +{ + predefined_function_abi &simd_abi = function_abis[ARM_PCS_SIMD]; + if (!simd_abi.initialized_p ()) + { + HARD_REG_SET full_reg_clobbers + = default_function_abi.full_reg_clobbers (); + for (int regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) + if (FP_SIMD_SAVED_REGNUM_P (regno)) + CLEAR_HARD_REG_BIT (full_reg_clobbers, regno); + simd_abi.initialize (ARM_PCS_SIMD, full_reg_clobbers); + } + return simd_abi; +} + /* Generate code to enable conditional branches in functions over 1 MiB. */ const char * aarch64_gen_far_branch (rtx * operands, int pos_label, const char * dest, @@ -1810,6 +1829,16 @@ aarch64_hard_regno_mode_ok (unsigned regno, machine_mode mode) return false; } +/* Implement TARGET_FNTYPE_ABI. */ + +static const predefined_function_abi & +aarch64_fntype_abi (const_tree fntype) +{ + if (lookup_attribute ("aarch64_vector_pcs", TYPE_ATTRIBUTES (fntype))) + return aarch64_simd_abi (); + return default_function_abi; +} + /* Return true if this is a definition of a vectorized simd function. */ static bool @@ -21024,6 +21053,9 @@ aarch64_libgcc_floating_mode_supported_p #undef TARGET_GET_MULTILIB_ABI_NAME #define TARGET_GET_MULTILIB_ABI_NAME aarch64_get_multilib_abi_name +#undef TARGET_FNTYPE_ABI +#define TARGET_FNTYPE_ABI aarch64_fntype_abi + #if CHECKING_P #undef TARGET_RUN_TARGET_SELFTESTS #define TARGET_RUN_TARGET_SELFTESTS selftest::aarch64_run_selftests diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h index 7bbeed4..5aff106 100644 --- a/gcc/config/aarch64/aarch64.h +++ b/gcc/config/aarch64/aarch64.h @@ -783,6 +783,7 @@ enum aarch64_abi_type enum arm_pcs { ARM_PCS_AAPCS64, /* Base standard AAPCS for 64 bit. */ + ARM_PCS_SIMD, /* For aarch64_vector_pcs functions. */ ARM_PCS_UNKNOWN }; |