aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/doc/options.texi22
-rw-r--r--gcc/optc-gen.awk4
-rw-r--r--gcc/opth-gen.awk33
4 files changed, 53 insertions, 15 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 15f1932..4a0d723 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/doc/options.texi b/gcc/doc/options.texi
index ccc6c910..d5d1984 100644
--- a/gcc/doc/options.texi
+++ b/gcc/doc/options.texi
@@ -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 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 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. 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})
diff --git a/gcc/optc-gen.awk b/gcc/optc-gen.awk
index f458b65..ebf6a44 100644
--- a/gcc/optc-gen.awk
+++ b/gcc/optc-gen.awk
@@ -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;
}
diff --git a/gcc/opth-gen.awk b/gcc/opth-gen.awk
index b5a4c57..92c0e7e 100644
--- a/gcc/opth-gen.awk
+++ b/gcc/opth-gen.awk
@@ -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] \