This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RFA: Add a MaskExists options flag
- From: Richard Sandiford <rsandifo at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sat, 19 Mar 2005 09:20:25 +0000
- Subject: RFA: Add a MaskExists options flag
This patch relies on the earlier flag_set_p one.
It turns out that the c4x port has two sets of options for controlling
the same target flag (the nicely-named -mparanoid and rather more
descriptive -misr-dp-reload). It would be possible to handle this
in targetm.handle_option, but since we have a VarExists flag,
it seemed neater to add a MaskExists flag too. c4x.opt can
then use:
misr-dp-reload
Target Mask(PARANOID)
Save DP across ISR in small memory model
[...]
mparanoid
Target Report Mask(PARANOID) MaskExists
Save DP across ISR in small memory model
Bootstrapped & regression tested on i686-pc-linux-gnu with the
earlier patch also applied. Also tested on c4x-coff with the
WIP .opt patch and by checking that the patch had no effect
on the options.h output for avr-elf. OK to install?
Richard
* doc/options.texi: Document the new MaskExists flag.
* opth-gen.awk: Don't output MASK and TARGET macros for Mask(...)
if the option has the MaskExists flag.
diff -upr gcc.1/doc/options.texi gcc/doc/options.texi
--- gcc.1/doc/options.texi 2005-03-18 10:35:13.358109523 +0000
+++ gcc/doc/options.texi 2005-03-18 10:41:38.758568409 +0000
@@ -144,6 +144,7 @@ The options-processing script will autom
bit for the option and set the macro @code{MASK_@var{name}} to the
appropriate bitmask. It will also declare a @code{TARGET_@var{name}}
macro that has the value 1 when the option is active and 0 otherwise.
+You can disable this behavior using @code{MaskExists}.
@item InverseMask(@var{othername})
@itemx InverseMask(@var{othername}, @var{thisname})
@@ -152,6 +153,15 @@ The option is the inverse of another opt
the options-processing script will declare a @code{TARGET_@var{thisname}}
macro that is 1 when the option is active and 0 otherwise.
+@item MaskExists
+The mask specified by the @code{Mask} property already exists.
+No @code{MASK} or @code{TARGET} definitions should be added to
+@file{options.h} in response to this option record.
+
+The main purpose of this property is to support synonymous options.
+The first option should use @samp{Mask(@var{name})} and the others
+should use @samp{Mask(@var{name}) MaskExists}.
+
@item Report
The state of the option should be printed by @option{-fverbose-asm}.
diff -upr gcc.1/opth-gen.awk gcc/opth-gen.awk
--- gcc.1/opth-gen.awk 2005-03-18 10:34:32.961185532 +0000
+++ gcc/opth-gen.awk 2005-03-18 10:34:45.852927470 +0000
@@ -70,7 +70,7 @@ for (i = 0; i < n_opts; i++) {
masknum = 0
for (i = 0; i < n_opts; i++) {
name = opt_args("Mask", flags[i])
- if (name != "")
+ if (name != "" && !flag_set_p("MaskExists", flags[i]))
print "#define MASK_" name " (1 << " masknum++ ")"
}
if (masknum > 31)
@@ -79,7 +79,7 @@ print ""
for (i = 0; i < n_opts; i++) {
name = opt_args("Mask", flags[i])
- if (name != "")
+ if (name != "" && !flag_set_p("MaskExists", flags[i]))
print "#define TARGET_" name \
" ((target_flags & MASK_" name ") != 0)"
}