OSDN Git Service

* optc-gen.awk (END): Make sure no variable is defined more
authordj <dj@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 28 Apr 2005 20:52:12 +0000 (20:52 +0000)
committerdj <dj@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 28 Apr 2005 20:52:12 +0000 (20:52 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@98940 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/doc/options.texi
gcc/optc-gen.awk
gcc/opth-gen.awk

index 15f1932..4a0d723 100644 (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
index ccc6c91..d5d1984 100644 (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 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})
index f458b65..ebf6a44 100644 (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;
 }
 
 
index b5a4c57..92c0e7e 100644 (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] \