optc-gen.awk (END): Make sure no variable is defined more than once.

* optc-gen.awk (END): Make sure no variable is defined more
than once.
* opth-gen.awk (END): Allocate bits on a per-variable basis.
Allow for bitfield variables other than target_flags.
* doc/options.text (Mask): Document that you may specify a
variable other than target_flags.

From-SVN: r98940
This commit is contained in:
DJ Delorie 2005-04-28 16:52:12 -04:00 committed by DJ Delorie
parent b4ad897d57
commit f7f655c706
4 changed files with 52 additions and 14 deletions

View File

@ -1,3 +1,12 @@
2005-04-28 DJ Delorie <dj@redhat.com>
* optc-gen.awk (END): Make sure no variable is defined more
than once.
* opth-gen.awk (END): Allocate bits on a per-variable basis.
Allow for bitfield variables other than target_flags.
* doc/options.text (Mask): Document that you may specify a
variable other than target_flags.
2005-04-28 Martin Koegler <mkoegler@auto.tuwien.ac.at>
PR rtl-optimization/18877

View File

@ -154,14 +154,20 @@ The variable specified by the @code{Var} property should be statically
initialized to @var{value}.
@item Mask(@var{name})
The option is associated with a bit in the @code{target_flags} variable
(@pxref{Run-time Target}) and is active when that bit is set.
The option is associated with a bit in the @code{target_flags}
variable (@pxref{Run-time Target}) and is active when that bit is set.
You may also specify @code{Var} to select a variable other than
@code{target_flags}.
The options-processing script will automatically allocate a unique
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}.
The options-processing script will automatically allocate a unique bit
for the option. If the option is attached to @samp{target_flags},
the script will 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. If you use @code{Var}
to attach the option to a different variable, the associated macros are
called @code{OPTION_MASK_@var{name}} and @code{OPTION_@var{name}} respectively.
You can disable automatic bit alloction using @code{MaskExists}.
@item InverseMask(@var{othername})
@itemx InverseMask(@var{othername}, @var{thisname})

View File

@ -72,9 +72,13 @@ for (i = 0; i < n_opts; i++) {
init = opt_args("Init", flags[i])
if (init != "")
init = " = " init;
else if (name in var_seen)
continue;
printf ("/* Set by -%s.\n %s */\nint %s%s;\n\n",
opts[i], help[i], name,init)
var_seen[name] = 1;
}

View File

@ -75,24 +75,43 @@ for (i = 0; i < n_opts; i++) {
}
masknum = 0
for (i = 0; i < n_opts; i++) {
name = opt_args("Mask", flags[i])
vname = var_name(flags[i])
mask = "MASK_"
if (vname != "") {
mask = "OPTION_MASK_"
}
if (name != "" && !flag_set_p("MaskExists", flags[i]))
print "#define MASK_" name " (1 << " masknum++ ")"
print "#define " mask name " (1 << " masknum[vname]++ ")"
}
for (i = 0; i < n_extra_masks; i++) {
print "#define MASK_" extra_masks[i] " (1 << " masknum++ ")"
print "#define MASK_" extra_masks[i] " (1 << " masknum[""]++ ")"
}
for (var in masknum) {
if (masknum[var] > 31) {
if (var == "")
print "#error too many target masks"
else
print "#error too many masks for " var
}
}
if (masknum > 31)
print "#error too many target masks"
print ""
for (i = 0; i < n_opts; i++) {
name = opt_args("Mask", flags[i])
vname = var_name(flags[i])
macro = "OPTION_"
mask = "OPTION_MASK_"
if (vname == "") {
vname = "target_flags"
macro = "TARGET_"
mask = "MASK_"
}
if (name != "" && !flag_set_p("MaskExists", flags[i]))
print "#define TARGET_" name \
" ((target_flags & MASK_" name ") != 0)"
print "#define " macro name \
" ((" vname " & " mask name ") != 0)"
}
for (i = 0; i < n_extra_masks; i++) {
print "#define TARGET_" extra_masks[i] \