diff options
author | Kito Cheng <kito.cheng@sifive.com> | 2023-10-01 17:03:28 +0800 |
---|---|---|
committer | Kito Cheng <kito.cheng@sifive.com> | 2023-10-11 13:21:08 -0700 |
commit | 0363bba87feeb00464a5c2d3e7050b9d3f9f93cb (patch) | |
tree | e401655bbb7ce3ea9f3e0e2ad4349aa9ad2d2ee0 /gcc/opth-gen.awk | |
parent | e8d418df3dc609f27487deece796d4aa69004b8c (diff) | |
download | gcc-0363bba87feeb00464a5c2d3e7050b9d3f9f93cb.zip gcc-0363bba87feeb00464a5c2d3e7050b9d3f9f93cb.tar.gz gcc-0363bba87feeb00464a5c2d3e7050b9d3f9f93cb.tar.bz2 |
options: Define TARGET_<NAME>_P and TARGET_<NAME>_OPTS_P macro for Mask and InverseMask
We TARGET_<NAME>_P marcro to test a Mask and InverseMask with user
specified target_variable, however we may want to test with specific
gcc_options variable rather than target_variable.
Like RISC-V has defined lots of Mask with TargetVariable, which is not
easy to use, because that means we need to known which Mask are associate with
which TargetVariable, so take a gcc_options variable is a better interface
for such use case.
gcc/ChangeLog:
* doc/options.texi (Mask): Document TARGET_<NAME>_P and
TARGET_<NAME>_OPTS_P.
(InverseMask): Ditto.
* opth-gen.awk (Mask): Generate TARGET_<NAME>_P and
TARGET_<NAME>_OPTS_P macro.
(InverseMask): Ditto.
Diffstat (limited to 'gcc/opth-gen.awk')
-rw-r--r-- | gcc/opth-gen.awk | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/gcc/opth-gen.awk b/gcc/opth-gen.awk index c4398be..2655157 100644 --- a/gcc/opth-gen.awk +++ b/gcc/opth-gen.awk @@ -439,6 +439,10 @@ for (i = 0; i < n_target_vars; i++) { print "#define TARGET_" other_masks[i "," j] \ " ((" target_vars[i] " & MASK_" other_masks[i "," j] ") != 0)" + print "#define TARGET_" other_masks[i "," j] "_P(" target_vars[i] ")" \ + " (((" target_vars[i] ") & MASK_" other_masks[i "," j] ") != 0)" + print "#define TARGET_" other_masks[i "," j] "_OPTS_P(opts)" \ + " (((opts->x_" target_vars[i] ") & MASK_" other_masks[i "," j] ") != 0)" } } print "" @@ -469,15 +473,22 @@ for (i = 0; i < n_opts; i++) { " ((" vname " & " mask original_name ") != 0)" print "#define TARGET_" name "_P(" vname ")" \ " (((" vname ") & " mask original_name ") != 0)" + print "#define TARGET_" name "_OPTS_P(opts)" \ + " (((opts->x_" vname ") & " mask original_name ") != 0)" print "#define TARGET_EXPLICIT_" name "_P(opts)" \ " ((opts->x_" vname "_explicit & " mask original_name ") != 0)" print "#define SET_TARGET_" name "(opts) opts->x_" vname " |= " mask original_name } } for (i = 0; i < n_extra_masks; i++) { - if (extra_mask_macros[extra_masks[i]] == 0) + if (extra_mask_macros[extra_masks[i]] == 0) { print "#define TARGET_" extra_masks[i] \ " ((target_flags & MASK_" extra_masks[i] ") != 0)" + print "#define TARGET_" extra_masks[i] "_P(target_flags)" \ + " (((target_flags) & " extra_masks[i] ") != 0)" + print "#define TARGET_" extra_masks[i] "_OPTS_P(opts)" \ + " (((opts->x_target_flags) & MASK_" extra_masks[i] ") != 0)" + } } print "" |