diff: modes.m: new option --mode-inference-iteration-limit
Fergus Henderson
fjh at hydra.cs.mu.oz.au
Mon Nov 3 04:19:17 AEDT 1997
Estimated hours taken: 1
compiler/options.m:
Add a new option `--mode-inference-iteration-limit'.
compiler/modes.m:
Use the new option rather than a hard-coded limit.
doc/user_guide.texi:
Document the new option.
cvs diff compiler/modes.m compiler/options.m doc/user_guide.texi
Index: compiler/modes.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/modes.m,v
retrieving revision 1.205
diff -u -r1.205 modes.m
--- modes.m 1997/09/15 21:12:24 1.205
+++ modes.m 1997/11/02 17:17:52
@@ -303,7 +303,8 @@
check_pred_modes(ModuleInfo0, ModuleInfo, UnsafeToContinue) -->
{ module_info_predids(ModuleInfo0, PredIds) },
- { MaxIterations = 30 }, % XXX FIXME should be command-line option
+ globals__io_lookup_int_option(mode_inference_iteration_limit,
+ MaxIterations),
modecheck_to_fixpoint(PredIds, MaxIterations, ModuleInfo0,
ModuleInfo1, UnsafeToContinue),
write_mode_inference_messages(PredIds, ModuleInfo1),
@@ -349,8 +350,15 @@
report_max_iterations_exceeded -->
io__set_exit_status(1),
- io__write_string("Mode analysis iteration limit exceeded.\n").
- % XXX FIXME add verbose_errors message
+ io__write_strings([
+ "Mode analysis iteration limit exceeded.\n",
+ "You may need to declare the modes explicitly, or use the\n",
+ "`--mode-inference-iteration-limit' option to increase the limit.\n"
+ ]),
+ globals__io_lookup_int_option(mode_inference_iteration_limit,
+ MaxIterations),
+ io__format("(The current limit is %d iterations.)\n",
+ [i(MaxIterations)]).
:- pred modecheck_pred_modes_2(list(pred_id), module_info, module_info,
bool, bool, int, int, io__state, io__state).
Index: compiler/options.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/options.m,v
retrieving revision 1.208
diff -u -r1.208 options.m
--- options.m 1997/10/14 09:07:42 1.208
+++ options.m 1997/11/02 14:33:21
@@ -100,6 +100,7 @@
; infer_modes
; infer_det
; infer_all
+ ; mode_inference_iteration_limit
% Compilation Model options
; grade
; gcc_non_local_gotos
@@ -333,7 +334,8 @@
infer_types - bool(no),
infer_modes - bool(no),
infer_det - bool(yes),
- infer_all - bool_special
+ infer_all - bool_special,
+ mode_inference_iteration_limit - int(30)
]).
option_defaults_2(compilation_model_option, [
% Compilation model options (ones that affect binary
@@ -626,6 +628,8 @@
long_option("infer-modes", infer_modes).
long_option("infer-determinism", infer_det).
long_option("infer-det", infer_det).
+long_option("mode-inference-iteration-limit",
+ mode_inference_iteration_limit).
% compilation model options
long_option("grade", grade).
@@ -1238,7 +1242,10 @@
io__write_string("\t--no-infer-det, --no-infer-determinism\n"),
io__write_string("\t\tIf there is no determinism declaration for a procedure,\n"),
- io__write_string("\t\tdon't try to infer the determinism, just report an error.\n").
+ io__write_string("\t\tdon't try to infer the determinism, just report an error.\n"),
+ io__write_string("\t--mode-inference-iteration-limit <n>\n"),
+ io__write_string("\t\tPerform at most <n> passes of mode inference (default: 30).\n").
+
:- pred options_help_compilation_model(io__state::di, io__state::uo) is det.
Index: doc/user_guide.texi
===================================================================
RCS file: /home/staff/zs/imp/mercury/doc/user_guide.texi,v
retrieving revision 1.101
diff -u -r1.101 user_guide.texi
--- user_guide.texi 1997/10/14 09:34:56 1.101
+++ user_guide.texi 1997/11/02 14:44:29
@@ -1485,6 +1485,9 @@
If there is no determinism declaration for a procedure,
don't try to infer the determinism, just report an error.
+ at sp 1
+ at item --mode-inference-iteration-limit @var{n}
+Perform at most @var{n} passes of mode inference (default: 30).
@end table
@node Compilation model options
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- the last words of T. S. Garp.
More information about the developers
mailing list