[m-dev.] diff: add eval_method_uses_table
Fergus Henderson
fjh at cs.mu.OZ.AU
Wed Jan 26 13:01:58 AEDT 2000
On 31-Dec-1999, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
>
> > + proc_info_eval_method(ProcInfo, EvalMethod),
> > + (
> > + EvalMethod \= eval_normal
> > + ->
>
> Such blanket tests against eval_normal are not a good idea; they will break
> when the next evaluation method is added. (I am about to add one, one for
> which your code would not work.) You should test for each possible
> evaluation method separately.
Estimated hours taken: 0.75
compiler/hlds_pred.m:
Add a new function eval_method_uses_table/1.
compiler/code_gen.m:
compiler/ml_code_gen.m:
compiler/modes.m:
compiler/table_gen.m:
Use eval_method_uses_table, rather than just
assuming that every eval method other than
eval_normal uses a table.
Workspace: /home/mercury0/fjh/mercury
Index: compiler/code_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/code_gen.m,v
retrieving revision 1.71
diff -u -d -r1.71 code_gen.m
--- code_gen.m 1999/12/14 04:52:31 1.71
+++ code_gen.m 1999/12/31 05:42:40
@@ -271,7 +271,7 @@
GlobalData0, GlobalData) :-
proc_info_eval_method(ProcInfo, EvalMethod),
(
- EvalMethod \= eval_normal
+ eval_method_uses_table(EvalMethod) = yes
->
code_util__make_proc_label(ModuleInfo, PredId, ProcId,
ProcLabel),
Index: compiler/hlds_pred.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_pred.m,v
retrieving revision 1.68
diff -u -d -r1.68 hlds_pred.m
--- hlds_pred.m 1999/12/03 12:55:00 1.68
+++ hlds_pred.m 1999/12/31 05:41:33
@@ -2294,6 +2294,11 @@
:- pred eval_method_need_stratification(eval_method).
:- mode eval_method_need_stratification(in) is semidet.
+ % Return true if the given evaluation method uses a table.
+ % If so, the back-end must generate a declaration for the
+ % variable to hold the table.
+:- func eval_method_uses_table(eval_method) = bool.
+
% Return the change a given evaluation method can do to a given
% determinism.
:- pred eval_method_change_determinism(eval_method, determinism,
@@ -2322,6 +2327,11 @@
eval_method_to_string(eval_minimal, "minimal_model").
eval_method_need_stratification(eval_minimal).
+
+eval_method_uses_table(eval_normal) = no.
+eval_method_uses_table(eval_memo) = yes.
+eval_method_uses_table(eval_loop_check) = yes.
+eval_method_uses_table(eval_minimal) = yes.
eval_method_change_determinism(eval_normal, Detism, Detism).
eval_method_change_determinism(eval_memo, Detism, Detism).
Index: compiler/ml_code_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_code_gen.m,v
retrieving revision 1.26
diff -u -d -r1.26 ml_code_gen.m
--- ml_code_gen.m 1999/12/30 17:00:29 1.26
+++ ml_code_gen.m 1999/12/31 05:45:57
@@ -605,9 +605,7 @@
:- import_module goal_util, type_util, mode_util, builtin_ops.
:- import_module passes_aux.
-:- import_module string.
-:- import_module list, map, set.
-:- import_module require, std_util.
+:- import_module bool, string, list, map, set, require, std_util.
%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
@@ -766,7 +764,7 @@
Defns0, Defns) :-
proc_info_eval_method(ProcInfo, EvalMethod),
(
- EvalMethod \= eval_normal
+ eval_method_uses_table(EvalMethod) = yes
->
ml_gen_pred_label(ModuleInfo, PredId, ProcId,
MLDS_PredLabel, _MLDS_PredModule),
Index: compiler/modes.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/modes.m,v
retrieving revision 1.237
diff -u -d -r1.237 modes.m
--- modes.m 1999/11/19 13:22:13 1.237
+++ modes.m 2000/01/26 01:50:02
@@ -2153,7 +2153,7 @@
{ module_info_pred_proc_info(ModuleInfo0, PredId, ProcId,
_, ProcInfo) },
{ proc_info_eval_method(ProcInfo, EvalMethod) },
- ( { EvalMethod \= eval_normal } ->
+ ( eval_method_uses_table(EvalMethod) = yes ->
{ proc_info_context(ProcInfo, Context) },
{ eval_method_to_string(EvalMethod, EvalMethodS) },
globals__io_lookup_bool_option(verbose_errors,
Index: compiler/table_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/table_gen.m,v
retrieving revision 1.14
diff -u -d -r1.14 table_gen.m
--- table_gen.m 1999/12/21 01:22:59 1.14
+++ table_gen.m 2000/01/26 01:51:43
@@ -219,7 +219,7 @@
proc_info_eval_method(ProcInfo, EvalMethod),
(
- EvalMethod \= eval_normal
+ eval_method_uses_table(EvalMethod) = yes
->
table_gen__process_proc(EvalMethod, PredId, ProcId, ProcInfo,
PredInfo, Module0, Module1)
--
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.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list