diff options
author | Andrea Corallo <andrea.corallo@arm.com> | 2021-12-06 11:34:35 +0100 |
---|---|---|
committer | Andrea Corallo <andrea.corallo@arm.com> | 2023-01-23 11:20:09 +0100 |
commit | d8dadbc9a5199bf7bac1ab7376b0f84f45e94350 (patch) | |
tree | 17ca1cb26898d0d6c537dcc3fe5b4c871e2e940f /gcc/common | |
parent | 47465fff9738b08796f4b52570fec49bbdbf3e57 (diff) | |
download | gcc-d8dadbc9a5199bf7bac1ab7376b0f84f45e94350.zip gcc-d8dadbc9a5199bf7bac1ab7376b0f84f45e94350.tar.gz gcc-d8dadbc9a5199bf7bac1ab7376b0f84f45e94350.tar.bz2 |
[PATCH 1/15] arm: Make mbranch-protection opts parsing common to AArch32/64
Hi all,
This change refactors all the mbranch-protection option parsing code and
types to make it common to both AArch32 and AArch64 backends.
This change also pulls in some supporting types from AArch64 to make
it common (aarch_parse_opt_result).
The significant changes in this patch are the movement of all branch
protection parsing routines from aarch64.c to aarch-common.c and
supporting data types and static data structures.
This patch also pre-declares variables and types required in the
aarch32 back-end for moved variables for function sign scope and key
to prepare for the impending series of patches that support parsing
the feature mbranch-protection in the aarch32 back-end.
gcc/ChangeLog:
* common/config/aarch64/aarch64-common.cc: Include aarch-common.h.
(all_architectures): Fix comment.
(aarch64_parse_extension): Rename return type, enum value names.
* config/aarch64/aarch64-c.cc (aarch64_update_cpp_builtins): Rename
factored out aarch_ra_sign_scope and aarch_ra_sign_key variables.
Also rename corresponding enum values.
* config/aarch64/aarch64-opts.h (aarch64_function_type): Factor
out aarch64_function_type and move it to common code as
aarch_function_type in aarch-common.h.
* config/aarch64/aarch64-protos.h: Include common types header,
move out types aarch64_parse_opt_result and aarch64_key_type to
aarch-common.h
* config/aarch64/aarch64.cc: Move mbranch-protection parsing types
and functions out into aarch-common.h and aarch-common.cc. Fix up
all the name changes resulting from the move.
* config/aarch64/aarch64.md: Fix up aarch64_ra_sign_key type name change
and enum value.
* config/aarch64/aarch64.opt: Include aarch-common.h to import
type move. Fix up name changes from factoring out common code and
data.
* config/arm/aarch-common-protos.h: Export factored out routines to both
backends.
* config/arm/aarch-common.cc: Include newly factored out types.
Move all mbranch-protection code and data structures from
aarch64.cc.
* config/arm/aarch-common.h: New header that declares types shared
between aarch32 and aarch64 backends.
* config/arm/arm-protos.h: Declare types and variables that are
made common to aarch64 and aarch32 backends - aarch_ra_sign_key,
aarch_ra_sign_scope and aarch_enable_bti.
* config/arm/arm.opt (config/arm/aarch-common.h): Include header.
(aarch_ra_sign_scope, aarch_enable_bti): Declare variable.
* config/arm/arm.cc: Add missing includes.
Co-Authored-By: Tejas Belagod <tbelagod@arm.com>
Diffstat (limited to 'gcc/common')
-rw-r--r-- | gcc/common/config/aarch64/aarch64-common.cc | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/gcc/common/config/aarch64/aarch64-common.cc b/gcc/common/config/aarch64/aarch64-common.cc index a9695d6..5fb9e9d 100644 --- a/gcc/common/config/aarch64/aarch64-common.cc +++ b/gcc/common/config/aarch64/aarch64-common.cc @@ -31,6 +31,7 @@ #include "flags.h" #include "diagnostic.h" #include "config/aarch64/aarch64-feature-deps.h" +#include "config/arm/aarch-common.h" #ifdef TARGET_BIG_ENDIAN_DEFAULT #undef TARGET_DEFAULT_TARGET_FLAGS @@ -191,13 +192,13 @@ static constexpr arch_to_arch_name all_architectures[] = /* Parse the architecture extension string STR and update ISA_FLAGS with the architecture features turned on or off. Return a - aarch64_parse_opt_result describing the result. + aarch_parse_opt_result describing the result. When the STR string contains an invalid extension, a copy of the string is created and stored to INVALID_EXTENSION. */ -enum aarch64_parse_opt_result +enum aarch_parse_opt_result aarch64_parse_extension (const char *str, aarch64_feature_flags *isa_flags, - std::string *invalid_extension) + std::string *invalid_extension) { /* The extension string is parsed left to right. */ const struct aarch64_option_extension *opt = NULL; @@ -228,7 +229,7 @@ aarch64_parse_extension (const char *str, aarch64_feature_flags *isa_flags, adding_ext = 1; if (len == 0) - return AARCH64_PARSE_MISSING_ARG; + return AARCH_PARSE_MISSING_ARG; /* Scan over the extensions table trying to find an exact match. */ @@ -250,13 +251,13 @@ aarch64_parse_extension (const char *str, aarch64_feature_flags *isa_flags, /* Extension not found in list. */ if (invalid_extension) *invalid_extension = std::string (str, len); - return AARCH64_PARSE_INVALID_FEATURE; + return AARCH_PARSE_INVALID_FEATURE; } str = ext; }; - return AARCH64_PARSE_OK; + return AARCH_PARSE_OK; } /* Append all architecture extension candidates to the CANDIDATES vector. */ |