[m-dev.] Change grade handling

Thomas Charles CONWAY conway at cs.mu.OZ.AU
Fri Jul 24 14:17:28 AEST 1998


Fergus Henderson, you write:
> Why "nogc"?

Because I forgot to remove it from an earlier version of the changes.

> > Index: scripts/ml.in
> > +			none)
> > +				asm_labels=false
> > +				non_local_gotos=false
> > +				global_regs=false
> >  				;;
> 
> Is that still right?  
> Now that you've eliminated the distinction between "base grades" and
> "grade modifiers", why does `none' have a special effect on the use of
> gcc extensions?

This is right, because `none' is not the default gcc_ext component -
asm_fast is - see init_grade_options.sh-subr.

Here's a relative diff (MSG contains the log message).
-- 
Thomas Conway <conway at cs.mu.oz.au>
Nail here [] for new monitor.  )O+

diff -u -r relative/mercury/MSG mercury/MSG
--- relative/mercury/MSG	Fri Jul 24 11:04:54 1998
+++ mercury/MSG	Fri Jul 24 14:14:20 1998
@@ -1,12 +1,13 @@
 
 This change makes the parsing of GRADE/--grade strings more flexible.
-The GADE string can now have its components given in any order. The
+The GRADE string can now have its components given in any order. The
 only places that depend on the order are those that use the grade as
 part of a pathname: ml and install_grades. There is also a new option
 to the compiler `--output-grade-string' which prints the grade string
 for the set of options given to mmc/mmake.
 
-NEWS:	mention the changes.
+NEWS:
+	mention the changes.
 
 compiler/handle_options.m:
 	Reimplement convert_grade_option to accept a grade string with
@@ -36,6 +37,8 @@
 	split the grade string into . separated pieces and process them
 	in a loop, setting the appropriate options.
 
-runtime/getopt.h:
-	fix a prototype so that it *is* a prototype to shut up gcc.
+doc/user_guide.texi:
+	Add documentation on --output-grade-string.
+	Change the description of how grades are handled to match
+	the implementation. Add a some missing bits.
 
diff -u -r relative/mercury/NEWS mercury/NEWS
--- relative/mercury/NEWS	Fri Jul 24 11:04:54 1998
+++ mercury/NEWS	Fri Jul 24 11:38:31 1998
@@ -200,11 +200,6 @@
 
 * We have fixed a few minor bugs.
 
-* The components of the GRADE mmake variable/the argument to the --grade
-  option may now be given in any order. The compiler also has a new option
-  `--output-grade-string' which prints the cannonical grade string for
-  the set of options with which the compiler was invoked.
-
 NEWS for Mercury release 0.7.3
 ------------------------------
 
@@ -423,3 +418,9 @@
 * Numerous bug fixes.
 
 * XXX remove the X debugger command
+
+* The components of the argument to the `--grade' option and of the `GRADE'
+  Mmake variable may now be given in any order. The compiler also has a
+  new option `--output-grade-string' which prints the canonical grade
+  string for the set of options with which the compiler was invoked.
+
diff -u -r relative/mercury/compiler/handle_options.m mercury/compiler/handle_options.m
--- relative/mercury/compiler/handle_options.m	Fri Jul 24 11:05:06 1998
+++ mercury/compiler/handle_options.m	Fri Jul 24 11:48:37 1998
@@ -490,7 +490,7 @@
 	%	runtime/mercury_grade.h
 	%	scripts/parse_grade_options.sh-subr
 	%
-	% The grade_component type should have 1 constructor for each
+	% The grade_component type should have one constructor for each
 	% dimension of the grade. It is used when converting the components
 	% of the grade string to make sure the grade string doesn't contain
 	% more than one value for each dimension (eg *.gc.agc).
@@ -502,14 +502,14 @@
 	% actually matters is for constructing the pathname for the
 	% grade of the library, etc for linking (and installation).
 :- type grade_component
-	--->	gcc
-	;	gc
-	;	prof
-	;	trail
-	;	args
-	;	trace
-	;	par
-	;	pic
+	--->	gcc_ext		% gcc extensions see grade_component_table
+	;	gc		% the kind of GC to use
+	;	prof		% what profiling options to use
+	;	trail		% whether or not to use trailing
+	;	args		% argument passing convention
+	;	trace		% tracing/debugging options
+	;	par		% parallelism / MT
+	;	pic		% Do we need to reserve a register for PIC?
 	.
 
 convert_grade_option(GradeString, Options0, Options) :-
@@ -519,7 +519,7 @@
 			CompSet0::in, CompSet::out] is semidet, (
 		grade_component_table(CompStr, Comp, CompOpts),
 			% Check that the component isn't mentioned
-			% more than once
+			% more than once.
 		\+ set__member(Comp, CompSet0),
 		set__insert(CompSet0, Comp, CompSet),
 		add_option_list(CompOpts, Opts0, Opts)
@@ -567,6 +567,14 @@
 compute_grade_components(Options, GradeComponents) :-
 	solutions(lambda([CompData::out] is nondet, (
 		grade_component_table(Name, Comp, CompOpts),
+			% For possible component of the grade string
+			% include it in the actual grade string if all
+			% the option setting that it implies are true.
+			% ie
+			%	all [Opt, Value] (
+			%	    member(Opt - Value, CompOpts) => 
+			%		map__search(Options, Opt, Value)
+			%	)
 		\+ (
 			list__member(Opt - Value, CompOpts),
 			\+ map__search(Options, Opt, Value)
@@ -583,23 +591,24 @@
 grade_component_table("sa", args, [args - string("simple")]).
 
 	% GCC-hack components
-grade_component_table("none", gcc, [asm_labels - bool(no),
+grade_component_table("none", gcc_ext, [asm_labels - bool(no),
 	gcc_non_local_gotos - bool(no), gcc_global_registers - bool(no)]).
-grade_component_table("reg", gcc, [asm_labels - bool(no),
+grade_component_table("reg", gcc_ext, [asm_labels - bool(no),
 	gcc_non_local_gotos - bool(no), gcc_global_registers - bool(yes)]).
-grade_component_table("jump", gcc, [asm_labels - bool(no),
+grade_component_table("jump", gcc_ext, [asm_labels - bool(no),
 	gcc_non_local_gotos - bool(yes), gcc_global_registers - bool(no)]).
-grade_component_table("asm_jump", gcc, [asm_labels - bool(yes),
+grade_component_table("asm_jump", gcc_ext, [asm_labels - bool(yes),
 	gcc_non_local_gotos - bool(yes), gcc_global_registers - bool(no)]).
-grade_component_table("fast", gcc, [asm_labels - bool(no),
+grade_component_table("fast", gcc_ext, [asm_labels - bool(no),
 	gcc_non_local_gotos - bool(yes), gcc_global_registers - bool(yes)]).
-grade_component_table("asm_fast", gcc, [asm_labels - bool(yes),
+grade_component_table("asm_fast", gcc_ext, [asm_labels - bool(yes),
 	gcc_non_local_gotos - bool(yes), gcc_global_registers - bool(yes)]).
 
 	% GC components
-grade_component_table("nogc", gc, [gc - string("none")]).
 grade_component_table("gc", gc, [gc - string("conservative")]).
 grade_component_table("agc", gc, [gc - string("accurate")]).
+
+	% Parallelism/MT components.
 grade_component_table("par", par, [parallel - bool(yes)]).
 
 	% Pic reg components
diff -u -r relative/mercury/compiler/options.m mercury/compiler/options.m
--- relative/mercury/compiler/options.m	Fri Jul 24 11:05:10 1998
+++ mercury/compiler/options.m	Fri Jul 24 11:49:23 1998
@@ -1352,7 +1352,8 @@
 	io__write_string("\t\tbut do not attempt to link the named modules.\n"),
 	io__write_string("\t\t--output-grade-string\n"),
 	io__write_string("\t\tCompute the grade of the library to link with based on\n"),
-	io__write_string("\t\tthe command line options.\n").
+	io__write_string("\t\tthe command line options, and print it to the standard\n"),
+	io__write_string("\t\toutput.\n").
 
 :- pred options_help_aux_output(io__state::di, io__state::uo) is det.
 
diff -u -r relative/mercury/doc/user_guide.texi mercury/doc/user_guide.texi
--- relative/mercury/doc/user_guide.texi	Fri Jul 24 11:05:58 1998
+++ mercury/doc/user_guide.texi	Fri Jul 24 14:15:44 1998
@@ -1726,6 +1726,11 @@
 Generate C code in @file{@var{module}.c}
 and object code in @file{@var{module}.o}
 but do not attempt to link the named modules.
+
+ at sp 1
+ at item --output-grade-string
+Compute from the rest of the option settings the canonical grade
+string and print it on the standard output.
 @end table
 
 @node Auxiliary output options
@@ -1950,17 +1955,34 @@
 @table @asis
 @item @code{-s @var{grade}}
 @itemx @code{--grade @var{grade}}
-Select the compilation model.  The @var{grade} should be a base
-grade with zero or more grade modifiers appended.
-The base grades are @samp{none}, @samp{reg}, @samp{jump}, @samp{asm_jump},
- at samp{fast}, and @samp{asm_fast}.
-The grade modifiers are @samp{.gc}, @samp{.prof}, @samp{.proftime},
- at samp{.profcalls}, @samp{.tr}, and @samp{.debug}.  The @samp{.prof},
- at samp{.proftime}, and @samp{.profcalls} grade modifiers are mutually
-exclusive; only one of those three may be specified.
-If a grade includes more than one grade modifier,
-the grade modifiers must be given in the same order as the
-order they are listed here.
+Select the compilation model.
+The @var{grade} should be a @samp{.} separated list of the
+grade options to set. The grade options may be given in any order.
+The available options each belong to a set of mutually
+exclusive alternatives governing a single aspect of the compilation model.
+The set of aspects and their alternatives are:
+ at table @asis
+ at item What combination of GNU-C extensions to use:
+ at samp{none}, @samp{reg}, @samp{jump}, @samp{asm_jump},
+ at samp{fast}, and @samp{asm_fast} (the default is system dependent).
+
+ at item What garbage collection strategy to use:
+ at samp{.gc}, and @samp{.agc} (the default is no garbage collection).
+
+ at item What kind of profiling to use:
+ at samp{.prof}, @samp{.proftime}, @samp{.profcalls}, and @samp{.memprof}
+(the default is no profiling).
+
+ at item Whether to enable the trail:
+ at samp{.tr} (the default is no trailing).
+
+ at item What debuging features to enable:
+ at samp{.debug} (the default is no debuging features).
+
+ at item Whether to use a thread-safe version of the runtime environment:
+ at samp{.par} (the default is a non-thread-safe environment).
+
+ at end table
 
 The default grade is system-dependent; it is chosen at installation time
 by @samp{configure}, the auto-configuration script, but can be overridden
@@ -1980,31 +2002,28 @@
 @var{Options implied}.
 
 @item @samp{none}
-None.
+ at code{--no-gcc-global-registers --no-gcc-nonlocal_gotos --no-asm-labels}.
 
 @item @samp{reg}
- at code{--gcc-global-registers}.
+ at code{--gcc-global-registers --no-gcc-nonlocal_gotos --no-asm-labels}.
 
 @item @samp{jump}
- at code{--gcc-nonlocal-gotos}.
+ at code{--no-gcc-global-registers --gcc-nonlocal-gotos --no-asm-labels}.
 
 @item @samp{fast}
- at code{--gcc-global-registers --gcc-nonlocal-gotos}.
+ at code{--gcc-global-registers --gcc-nonlocal-gotos --no-asm-labels}.
 
 @item @samp{asm_jump}
- at code{--gcc-nonlocal-gotos --asm-labels}.
+ at code{--no-gcc-global-registers --gcc-nonlocal-gotos --asm-labels}.
 
 @item @samp{asm_fast}
 @code{--gcc-global-registers --gcc-nonlocal_gotos --asm-labels}.
 
- at end table
-
- at table @asis
- at item @var{Grade modifier}
- at var{Options implied}.
-
 @item @samp{.gc}
 @code{--gc conservative}.
+
+ at item @samp{.agc}
+ at code{--gc accurate}.
 
 @item @samp{.prof}
 @code{--profiling}.



More information about the developers mailing list