diff: delete obsolete mode number priority hack
Fergus Henderson
fjh at cs.mu.OZ.AU
Sat Jan 24 16:42:36 AEDT 1998
Estimated hours taken: 0.75
compiler/bytecode.m:
compiler/code_util.m:
compiler/const_prop.m:
compiler/hlds_out.m:
compiler/intermod.m:
compiler/llds_out.m:
compiler/make_hlds.m:
compiler/mercury_to_c.m:
compiler/modes.m:
compiler/special_pred.m:
compiler/term_errors.m:
compiler/trace.m:
Delete all the obsolete code using magic numbers (e.g. 10000)
for proc_ids. This old hack, whereby make_hlds.m assigned
mode numbers based on the priority given to the determinism of
each mode, is not needed anymore. It is no longer needed
because modecheck_call.m now chooses the mode that is the best
fit (based on a variety of factors) rather than just picking
the first allowable mode.
tests/invalid/duplicate_modes.err_exp:
The output for this test changed, in insignificant ways:
the order in which it reported the duplicates modes changed,
because the mode numbers had changed.
cvs diff compiler/bytecode.m compiler/code_util.m compiler/const_prop.m compiler/hlds_out.m compiler/intermod.m compiler/llds_out.m compiler/make_hlds.m compiler/mercury_to_c.m compiler/modes.m compiler/special_pred.m compiler/term_errors.m compiler/trace.m tests/invalid/duplicate_modes.err_exp
Index: compiler/bytecode.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/bytecode.m,v
retrieving revision 1.32
diff -u -r1.32 bytecode.m
--- bytecode.m 1998/01/23 12:56:16 1.32
+++ bytecode.m 1998/01/23 17:48:17
@@ -663,15 +663,13 @@
:- mode output_proc_id(in, di, uo) is det.
output_proc_id(ProcId) -->
- { ModeId is ProcId mod 10000 },
- output_byte(ModeId).
+ output_byte(ProcId).
:- pred debug_proc_id(byte_proc_id, io__state, io__state).
:- mode debug_proc_id(in, di, uo) is det.
debug_proc_id(ProcId) -->
- { ModeId is ProcId mod 10000 },
- debug_int(ModeId).
+ debug_int(ProcId).
%---------------------------------------------------------------------------%
Index: compiler/code_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/code_util.m,v
retrieving revision 1.92
diff -u -r1.92 code_util.m
--- code_util.m 1998/01/13 10:11:18 1.92
+++ code_util.m 1998/01/23 17:31:22
@@ -319,9 +319,8 @@
pred_info_name(PredInfo, PredName),
% code_util__translate_builtin(ModuleName, PredName, _, _, _, _).
pred_info_arity(PredInfo, Arity),
- ( code_util__inline_builtin(ModuleName, PredName, 0, Arity)
- ; code_util__inline_builtin(ModuleName, PredName, 10000, Arity)
- ).
+ ProcId = 0,
+ code_util__inline_builtin(ModuleName, PredName, ProcId, Arity).
code_util__builtin_state(ModuleInfo, PredId0, ProcId, BuiltinState) :-
predicate_module(ModuleInfo, PredId0, ModuleName),
@@ -357,89 +356,89 @@
code_util__translate_builtin_2("mercury_builtin", "builtin_int_lt", 0, [X, Y],
yes(binop((<), var(X), var(Y))), no).
-code_util__translate_builtin_2("int", "builtin_plus", 10000, [X, Y, Z],
+code_util__translate_builtin_2("int", "builtin_plus", 0, [X, Y, Z],
no, yes(Z - binop((+), var(X), var(Y)))).
-code_util__translate_builtin_2("int", "builtin_plus", 10001, [X, Y, Z],
+code_util__translate_builtin_2("int", "builtin_plus", 1, [X, Y, Z],
no, yes(X - binop((-), var(Z), var(Y)))).
-code_util__translate_builtin_2("int", "builtin_plus", 10002, [X, Y, Z],
+code_util__translate_builtin_2("int", "builtin_plus", 2, [X, Y, Z],
no, yes(Y - binop((-), var(Z), var(X)))).
-code_util__translate_builtin_2("int", "+", 10000, [X, Y, Z],
+code_util__translate_builtin_2("int", "+", 0, [X, Y, Z],
no, yes(Z - binop((+), var(X), var(Y)))).
-code_util__translate_builtin_2("int", "+", 10001, [X, Y, Z],
+code_util__translate_builtin_2("int", "+", 1, [X, Y, Z],
no, yes(X - binop((-), var(Z), var(Y)))).
-code_util__translate_builtin_2("int", "+", 10002, [X, Y, Z],
+code_util__translate_builtin_2("int", "+", 2, [X, Y, Z],
no, yes(Y - binop((-), var(Z), var(X)))).
-code_util__translate_builtin_2("int", "builtin_minus", 10000, [X, Y, Z],
+code_util__translate_builtin_2("int", "builtin_minus", 0, [X, Y, Z],
no, yes(Z - binop((-), var(X), var(Y)))).
-code_util__translate_builtin_2("int", "builtin_minus", 10001, [X, Y, Z],
+code_util__translate_builtin_2("int", "builtin_minus", 1, [X, Y, Z],
no, yes(X - binop((+), var(Y), var(Z)))).
-code_util__translate_builtin_2("int", "builtin_minus", 10002, [X, Y, Z],
+code_util__translate_builtin_2("int", "builtin_minus", 2, [X, Y, Z],
no, yes(Y - binop((-), var(X), var(Z)))).
-code_util__translate_builtin_2("int", "-", 10000, [X, Y, Z],
+code_util__translate_builtin_2("int", "-", 0, [X, Y, Z],
no, yes(Z - binop((-), var(X), var(Y)))).
-code_util__translate_builtin_2("int", "-", 10001, [X, Y, Z],
+code_util__translate_builtin_2("int", "-", 1, [X, Y, Z],
no, yes(X - binop((+), var(Y), var(Z)))).
-code_util__translate_builtin_2("int", "-", 10002, [X, Y, Z],
+code_util__translate_builtin_2("int", "-", 2, [X, Y, Z],
no, yes(Y - binop((-), var(X), var(Z)))).
-code_util__translate_builtin_2("int", "builtin_times", 10000, [X, Y, Z],
+code_util__translate_builtin_2("int", "builtin_times", 0, [X, Y, Z],
no, yes(Z - binop((*), var(X), var(Y)))).
-code_util__translate_builtin_2("int", "builtin_times", 10001, [X, Y, Z],
+code_util__translate_builtin_2("int", "builtin_times", 1, [X, Y, Z],
no, yes(X - binop((/), var(Z), var(Y)))).
-code_util__translate_builtin_2("int", "builtin_times", 10002, [X, Y, Z],
+code_util__translate_builtin_2("int", "builtin_times", 2, [X, Y, Z],
no, yes(Y - binop((/), var(Z), var(X)))).
-code_util__translate_builtin_2("int", "*", 10000, [X, Y, Z],
+code_util__translate_builtin_2("int", "*", 0, [X, Y, Z],
no, yes(Z - binop((*), var(X), var(Y)))).
-code_util__translate_builtin_2("int", "*", 10001, [X, Y, Z],
+code_util__translate_builtin_2("int", "*", 1, [X, Y, Z],
no, yes(X - binop((/), var(Z), var(Y)))).
-code_util__translate_builtin_2("int", "*", 10002, [X, Y, Z],
+code_util__translate_builtin_2("int", "*", 2, [X, Y, Z],
no, yes(Y - binop((/), var(Z), var(X)))).
-code_util__translate_builtin_2("int", "builtin_div", 10000, [X, Y, Z],
+code_util__translate_builtin_2("int", "builtin_div", 0, [X, Y, Z],
no, yes(Z - binop((/), var(X), var(Y)))).
-code_util__translate_builtin_2("int", "builtin_div", 10001, [X, Y, Z],
+code_util__translate_builtin_2("int", "builtin_div", 1, [X, Y, Z],
no, yes(X - binop((*), var(Y), var(Z)))).
-code_util__translate_builtin_2("int", "builtin_div", 10002, [X, Y, Z],
+code_util__translate_builtin_2("int", "builtin_div", 2, [X, Y, Z],
no, yes(Y - binop((/), var(X), var(Z)))).
-code_util__translate_builtin_2("int", "//", 10000, [X, Y, Z],
+code_util__translate_builtin_2("int", "//", 0, [X, Y, Z],
no, yes(Z - binop((/), var(X), var(Y)))).
-code_util__translate_builtin_2("int", "//", 10001, [X, Y, Z],
+code_util__translate_builtin_2("int", "//", 1, [X, Y, Z],
no, yes(X - binop((*), var(Y), var(Z)))).
-code_util__translate_builtin_2("int", "//", 10002, [X, Y, Z],
+code_util__translate_builtin_2("int", "//", 2, [X, Y, Z],
no, yes(Y - binop((/), var(X), var(Z)))).
-code_util__translate_builtin_2("int", "builtin_mod", 10000, [X, Y, Z],
+code_util__translate_builtin_2("int", "builtin_mod", 0, [X, Y, Z],
no, yes(Z - binop((mod), var(X), var(Y)))).
-code_util__translate_builtin_2("int", "rem", 10000, [X, Y, Z],
+code_util__translate_builtin_2("int", "rem", 0, [X, Y, Z],
no, yes(Z - binop((mod), var(X), var(Y)))).
-code_util__translate_builtin_2("int", "builtin_left_shift", 10000, [X, Y, Z],
+code_util__translate_builtin_2("int", "builtin_left_shift", 0, [X, Y, Z],
no, yes(Z - binop((<<), var(X), var(Y)))).
-code_util__translate_builtin_2("int", "<<", 10000, [X, Y, Z],
+code_util__translate_builtin_2("int", "<<", 0, [X, Y, Z],
no, yes(Z - binop((<<), var(X), var(Y)))).
-code_util__translate_builtin_2("int", "builtin_right_shift", 10000, [X, Y, Z],
+code_util__translate_builtin_2("int", "builtin_right_shift", 0, [X, Y, Z],
no, yes(Z - binop((>>), var(X), var(Y)))).
-code_util__translate_builtin_2("int", ">>", 10000, [X, Y, Z],
+code_util__translate_builtin_2("int", ">>", 0, [X, Y, Z],
no, yes(Z - binop((>>), var(X), var(Y)))).
-code_util__translate_builtin_2("int", "builtin_bit_and", 10000, [X, Y, Z],
+code_util__translate_builtin_2("int", "builtin_bit_and", 0, [X, Y, Z],
no, yes(Z - binop((&), var(X), var(Y)))).
-code_util__translate_builtin_2("int", "/\\", 10000, [X, Y, Z],
+code_util__translate_builtin_2("int", "/\\", 0, [X, Y, Z],
no, yes(Z - binop((&), var(X), var(Y)))).
-code_util__translate_builtin_2("int", "builtin_bit_or", 10000, [X, Y, Z],
+code_util__translate_builtin_2("int", "builtin_bit_or", 0, [X, Y, Z],
no, yes(Z - binop(('|'), var(X), var(Y)))).
-code_util__translate_builtin_2("int", "\\/", 10000, [X, Y, Z],
+code_util__translate_builtin_2("int", "\\/", 0, [X, Y, Z],
no, yes(Z - binop(('|'), var(X), var(Y)))).
-code_util__translate_builtin_2("int", "builtin_bit_xor", 10000, [X, Y, Z],
+code_util__translate_builtin_2("int", "builtin_bit_xor", 0, [X, Y, Z],
no, yes(Z - binop((^), var(X), var(Y)))).
-code_util__translate_builtin_2("int", "^", 10000, [X, Y, Z],
+code_util__translate_builtin_2("int", "^", 0, [X, Y, Z],
no, yes(Z - binop((^), var(X), var(Y)))).
-code_util__translate_builtin_2("int", "builtin_unary_plus", 10000, [X, Y],
+code_util__translate_builtin_2("int", "builtin_unary_plus", 0, [X, Y],
no, yes(Y - var(X))).
-code_util__translate_builtin_2("int", "+", 10000, [X, Y],
+code_util__translate_builtin_2("int", "+", 0, [X, Y],
no, yes(Y - var(X))).
-code_util__translate_builtin_2("int", "builtin_unary_minus", 10000, [X, Y],
+code_util__translate_builtin_2("int", "builtin_unary_minus", 0, [X, Y],
no, yes(Y - binop((-), const(int_const(0)), var(X)))).
-code_util__translate_builtin_2("int", "-", 10000, [X, Y],
+code_util__translate_builtin_2("int", "-", 0, [X, Y],
no, yes(Y - binop((-), const(int_const(0)), var(X)))).
-code_util__translate_builtin_2("int", "builtin_bit_neg", 10000, [X, Y],
+code_util__translate_builtin_2("int", "builtin_bit_neg", 0, [X, Y],
no, yes(Y - unop(bitwise_complement, var(X)))).
-code_util__translate_builtin_2("int", "\\", 10000, [X, Y],
+code_util__translate_builtin_2("int", "\\", 0, [X, Y],
no, yes(Y - unop(bitwise_complement, var(X)))).
code_util__translate_builtin_2("int", ">", 0, [X, Y],
yes(binop((>), var(X), var(Y))), no).
@@ -450,57 +449,57 @@
code_util__translate_builtin_2("int", "=<", 0, [X, Y],
yes(binop((<=), var(X), var(Y))), no).
-code_util__translate_builtin_2("float", "builtin_float_plus", 10000, [X, Y, Z],
+code_util__translate_builtin_2("float", "builtin_float_plus", 0, [X, Y, Z],
no, yes(Z - binop(float_plus, var(X), var(Y)))).
-code_util__translate_builtin_2("float", "builtin_float_plus", 10001, [X, Y, Z],
+code_util__translate_builtin_2("float", "builtin_float_plus", 1, [X, Y, Z],
no, yes(X - binop(float_minus, var(Z), var(Y)))).
-code_util__translate_builtin_2("float", "builtin_float_plus", 10002, [X, Y, Z],
+code_util__translate_builtin_2("float", "builtin_float_plus", 2, [X, Y, Z],
no, yes(Y - binop(float_minus, var(Z), var(X)))).
-code_util__translate_builtin_2("float", "+", 10000, [X, Y, Z],
+code_util__translate_builtin_2("float", "+", 0, [X, Y, Z],
no, yes(Z - binop(float_plus, var(X), var(Y)))).
-code_util__translate_builtin_2("float", "+", 10001, [X, Y, Z],
+code_util__translate_builtin_2("float", "+", 1, [X, Y, Z],
no, yes(X - binop(float_minus, var(Z), var(Y)))).
-code_util__translate_builtin_2("float", "+", 10002, [X, Y, Z],
+code_util__translate_builtin_2("float", "+", 2, [X, Y, Z],
no, yes(Y - binop(float_minus, var(Z), var(X)))).
-code_util__translate_builtin_2("float", "builtin_float_minus", 10000, [X, Y, Z],
+code_util__translate_builtin_2("float", "builtin_float_minus", 0, [X, Y, Z],
no, yes(Z - binop(float_minus, var(X), var(Y)))).
-code_util__translate_builtin_2("float", "builtin_float_minus", 10001, [X, Y, Z],
+code_util__translate_builtin_2("float", "builtin_float_minus", 1, [X, Y, Z],
no, yes(X - binop(float_plus, var(Y), var(Z)))).
-code_util__translate_builtin_2("float", "builtin_float_minus", 10002, [X, Y, Z],
+code_util__translate_builtin_2("float", "builtin_float_minus", 2, [X, Y, Z],
no, yes(Y - binop(float_minus, var(X), var(Z)))).
-code_util__translate_builtin_2("float", "-", 10000, [X, Y, Z],
+code_util__translate_builtin_2("float", "-", 0, [X, Y, Z],
no, yes(Z - binop(float_minus, var(X), var(Y)))).
-code_util__translate_builtin_2("float", "-", 10001, [X, Y, Z],
+code_util__translate_builtin_2("float", "-", 1, [X, Y, Z],
no, yes(X - binop(float_plus, var(Y), var(Z)))).
-code_util__translate_builtin_2("float", "-", 10002, [X, Y, Z],
+code_util__translate_builtin_2("float", "-", 2, [X, Y, Z],
no, yes(Y - binop(float_minus, var(X), var(Z)))).
-code_util__translate_builtin_2("float", "builtin_float_times", 10000, [X, Y, Z],
+code_util__translate_builtin_2("float", "builtin_float_times", 0, [X, Y, Z],
no, yes(Z - binop(float_times, var(X), var(Y)))).
-code_util__translate_builtin_2("float", "builtin_float_times", 10001, [X, Y, Z],
+code_util__translate_builtin_2("float", "builtin_float_times", 1, [X, Y, Z],
no, yes(X - binop(float_divide, var(Z), var(Y)))).
-code_util__translate_builtin_2("float", "builtin_float_times", 10002, [X, Y, Z],
+code_util__translate_builtin_2("float", "builtin_float_times", 2, [X, Y, Z],
no, yes(Y - binop(float_divide, var(Z), var(X)))).
-code_util__translate_builtin_2("float", "*", 10000, [X, Y, Z],
+code_util__translate_builtin_2("float", "*", 0, [X, Y, Z],
no, yes(Z - binop(float_times, var(X), var(Y)))).
-code_util__translate_builtin_2("float", "*", 10001, [X, Y, Z],
+code_util__translate_builtin_2("float", "*", 1, [X, Y, Z],
no, yes(X - binop(float_divide, var(Z), var(Y)))).
-code_util__translate_builtin_2("float", "*", 10002, [X, Y, Z],
+code_util__translate_builtin_2("float", "*", 2, [X, Y, Z],
no, yes(Y - binop(float_divide, var(Z), var(X)))).
-code_util__translate_builtin_2("float", "builtin_float_divide", 10000, [X, Y, Z],
+code_util__translate_builtin_2("float", "builtin_float_divide", 0, [X, Y, Z],
no, yes(Z - binop(float_divide, var(X), var(Y)))).
-code_util__translate_builtin_2("float", "builtin_float_divide", 10001, [X, Y, Z],
+code_util__translate_builtin_2("float", "builtin_float_divide", 1, [X, Y, Z],
no, yes(X - binop(float_times, var(Y), var(Z)))).
-code_util__translate_builtin_2("float", "builtin_float_divide", 10002, [X, Y, Z],
+code_util__translate_builtin_2("float", "builtin_float_divide", 2, [X, Y, Z],
no, yes(Y - binop(float_divide, var(X), var(Z)))).
-code_util__translate_builtin_2("float", "/", 10000, [X, Y, Z],
+code_util__translate_builtin_2("float", "/", 0, [X, Y, Z],
no, yes(Z - binop(float_divide, var(X), var(Y)))).
-code_util__translate_builtin_2("float", "/", 10001, [X, Y, Z],
+code_util__translate_builtin_2("float", "/", 1, [X, Y, Z],
no, yes(X - binop(float_times, var(Y), var(Z)))).
-code_util__translate_builtin_2("float", "/", 10002, [X, Y, Z],
+code_util__translate_builtin_2("float", "/", 2, [X, Y, Z],
no, yes(Y - binop(float_divide, var(X), var(Z)))).
-code_util__translate_builtin_2("float", "+", 10000, [X, Y],
+code_util__translate_builtin_2("float", "+", 0, [X, Y],
no, yes(Y - var(X))).
-code_util__translate_builtin_2("float", "-", 10000, [X, Y],
+code_util__translate_builtin_2("float", "-", 0, [X, Y],
no, yes(Y - binop(float_minus, const(float_const(0.0)), var(X)))).
code_util__translate_builtin_2("float", "builtin_float_gt", 0, [X, Y],
yes(binop(float_gt, var(X), var(Y))), no).
Index: compiler/const_prop.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/const_prop.m,v
retrieving revision 1.3
diff -u -r1.3 const_prop.m
--- const_prop.m 1998/01/23 12:56:22 1.3
+++ const_prop.m 1998/01/23 17:32:59
@@ -55,7 +55,7 @@
module_info, module_info).
:- mode evaluate_builtin_2(in, in, in, in, in, out, out, in, out) is semidet.
- % Module_info is not acutally used at the moment.
+ % Module_info is not actually used at the moment.
evaluate_builtin_2(Mod, Pred, ModeNum, Args, GoalInfo0, Goal, GoalInfo,
ModuleInfo, ModuleInfo) :-
@@ -96,25 +96,25 @@
% Integer arithmetic
-evaluate_builtin_bi("int", "+", 10000, X, Z, Z, int_const(ZVal)) :-
+evaluate_builtin_bi("int", "+", 0, X, Z, Z, int_const(ZVal)) :-
X = _XVar - bound(_XUniq, [functor(int_const(XVal), [])]),
ZVal is XVal.
-evaluate_builtin_bi("int", "-", 10000, X, Z, Z, int_const(ZVal)) :-
+evaluate_builtin_bi("int", "-", 0, X, Z, Z, int_const(ZVal)) :-
X = _XVar - bound(_XUniq, [functor(int_const(XVal), [])]),
ZVal is -XVal.
-evaluate_builtin_bi("int", "\\", 10000, X, Z, Z, int_const(ZVal)) :-
+evaluate_builtin_bi("int", "\\", 0, X, Z, Z, int_const(ZVal)) :-
X = _XVar - bound(_XUniq, [functor(int_const(XVal), [])]),
ZVal is \ XVal.
% Floating point arithmetic
-evaluate_builtin_bi("float", "+", 10000, X, Z, Z, int_const(ZVal)) :-
+evaluate_builtin_bi("float", "+", 0, X, Z, Z, int_const(ZVal)) :-
X = _XVar - bound(_XUniq, [functor(int_const(XVal), [])]),
ZVal is XVal.
-evaluate_builtin_bi("float", "-", 10000, X, Z, Z, int_const(ZVal)) :-
+evaluate_builtin_bi("float", "-", 0, X, Z, Z, int_const(ZVal)) :-
X = _XVar - bound(_XUniq, [functor(int_const(XVal), [])]),
ZVal is -XVal.
@@ -128,92 +128,92 @@
%
% Integer arithmetic
%
-evaluate_builtin_tri("int", "+", 10000, X, Y, Z, Z, int_const(ZVal)) :-
+evaluate_builtin_tri("int", "+", 0, X, Y, Z, Z, int_const(ZVal)) :-
X = _XVar - bound(_XUniq, [functor(int_const(XVal), [])]),
Y = _YVar - bound(_YUniq, [functor(int_const(YVal), [])]),
ZVal is XVal + YVal.
-evaluate_builtin_tri("int", "+", 10001, X, Y, Z, X, int_const(XVal)) :-
+evaluate_builtin_tri("int", "+", 1, X, Y, Z, X, int_const(XVal)) :-
Z = _ZVar - bound(_ZUniq, [functor(int_const(ZVal), [])]),
Y = _YVar - bound(_YUniq, [functor(int_const(YVal), [])]),
XVal is ZVal - YVal.
-evaluate_builtin_tri("int", "+", 10002, X, Y, Z, Y, int_const(YVal)) :-
+evaluate_builtin_tri("int", "+", 2, X, Y, Z, Y, int_const(YVal)) :-
Z = _ZVar - bound(_ZUniq, [functor(int_const(ZVal), [])]),
X = _XVar - bound(_XUniq, [functor(int_const(XVal), [])]),
YVal is ZVal - XVal.
-evaluate_builtin_tri("int", "-", 10000, X, Y, Z, Z, int_const(ZVal)) :-
+evaluate_builtin_tri("int", "-", 0, X, Y, Z, Z, int_const(ZVal)) :-
X = _XVar - bound(_XUniq, [functor(int_const(XVal), [])]),
Y = _YVar - bound(_YUniq, [functor(int_const(YVal), [])]),
ZVal is XVal - YVal.
-evaluate_builtin_tri("int", "-", 10001, X, Y, Z, X, int_const(XVal)) :-
+evaluate_builtin_tri("int", "-", 1, X, Y, Z, X, int_const(XVal)) :-
Z = _ZVar - bound(_ZUniq, [functor(int_const(ZVal), [])]),
Y = _YVar - bound(_YUniq, [functor(int_const(YVal), [])]),
XVal is YVal + ZVal.
-evaluate_builtin_tri("int", "-", 10002, X, Y, Z, Y, int_const(YVal)) :-
+evaluate_builtin_tri("int", "-", 2, X, Y, Z, Y, int_const(YVal)) :-
Z = _ZVar - bound(_ZUniq, [functor(int_const(ZVal), [])]),
X = _XVar - bound(_XUniq, [functor(int_const(XVal), [])]),
YVal is XVal - ZVal.
-evaluate_builtin_tri("int", "*", 10000, X, Y, Z, Z, int_const(ZVal)) :-
+evaluate_builtin_tri("int", "*", 0, X, Y, Z, Z, int_const(ZVal)) :-
X = _XVar - bound(_XUniq, [functor(int_const(XVal), [])]),
Y = _YVar - bound(_YUniq, [functor(int_const(YVal), [])]),
ZVal is XVal * YVal.
/****
-evaluate_builtin_tri("int", "*", 10001, X, Y, Z, X, int_const(XVal)) :-
+evaluate_builtin_tri("int", "*", 1, X, Y, Z, X, int_const(XVal)) :-
Z = _ZVar - bound(_ZUniq, [functor(int_const(ZVal), [])]),
Y = _YVar - bound(_YUniq, [functor(int_const(YVal), [])]),
YVal \= 0,
XVal is ZVal // YVal.
-evaluate_builtin_tri("int", "*", 10002, X, Y, Z, Y, int_const(YVal)) :-
+evaluate_builtin_tri("int", "*", 2, X, Y, Z, Y, int_const(YVal)) :-
Z = _ZVar - bound(_ZUniq, [functor(int_const(ZVal), [])]),
X = _XVar - bound(_XUniq, [functor(int_const(XVal), [])]),
XVal \= 0,
YVal is ZVal // XVal.
****/
-evaluate_builtin_tri("int", "//", 10000, X, Y, Z, Z, int_const(ZVal)) :-
+evaluate_builtin_tri("int", "//", 0, X, Y, Z, Z, int_const(ZVal)) :-
X = _XVar - bound(_XUniq, [functor(int_const(XVal), [])]),
Y = _YVar - bound(_YUniq, [functor(int_const(YVal), [])]),
YVal \= 0,
ZVal is XVal // YVal.
/****
-evaluate_builtin_tri("int", "//", 10001, X, Y, Z, X, int_const(XVal)) :-
+evaluate_builtin_tri("int", "//", 1, X, Y, Z, X, int_const(XVal)) :-
Z = _ZVar - bound(_ZUniq, [functor(int_const(ZVal), [])]),
Y = _YVar - bound(_YUniq, [functor(int_const(YVal), [])]),
XVal is ZVal * YVal.
-evaluate_builtin_tri("int", "//", 10002, X, Y, Z, Y, int_const(YVal)) :-
+evaluate_builtin_tri("int", "//", 2, X, Y, Z, Y, int_const(YVal)) :-
Z = _ZVar - bound(_ZUniq, [functor(int_const(ZVal), [])]),
X = _XVar - bound(_XUniq, [functor(int_const(XVal), [])]),
ZVal \= 0,
YVal is XVal // ZVal.
****/
-evaluate_builtin_tri("int", "mod", 10000, X, Y, Z, Z, int_const(ZVal)) :-
+evaluate_builtin_tri("int", "mod", 0, X, Y, Z, Z, int_const(ZVal)) :-
X = _XVar - bound(_XUniq, [functor(int_const(XVal), [])]),
Y = _YVar - bound(_YUniq, [functor(int_const(YVal), [])]),
ZVal is XVal mod YVal.
-evaluate_builtin_tri("int", "<<", 10000, X, Y, Z, Z, int_const(ZVal)) :-
+evaluate_builtin_tri("int", "<<", 0, X, Y, Z, Z, int_const(ZVal)) :-
X = _XVar - bound(_XUniq, [functor(int_const(XVal), [])]),
Y = _YVar - bound(_YUniq, [functor(int_const(YVal), [])]),
ZVal is XVal << YVal.
-evaluate_builtin_tri("int", ">>", 10000, X, Y, Z, Z, int_const(ZVal)) :-
+evaluate_builtin_tri("int", ">>", 0, X, Y, Z, Z, int_const(ZVal)) :-
X = _XVar - bound(_XUniq, [functor(int_const(XVal), [])]),
Y = _YVar - bound(_YUniq, [functor(int_const(YVal), [])]),
ZVal is XVal >> YVal.
-evaluate_builtin_tri("int", "/\\", 10000, X, Y, Z, Z, int_const(ZVal)) :-
+evaluate_builtin_tri("int", "/\\", 0, X, Y, Z, Z, int_const(ZVal)) :-
X = _XVar - bound(_XUniq, [functor(int_const(XVal), [])]),
Y = _YVar - bound(_YUniq, [functor(int_const(YVal), [])]),
ZVal is XVal /\ YVal.
-evaluate_builtin_tri("int", "\\/", 10000, X, Y, Z, Z, int_const(ZVal)) :-
+evaluate_builtin_tri("int", "\\/", 0, X, Y, Z, Z, int_const(ZVal)) :-
X = _XVar - bound(_XUniq, [functor(int_const(XVal), [])]),
Y = _YVar - bound(_YUniq, [functor(int_const(YVal), [])]),
ZVal is XVal \/ YVal.
-evaluate_builtin_tri("int", "^", 10000, X, Y, Z, Z, int_const(ZVal)) :-
+evaluate_builtin_tri("int", "^", 0, X, Y, Z, Z, int_const(ZVal)) :-
X = _XVar - bound(_XUniq, [functor(int_const(XVal), [])]),
Y = _YVar - bound(_YUniq, [functor(int_const(YVal), [])]),
ZVal is XVal ^ YVal.
@@ -222,57 +222,57 @@
% float arithmetic
%
-evaluate_builtin_tri("float", "+", 10000, X, Y, Z, Z, float_const(ZVal)) :-
+evaluate_builtin_tri("float", "+", 0, X, Y, Z, Z, float_const(ZVal)) :-
X = _XVar - bound(_XUniq, [functor(float_const(XVal), [])]),
Y = _YVar - bound(_YUniq, [functor(float_const(YVal), [])]),
ZVal is XVal + YVal.
-evaluate_builtin_tri("float", "+", 10001, X, Y, Z, X, float_const(XVal)) :-
+evaluate_builtin_tri("float", "+", 1, X, Y, Z, X, float_const(XVal)) :-
Z = _ZVar - bound(_ZUniq, [functor(float_const(ZVal), [])]),
Y = _YVar - bound(_YUniq, [functor(float_const(YVal), [])]),
XVal is ZVal - YVal.
-evaluate_builtin_tri("float", "+", 10002, X, Y, Z, Y, float_const(YVal)) :-
+evaluate_builtin_tri("float", "+", 2, X, Y, Z, Y, float_const(YVal)) :-
Z = _ZVar - bound(_ZUniq, [functor(float_const(ZVal), [])]),
X = _XVar - bound(_XUniq, [functor(float_const(XVal), [])]),
YVal is ZVal - XVal.
-evaluate_builtin_tri("float", "-", 10000, X, Y, Z, Z, float_const(ZVal)) :-
+evaluate_builtin_tri("float", "-", 0, X, Y, Z, Z, float_const(ZVal)) :-
X = _XVar - bound(_XUniq, [functor(float_const(XVal), [])]),
Y = _YVar - bound(_YUniq, [functor(float_const(YVal), [])]),
ZVal is XVal - YVal.
-evaluate_builtin_tri("float", "-", 10001, X, Y, Z, X, float_const(XVal)) :-
+evaluate_builtin_tri("float", "-", 1, X, Y, Z, X, float_const(XVal)) :-
Z = _ZVar - bound(_ZUniq, [functor(float_const(ZVal), [])]),
Y = _YVar - bound(_YUniq, [functor(float_const(YVal), [])]),
XVal is YVal + ZVal.
-evaluate_builtin_tri("float", "-", 10002, X, Y, Z, Y, float_const(YVal)) :-
+evaluate_builtin_tri("float", "-", 2, X, Y, Z, Y, float_const(YVal)) :-
Z = _ZVar - bound(_ZUniq, [functor(float_const(ZVal), [])]),
X = _XVar - bound(_XUniq, [functor(float_const(XVal), [])]),
YVal is XVal - ZVal.
-evaluate_builtin_tri("float", "*", 10000, X, Y, Z, Z, float_const(ZVal)) :-
+evaluate_builtin_tri("float", "*", 0, X, Y, Z, Z, float_const(ZVal)) :-
X = _XVar - bound(_XUniq, [functor(float_const(XVal), [])]),
Y = _YVar - bound(_YUniq, [functor(float_const(YVal), [])]),
ZVal is XVal * YVal.
-evaluate_builtin_tri("float", "*", 10001, X, Y, Z, X, float_const(XVal)) :-
+evaluate_builtin_tri("float", "*", 1, X, Y, Z, X, float_const(XVal)) :-
Z = _ZVar - bound(_ZUniq, [functor(float_const(ZVal), [])]),
Y = _YVar - bound(_YUniq, [functor(float_const(YVal), [])]),
YVal \= 0.0,
XVal is ZVal / YVal.
-evaluate_builtin_tri("float", "*", 10002, X, Y, Z, Y, float_const(YVal)) :-
+evaluate_builtin_tri("float", "*", 2, X, Y, Z, Y, float_const(YVal)) :-
Z = _ZVar - bound(_ZUniq, [functor(float_const(ZVal), [])]),
X = _XVar - bound(_XUniq, [functor(float_const(XVal), [])]),
XVal \= 0.0,
YVal is ZVal / XVal.
-evaluate_builtin_tri("float", "//", 10000, X, Y, Z, Z, float_const(ZVal)) :-
+evaluate_builtin_tri("float", "//", 0, X, Y, Z, Z, float_const(ZVal)) :-
X = _XVar - bound(_XUniq, [functor(float_const(XVal), [])]),
Y = _YVar - bound(_YUniq, [functor(float_const(YVal), [])]),
YVal \= 0.0,
ZVal is XVal / YVal.
-evaluate_builtin_tri("float", "//", 10001, X, Y, Z, X, float_const(XVal)) :-
+evaluate_builtin_tri("float", "//", 1, X, Y, Z, X, float_const(XVal)) :-
Z = _ZVar - bound(_ZUniq, [functor(float_const(ZVal), [])]),
Y = _YVar - bound(_YUniq, [functor(float_const(YVal), [])]),
XVal is ZVal * YVal.
-evaluate_builtin_tri("float", "//", 10002, X, Y, Z, Y, float_const(YVal)) :-
+evaluate_builtin_tri("float", "//", 2, X, Y, Z, Y, float_const(YVal)) :-
Z = _ZVar - bound(_ZUniq, [functor(float_const(ZVal), [])]),
X = _XVar - bound(_XUniq, [functor(float_const(XVal), [])]),
ZVal \= 0.0,
Index: compiler/hlds_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_out.m,v
retrieving revision 1.181
diff -u -r1.181 hlds_out.m
--- hlds_out.m 1998/01/13 10:12:15 1.181
+++ hlds_out.m 1998/01/23 17:33:24
@@ -275,8 +275,7 @@
hlds_out__write_pred_proc_id(ModuleInfo, PredId, ProcId) -->
hlds_out__write_pred_id(ModuleInfo, PredId),
io__write_string(" mode "),
- { proc_id_to_int(ProcId, ProcInt) },
- { ModeNum is ProcInt mod 10000 },
+ { proc_id_to_int(ProcId, ModeNum) },
io__write_int(ModeNum).
hlds_out__write_call_id(PredOrFunc, Name/Arity) -->
Index: compiler/intermod.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/intermod.m,v
retrieving revision 1.41
diff -u -r1.41 intermod.m
--- intermod.m 1998/01/13 10:12:21 1.41
+++ intermod.m 1998/01/23 17:45:51
@@ -868,10 +868,8 @@
{ CompareProcId =
lambda([ProcId1::in, ProcId2::in, Result::out] is det, (
proc_id_to_int(ProcId1, ProcInt1),
- ActualProcId1 is ProcInt1 mod 10000,
proc_id_to_int(ProcId2, ProcInt2),
- ActualProcId2 is ProcInt2 mod 10000,
- compare(Result, ActualProcId1, ActualProcId2)
+ compare(Result, ProcInt1, ProcInt2)
)) },
{ list__sort(CompareProcId, ProcIds, SortedProcIds) },
intermod__write_pred_modes(Procs, qualified(Module, Name),
Index: compiler/llds_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/llds_out.m,v
retrieving revision 1.69
diff -u -r1.69 llds_out.m
--- llds_out.m 1998/01/13 10:12:41 1.69
+++ llds_out.m 1998/01/23 17:36:57
@@ -625,7 +625,7 @@
output_c_procedure(Proc, PrintComments, EmitCLoops) -->
{ Proc = c_procedure(Name, Arity, proc(_PredId, ProcId), Instrs) },
- { proc_id_to_int(ProcId, ModeNum0) },
+ { proc_id_to_int(ProcId, ModeNum) },
( { PrintComments = yes } ->
io__write_string("\n/*-------------------------------------"),
io__write_string("------------------------------------*/\n")
@@ -639,7 +639,6 @@
io__write_string("'/"),
io__write_int(Arity),
io__write_string(" in mode "),
- { ModeNum is ModeNum0 mod 10000 }, % strip off the priority
io__write_int(ModeNum),
io__write_string(" */\n"),
{ llds_out__find_caller_label(Instrs, CallerLabel) },
@@ -2386,8 +2385,7 @@
),
string__int_to_string(OrigArity, ArityString),
proc_id_to_int(ModeNum0, ModeInt),
- ModeNum is ModeInt mod 10000, % strip off the priority
- string__int_to_string(ModeNum, ModeNumString),
+ string__int_to_string(ModeInt, ModeNumString),
string__append_list([LabelName, "_", ArityString, "_", ModeNumString],
ProcLabelString).
@@ -2403,8 +2401,7 @@
% figure out the ModeNumString
string__int_to_string(TypeArity, TypeArityString),
proc_id_to_int(ModeNum0, ModeInt),
- ModeNum is ModeInt mod 10000, % strip off the priority
- string__int_to_string(ModeNum, ModeNumString),
+ string__int_to_string(ModeInt, ModeNumString),
% mangle all the relevent names
llds_out__name_mangle(Module, MangledModule),
Index: compiler/make_hlds.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/make_hlds.m,v
retrieving revision 1.253
diff -u -r1.253 make_hlds.m
--- make_hlds.m 1998/01/23 12:34:40 1.253
+++ make_hlds.m 1998/01/23 17:47:21
@@ -1681,61 +1681,15 @@
error("preds_add_implicit")
).
- % This is a quick hack, especially the trick with
- % determinism_priority. Efficiency could be improved -
+ % This is a quick hack, efficiency could be improved --
% we should probably store the next available ModeId rather
% than recomputing it all the time.
+ % The unused second argument is there for obsolete historical reasons.
-next_mode_id(Procs, MaybeDet, ModeId) :-
+next_mode_id(Procs, _MaybeDet, ModeId) :-
map__to_assoc_list(Procs, List),
- list__length(List, ModeId0),
- (
- MaybeDet = no,
- determinism_priority_unspecified(Priority)
- ;
- MaybeDet = yes(Det),
- determinism_priority(Det, Priority)
- ),
- determinism_priority_step(Step),
- ( ModeId0 >= Step ->
- error("too many modes per predicate")
- ;
- true
- ),
- ModeInt is ModeId0 + Priority,
+ list__length(List, ModeInt),
proc_id_to_int(ModeId, ModeInt).
-
- % If we can call a predicate in either of two different modes,
- % we should prefer to call it in a deterministic mode
- % rather than a non-deterministic one, and we should prefer
- % to call it in a semideterministic mode rather than a deterministic
- % one. Also we should prefer a nondet mode rather than a multidet mode.
- % Higher numbers mean lower priority.
- % This works because mode analysis tries each mode in turn,
- % starting with the lowest-numbered modes.
- % XXX This is obsolete!
-
-:- pred determinism_priority(determinism, int).
-:- mode determinism_priority(in, out) is det.
-
-determinism_priority(semidet, 0).
-determinism_priority(failure, 0).
-determinism_priority(det, 10000).
-determinism_priority(erroneous, 10000).
-determinism_priority(cc_nondet, 30000).
-determinism_priority(nondet, 40000).
-determinism_priority(cc_multidet, 50000).
-determinism_priority(multidet, 60000).
-
-:- pred determinism_priority_unspecified(int).
-:- mode determinism_priority_unspecified(out) is det.
-
-determinism_priority_unspecified(20000).
-
-:- pred determinism_priority_step(int).
-:- mode determinism_priority_step(out) is det.
-
-determinism_priority_step(10000).
%-----------------------------------------------------------------------------%
Index: compiler/mercury_to_c.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mercury_to_c.m,v
retrieving revision 1.32
diff -u -r1.32 mercury_to_c.m
--- mercury_to_c.m 1998/01/13 10:12:48 1.32
+++ mercury_to_c.m 1998/01/23 17:39:01
@@ -398,8 +398,7 @@
io__write_string("_"),
io__write_int(Arity),
io__write_string("_"),
- { proc_id_to_int(ProcId, ProcInt) },
- { ModeNum is ProcInt mod 10000 }, % strip off the priority
+ { proc_id_to_int(ProcId, ModeNum) },
io__write_int(ModeNum).
:- pred c_gen_select_output_vars(module_info, list(var), list(mode), list(var)).
Index: compiler/modes.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/modes.m,v
retrieving revision 1.216
diff -u -r1.216 modes.m
--- modes.m 1998/01/21 06:11:02 1.216
+++ modes.m 1998/01/23 17:39:56
@@ -1777,7 +1777,7 @@
list__length(ArgVars, Arity),
predicate_table_search_pred_m_n_a(PredicateTable, Module, Name, Arity,
[PredId]),
- hlds_pred__proc_id_to_int(ModeId, 10000), % first mode, must be `det'
+ hlds_pred__proc_id_to_int(ModeId, 0), % first mode
Call = call(PredId, ModeId, ArgVars, not_builtin, CallUnifyContext,
qualified(Module, Name)),
goal_info_init(GoalInfo0),
Index: compiler/special_pred.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/special_pred.m,v
retrieving revision 1.18
diff -u -r1.18 special_pred.m
--- special_pred.m 1998/01/23 12:56:54 1.18
+++ special_pred.m 1998/01/23 17:42:21
@@ -64,11 +64,8 @@
special_pred_name_arity(index, "index", "__Index__", 2).
special_pred_name_arity(compare, "compare", "__Compare__", 3).
- % mode num is 0 for semidet, 10000 for det
- % see make_hlds.m
-special_pred_mode_num(unify, 0).
-special_pred_mode_num(index, 10000).
-special_pred_mode_num(compare, 10000).
+ % mode num for special procs is always 0 (the first mode)
+special_pred_mode_num(_, 0).
special_pred_info(unify, Type, "__Unify__", [Type, Type], [In, In], semidet) :-
in_mode(In).
Index: compiler/term_errors.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/term_errors.m,v
retrieving revision 1.7
diff -u -r1.7 term_errors.m
--- term_errors.m 1998/01/23 17:05:34 1.7
+++ term_errors.m 1998/01/23 17:42:41
@@ -511,9 +511,7 @@
term_errors__describe_one_proc_name(proc(PredId, ProcId), Module, Piece) :-
term_errors__describe_one_pred_name(PredId, Module, PredPiece),
- proc_id_to_int(ProcId, ProcIdInt0),
- % strip off the "priority"
- ProcIdInt is ProcIdInt0 mod 10000,
+ proc_id_to_int(ProcId, ProcIdInt),
string__int_to_string(ProcIdInt, ProcIdPart),
string__append_list([
PredPiece,
Index: compiler/trace.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/trace.m,v
retrieving revision 1.5
diff -u -r1.5 trace.m
--- trace.m 1998/01/23 12:57:01 1.5
+++ trace.m 1998/01/23 17:42:53
@@ -106,8 +106,7 @@
Comma = ", ",
trace__port_to_string(Port, PortStr),
trace__code_model_to_string(CodeModel, CodeModelStr),
- proc_id_to_int(ProcId, ProcInt),
- ModeNum is ProcInt mod 10000,
+ proc_id_to_int(ProcId, ModeNum),
string__int_to_string(ModeNum, ModeNumStr),
( trace__port_path(Port, Path) ->
trace__path_to_string(Path, PathStr)
Index: tests/invalid/duplicate_modes.err_exp
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/duplicate_modes.err_exp,v
retrieving revision 1.1
diff -u -r1.1 duplicate_modes.err_exp
--- duplicate_modes.err_exp 1997/11/23 05:18:40 1.1
+++ duplicate_modes.err_exp 1998/01/24 05:38:18
@@ -1,18 +1,18 @@
-duplicate_modes.m:004: In mode declarations for predicate `duplicate_modes:p/0':
-duplicate_modes.m:004: error: duplicate mode declaration.
-duplicate_modes.m:004: Modes `p'
-duplicate_modes.m:004: and `p is det'
-duplicate_modes.m:004: are indistinguishable.
-duplicate_modes.m:003: Here is the conflicting mode declaration.
+duplicate_modes.m:003: In mode declarations for predicate `duplicate_modes:p/0':
+duplicate_modes.m:003: error: duplicate mode declaration.
+duplicate_modes.m:003: Modes `p is det'
+duplicate_modes.m:003: and `p'
+duplicate_modes.m:003: are indistinguishable.
+duplicate_modes.m:004: Here is the conflicting mode declaration.
duplicate_modes.m:008: In mode declarations for predicate `duplicate_modes:q/2':
duplicate_modes.m:008: error: duplicate mode declaration.
duplicate_modes.m:008: Modes `q(in, out) is det'
duplicate_modes.m:008: and `q((ground -> ground), (free -> ground)) is det'
duplicate_modes.m:008: are indistinguishable.
duplicate_modes.m:009: Here is the conflicting mode declaration.
-duplicate_modes.m:015: In mode declarations for predicate `duplicate_modes:r/2':
-duplicate_modes.m:015: error: duplicate mode declaration.
-duplicate_modes.m:015: Modes `r(in, in) is det'
-duplicate_modes.m:015: and `r(in, in) is semidet'
-duplicate_modes.m:015: are indistinguishable.
-duplicate_modes.m:014: Here is the conflicting mode declaration.
+duplicate_modes.m:014: In mode declarations for predicate `duplicate_modes:r/2':
+duplicate_modes.m:014: error: duplicate mode declaration.
+duplicate_modes.m:014: Modes `r(in, in) is semidet'
+duplicate_modes.m:014: and `r(in, in) is det'
+duplicate_modes.m:014: are indistinguishable.
+duplicate_modes.m:015: Here is the conflicting mode declaration.
--
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