This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[options] Allow Var() and Mask() to be used together


	* 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.

Tested on x86_64 linux (quickstrap'd stage3 after adding some test
options).

Index: optc-gen.awk
===================================================================
RCS file: /cvs/gcc/gcc/gcc/optc-gen.awk,v
retrieving revision 2.4
diff -p -U3 -r2.4  optc-gen.awk
--- optc-gen.awk	13 Apr 2005 08:47:19 -0000	2.4
+++ optc-gen.awk	26 Apr 2005 02:08:04 -0000
@@ -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: opth-gen.awk
===================================================================
RCS file: /cvs/gcc/gcc/gcc/opth-gen.awk,v
retrieving revision 2.5
diff -p -U3 -r2.5  opth-gen.awk
--- opth-gen.awk	13 Apr 2005 08:47:19 -0000	2.5
+++ opth-gen.awk	26 Apr 2005 02:08:04 -0000
@@ -75,24 +75,27 @@ 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])
 	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[""]++ ")"
 }
-if (masknum > 31)
+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])
+	if (vname == "")
+		vname = "target_flags"
 	if (name != "" && !flag_set_p("MaskExists", flags[i]))
 		print "#define TARGET_" name \
-		      " ((target_flags & MASK_" name ") != 0)"
+		      " ((" vname " & MASK_" name ") != 0)"
 }
 for (i = 0; i < n_extra_masks; i++) {
 	print "#define TARGET_" extra_masks[i] \
Index: doc/options.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/options.texi,v
retrieving revision 1.3
diff -p -U3 -r1.3  doc/options.texi
--- doc/options.texi	13 Apr 2005 08:47:20 -0000	1.3
+++ doc/options.texi	26 Apr 2005 02:08:05 -0000
@@ -154,8 +154,10 @@ The variable specified by the @code{Var}
 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]