Code review
Andrew Bromage
bromage at students.cs.mu.oz.au
Fri Feb 28 16:28:00 AEDT 1997
G'day.
Could someone review this diff please?
Cheers,
Andrew Bromage
--------8<---CUT HERE---8<--------
Estimated hours taken: 5
Making the types pred_id and proc_id (almost) abstract.
compiler/code_util.m:
Changed the type of several predicates:
code_util__make_uni_label/4 (arg 3 was int, now proc_id)
code_util__inline_builtin/4 (arg 3 was proc_id, now int)
Added predicate code_util__translate_builtin_2/6.
compiler/hlds_module.m:
Moved invalid_pred_id/1 to hlds_pred.m
compiler/hlds_pred.m:
Types pred_id/0 and proc_id are now abstract.
Added predicates:
hlds_pred__initial_pred_id/1, hlds_pred__initial_proc_id/1,
hlds_pred__next_pred_id/2, hlds_pred__next_proc_id/2,
pred_id_to_int/2, proc_id_to_int/2,
hlds_pred__in_in_unification_proc_id/1
Moved predicate invalid_pred_id/1 (from hlds_module.m).
compiler/*.m:
Miscellaneous minor changes to cast pred/proc_ids to ints
where appropriate.
Index: base_type_info.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/base_type_info.m,v
retrieving revision 1.9
diff -u -r1.9 base_type_info.m
--- base_type_info.m 1997/02/23 06:05:14 1.9
+++ base_type_info.m 1997/02/28 02:58:05
@@ -109,7 +109,8 @@
base_type_info__gen_proc_list([Special | Specials], SpecMap, TypeId,
[proc(PredId, ProcId) | Procs]) :-
map__lookup(SpecMap, Special - TypeId, PredId),
- special_pred_mode_num(Special, ProcId),
+ special_pred_mode_num(Special, ProcInt),
+ proc_id_to_int(ProcId, ProcInt),
base_type_info__gen_proc_list(Specials, SpecMap, TypeId, Procs).
%---------------------------------------------------------------------------%
@@ -201,9 +202,11 @@
(
globals__have_static_code_addresses(Globals, yes)
->
+ hlds_pred__initial_proc_id(ProcId),
PredAddrArg = yes(const(code_addr_const(
imported(proc("mercury_builtin", predicate,
- "mercury_builtin", "unused", 0, 0)))))
+ "mercury_builtin", "unused", 0,
+ ProcId)))))
;
PredAddrArg = yes(const(int_const(0)))
),
Index: bytecode_gen.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/bytecode_gen.m,v
retrieving revision 1.23
diff -u -r1.23 bytecode_gen.m
--- bytecode_gen.m 1997/02/23 06:05:20 1.23
+++ bytecode_gen.m 1997/02/28 03:12:48
@@ -119,7 +119,8 @@
;
BodyCode = node(BodyCode0)
),
- EnterCode = node([enter_proc(ProcId, Detism, LabelCount, TempCount,
+ proc_id_to_int(ProcId, ProcInt),
+ EnterCode = node([enter_proc(ProcInt, Detism, LabelCount, TempCount,
VarInfos)]),
( CodeModel = model_semi ->
EndofCode = node([semidet_succeed, endof_proc])
@@ -305,7 +306,8 @@
bytecode_gen__gen_pickups(OutputArgs, ByteInfo, PickupArgs),
predicate_id(ModuleInfo, PredId, ModuleName, PredName, Arity),
- Call = node([call(ModuleName, PredName, Arity, ProcId)]),
+ proc_id_to_int(ProcId, ProcInt),
+ Call = node([call(ModuleName, PredName, Arity, ProcInt)]),
determinism_to_code_model(Detism, CodeModel),
( CodeModel = model_semi ->
Check = node([semidet_success_check])
@@ -587,12 +589,14 @@
;
ConsId = pred_const(PredId, ProcId),
predicate_id(ModuleInfo, PredId, ModuleName, PredName, Arity),
- ByteConsId = pred_const(ModuleName, PredName, Arity, ProcId)
+ proc_id_to_int(ProcId, ProcInt),
+ ByteConsId = pred_const(ModuleName, PredName, Arity, ProcInt)
;
ConsId = code_addr_const(PredId, ProcId),
predicate_id(ModuleInfo, PredId, ModuleName, PredName, Arity),
+ proc_id_to_int(ProcId, ProcInt),
ByteConsId = code_addr_const(ModuleName, PredName, Arity,
- ProcId)
+ ProcInt)
;
ConsId = base_type_info_const(ModuleName, TypeName, TypeArity),
ByteConsId = base_type_info_const(ModuleName, TypeName,
Index: code_gen.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/code_gen.m,v
retrieving revision 1.21
diff -u -r1.21 code_gen.m
--- code_gen.m 1997/02/23 06:05:28 1.21
+++ code_gen.m 1997/02/28 03:32:00
@@ -210,7 +210,8 @@
{ predicate_name(ModuleInfo, PredId, Name) },
{ predicate_arity(ModuleInfo, PredId, Arity) },
% construct a c_procedure structure with all the information
- { Proc = c_procedure(Name, Arity, ProcId, Instructions) }.
+ { proc_id_to_int(ProcId, LldsProcId) },
+ { Proc = c_procedure(Name, Arity, LldsProcId, Instructions) }.
:- pred generate_category_code(code_model, hlds_goal, code_tree, maybe(int),
code_info, code_info).
Index: code_util.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/code_util.m,v
retrieving revision 1.81
diff -u -r1.81 code_util.m
--- code_util.m 1997/02/23 06:05:34 1.81
+++ code_util.m 1997/02/27 06:17:32
@@ -54,7 +54,7 @@
:- pred code_util__make_proc_label(module_info, pred_id, proc_id, proc_label).
:- mode code_util__make_proc_label(in, in, in, out) is det.
-:- pred code_util__make_uni_label(module_info, type_id, int, proc_label).
+:- pred code_util__make_uni_label(module_info, type_id, proc_id, proc_label).
:- mode code_util__make_uni_label(in, in, in, out) is det.
:- pred code_util__arg_loc_to_register(arg_loc, lval).
@@ -164,7 +164,7 @@
;
pred_info_is_pseudo_imported(PredInfo),
% only the (in, in) mode of unification is imported
- ProcId = 0
+ hlds_pred__in_in_unification_proc_id(ProcId)
)
->
code_util__make_proc_label(ModuleInfo, PredId, ProcId,
@@ -186,7 +186,7 @@
;
pred_info_is_pseudo_exported(PredInfo),
% only the (in, in) mode of a unification is exported
- ProcId = 0
+ hlds_pred__in_in_unification_proc_id(ProcId)
)
->
(
@@ -261,7 +261,7 @@
(
ThisModule \= TypeModule,
PredName = "__Unify__",
- ProcId \= 0
+ \+ hlds_pred__in_in_unification_proc_id(ProcId)
->
DefiningModule = ThisModule
;
@@ -297,7 +297,7 @@
code_util__make_uni_label(ModuleInfo, TypeId, UniModeNum, ProcLabel) :-
module_info_name(ModuleInfo, ModuleName),
( TypeId = qualified(TypeModule, TypeName) - Arity ->
- ( UniModeNum = 0 ->
+ ( hlds_pred__in_in_unification_proc_id(UniModeNum) ->
Module = TypeModule
;
Module = ModuleName
@@ -327,186 +327,196 @@
predicate_module(ModuleInfo, PredId0, ModuleName),
predicate_name(ModuleInfo, PredId0, PredName),
predicate_arity(ModuleInfo, PredId0, Arity),
- ( code_util__inline_builtin(ModuleName, PredName, ProcId, Arity) ->
+ proc_id_to_int(ProcId, ProcInt),
+ ( code_util__inline_builtin(ModuleName, PredName, ProcInt, Arity) ->
BuiltinState = inline_builtin
;
BuiltinState = not_builtin
).
-:- pred code_util__inline_builtin(string, string, proc_id, int).
+:- pred code_util__inline_builtin(string, string, int, int).
:- mode code_util__inline_builtin(in, in, in, in) is semidet.
code_util__inline_builtin(ModuleName, PredName, ProcId, Arity) :-
Arity =< 3,
varset__init(VarSet),
varset__new_vars(VarSet, Arity, Args, _),
- code_util__translate_builtin(ModuleName, PredName, ProcId, Args, _, _).
+ code_util__translate_builtin_2(ModuleName, PredName, ProcId, Args, _, _).
-code_util__translate_builtin("mercury_builtin", "builtin_int_gt", 0, [X, Y],
+code_util__translate_builtin(Module, PredName, ProcId, Args, BinOp, AsgOp) :-
+ proc_id_to_int(ProcId, ProcInt),
+ code_util__translate_builtin_2(Module, PredName, ProcInt, Args,
+ BinOp, AsgOp).
+
+:- pred code_util__translate_builtin_2(string, string, int, list(var),
+ maybe(rval), maybe(pair(var, rval))).
+:- mode code_util__translate_builtin_2(in, in, in, in, out, out) is semidet.
+
+code_util__translate_builtin_2("mercury_builtin", "builtin_int_gt", 0, [X, Y],
yes(binop((>), var(X), var(Y))), no).
-code_util__translate_builtin("mercury_builtin", "builtin_int_lt", 0, [X, Y],
+code_util__translate_builtin_2("mercury_builtin", "builtin_int_lt", 0, [X, Y],
yes(binop((<), var(X), var(Y))), no).
-code_util__translate_builtin("int", "builtin_plus", 10000, [X, Y, Z],
+code_util__translate_builtin_2("int", "builtin_plus", 10000, [X, Y, Z],
no, yes(Z - binop((+), var(X), var(Y)))).
-code_util__translate_builtin("int", "builtin_plus", 10001, [X, Y, Z],
+code_util__translate_builtin_2("int", "builtin_plus", 10001, [X, Y, Z],
no, yes(X - binop((-), var(Z), var(Y)))).
-code_util__translate_builtin("int", "builtin_plus", 10002, [X, Y, Z],
+code_util__translate_builtin_2("int", "builtin_plus", 10002, [X, Y, Z],
no, yes(Y - binop((-), var(Z), var(X)))).
-code_util__translate_builtin("int", "+", 10000, [X, Y, Z],
+code_util__translate_builtin_2("int", "+", 10000, [X, Y, Z],
no, yes(Z - binop((+), var(X), var(Y)))).
-code_util__translate_builtin("int", "+", 10001, [X, Y, Z],
+code_util__translate_builtin_2("int", "+", 10001, [X, Y, Z],
no, yes(X - binop((-), var(Z), var(Y)))).
-code_util__translate_builtin("int", "+", 10002, [X, Y, Z],
+code_util__translate_builtin_2("int", "+", 10002, [X, Y, Z],
no, yes(Y - binop((-), var(Z), var(X)))).
-code_util__translate_builtin("int", "builtin_minus", 10000, [X, Y, Z],
+code_util__translate_builtin_2("int", "builtin_minus", 10000, [X, Y, Z],
no, yes(Z - binop((-), var(X), var(Y)))).
-code_util__translate_builtin("int", "builtin_minus", 10001, [X, Y, Z],
+code_util__translate_builtin_2("int", "builtin_minus", 10001, [X, Y, Z],
no, yes(X - binop((+), var(Y), var(Z)))).
-code_util__translate_builtin("int", "builtin_minus", 10002, [X, Y, Z],
+code_util__translate_builtin_2("int", "builtin_minus", 10002, [X, Y, Z],
no, yes(Y - binop((-), var(X), var(Z)))).
-code_util__translate_builtin("int", "-", 10000, [X, Y, Z],
+code_util__translate_builtin_2("int", "-", 10000, [X, Y, Z],
no, yes(Z - binop((-), var(X), var(Y)))).
-code_util__translate_builtin("int", "-", 10001, [X, Y, Z],
+code_util__translate_builtin_2("int", "-", 10001, [X, Y, Z],
no, yes(X - binop((+), var(Y), var(Z)))).
-code_util__translate_builtin("int", "-", 10002, [X, Y, Z],
+code_util__translate_builtin_2("int", "-", 10002, [X, Y, Z],
no, yes(Y - binop((-), var(X), var(Z)))).
-code_util__translate_builtin("int", "builtin_times", 10000, [X, Y, Z],
+code_util__translate_builtin_2("int", "builtin_times", 10000, [X, Y, Z],
no, yes(Z - binop((*), var(X), var(Y)))).
-code_util__translate_builtin("int", "builtin_times", 10001, [X, Y, Z],
+code_util__translate_builtin_2("int", "builtin_times", 10001, [X, Y, Z],
no, yes(X - binop((/), var(Z), var(Y)))).
-code_util__translate_builtin("int", "builtin_times", 10002, [X, Y, Z],
+code_util__translate_builtin_2("int", "builtin_times", 10002, [X, Y, Z],
no, yes(Y - binop((/), var(Z), var(X)))).
-code_util__translate_builtin("int", "*", 10000, [X, Y, Z],
+code_util__translate_builtin_2("int", "*", 10000, [X, Y, Z],
no, yes(Z - binop((*), var(X), var(Y)))).
-code_util__translate_builtin("int", "*", 10001, [X, Y, Z],
+code_util__translate_builtin_2("int", "*", 10001, [X, Y, Z],
no, yes(X - binop((/), var(Z), var(Y)))).
-code_util__translate_builtin("int", "*", 10002, [X, Y, Z],
+code_util__translate_builtin_2("int", "*", 10002, [X, Y, Z],
no, yes(Y - binop((/), var(Z), var(X)))).
-code_util__translate_builtin("int", "builtin_div", 10000, [X, Y, Z],
+code_util__translate_builtin_2("int", "builtin_div", 10000, [X, Y, Z],
no, yes(Z - binop((/), var(X), var(Y)))).
-code_util__translate_builtin("int", "builtin_div", 10001, [X, Y, Z],
+code_util__translate_builtin_2("int", "builtin_div", 10001, [X, Y, Z],
no, yes(X - binop((*), var(Y), var(Z)))).
-code_util__translate_builtin("int", "builtin_div", 10002, [X, Y, Z],
+code_util__translate_builtin_2("int", "builtin_div", 10002, [X, Y, Z],
no, yes(Y - binop((/), var(X), var(Z)))).
-code_util__translate_builtin("int", "//", 10000, [X, Y, Z],
+code_util__translate_builtin_2("int", "//", 10000, [X, Y, Z],
no, yes(Z - binop((/), var(X), var(Y)))).
-code_util__translate_builtin("int", "//", 10001, [X, Y, Z],
+code_util__translate_builtin_2("int", "//", 10001, [X, Y, Z],
no, yes(X - binop((*), var(Y), var(Z)))).
-code_util__translate_builtin("int", "//", 10002, [X, Y, Z],
+code_util__translate_builtin_2("int", "//", 10002, [X, Y, Z],
no, yes(Y - binop((/), var(X), var(Z)))).
-code_util__translate_builtin("int", "builtin_mod", 10000, [X, Y, Z],
+code_util__translate_builtin_2("int", "builtin_mod", 10000, [X, Y, Z],
no, yes(Z - binop((mod), var(X), var(Y)))).
-code_util__translate_builtin("int", "mod", 10000, [X, Y, Z],
+code_util__translate_builtin_2("int", "mod", 10000, [X, Y, Z],
no, yes(Z - binop((mod), var(X), var(Y)))).
-code_util__translate_builtin("int", "builtin_left_shift", 10000, [X, Y, Z],
+code_util__translate_builtin_2("int", "builtin_left_shift", 10000, [X, Y, Z],
no, yes(Z - binop((<<), var(X), var(Y)))).
-code_util__translate_builtin("int", "<<", 10000, [X, Y, Z],
+code_util__translate_builtin_2("int", "<<", 10000, [X, Y, Z],
no, yes(Z - binop((<<), var(X), var(Y)))).
-code_util__translate_builtin("int", "builtin_right_shift", 10000, [X, Y, Z],
+code_util__translate_builtin_2("int", "builtin_right_shift", 10000, [X, Y, Z],
no, yes(Z - binop((>>), var(X), var(Y)))).
-code_util__translate_builtin("int", ">>", 10000, [X, Y, Z],
+code_util__translate_builtin_2("int", ">>", 10000, [X, Y, Z],
no, yes(Z - binop((>>), var(X), var(Y)))).
-code_util__translate_builtin("int", "builtin_bit_and", 10000, [X, Y, Z],
+code_util__translate_builtin_2("int", "builtin_bit_and", 10000, [X, Y, Z],
no, yes(Z - binop((&), var(X), var(Y)))).
-code_util__translate_builtin("int", "/\\", 10000, [X, Y, Z],
+code_util__translate_builtin_2("int", "/\\", 10000, [X, Y, Z],
no, yes(Z - binop((&), var(X), var(Y)))).
-code_util__translate_builtin("int", "builtin_bit_or", 10000, [X, Y, Z],
+code_util__translate_builtin_2("int", "builtin_bit_or", 10000, [X, Y, Z],
no, yes(Z - binop(('|'), var(X), var(Y)))).
-code_util__translate_builtin("int", "\\/", 10000, [X, Y, Z],
+code_util__translate_builtin_2("int", "\\/", 10000, [X, Y, Z],
no, yes(Z - binop(('|'), var(X), var(Y)))).
-code_util__translate_builtin("int", "builtin_bit_xor", 10000, [X, Y, Z],
+code_util__translate_builtin_2("int", "builtin_bit_xor", 10000, [X, Y, Z],
no, yes(Z - binop((^), var(X), var(Y)))).
-code_util__translate_builtin("int", "^", 10000, [X, Y, Z],
+code_util__translate_builtin_2("int", "^", 10000, [X, Y, Z],
no, yes(Z - binop((^), var(X), var(Y)))).
-code_util__translate_builtin("int", "builtin_unary_plus", 10000, [X, Y],
+code_util__translate_builtin_2("int", "builtin_unary_plus", 10000, [X, Y],
no, yes(Y - var(X))).
-code_util__translate_builtin("int", "+", 10000, [X, Y],
+code_util__translate_builtin_2("int", "+", 10000, [X, Y],
no, yes(Y - var(X))).
-code_util__translate_builtin("int", "builtin_unary_minus", 10000, [X, Y],
+code_util__translate_builtin_2("int", "builtin_unary_minus", 10000, [X, Y],
no, yes(Y - binop((-), const(int_const(0)), var(X)))).
-code_util__translate_builtin("int", "-", 10000, [X, Y],
+code_util__translate_builtin_2("int", "-", 10000, [X, Y],
no, yes(Y - binop((-), const(int_const(0)), var(X)))).
-code_util__translate_builtin("int", "builtin_bit_neg", 10000, [X, Y],
+code_util__translate_builtin_2("int", "builtin_bit_neg", 10000, [X, Y],
no, yes(Y - unop(bitwise_complement, var(X)))).
-code_util__translate_builtin("int", "\\", 10000, [X, Y],
+code_util__translate_builtin_2("int", "\\", 10000, [X, Y],
no, yes(Y - unop(bitwise_complement, var(X)))).
-code_util__translate_builtin("int", ">", 0, [X, Y],
+code_util__translate_builtin_2("int", ">", 0, [X, Y],
yes(binop((>), var(X), var(Y))), no).
-code_util__translate_builtin("int", "<", 0, [X, Y],
+code_util__translate_builtin_2("int", "<", 0, [X, Y],
yes(binop((<), var(X), var(Y))), no).
-code_util__translate_builtin("int", ">=", 0, [X, Y],
+code_util__translate_builtin_2("int", ">=", 0, [X, Y],
yes(binop((>=), var(X), var(Y))), no).
-code_util__translate_builtin("int", "=<", 0, [X, Y],
+code_util__translate_builtin_2("int", "=<", 0, [X, Y],
yes(binop((<=), var(X), var(Y))), no).
-code_util__translate_builtin("float", "builtin_float_plus", 10000, [X, Y, Z],
+code_util__translate_builtin_2("float", "builtin_float_plus", 10000, [X, Y, Z],
no, yes(Z - binop(float_plus, var(X), var(Y)))).
-code_util__translate_builtin("float", "builtin_float_plus", 10001, [X, Y, Z],
+code_util__translate_builtin_2("float", "builtin_float_plus", 10001, [X, Y, Z],
no, yes(X - binop(float_minus, var(Z), var(Y)))).
-code_util__translate_builtin("float", "builtin_float_plus", 10002, [X, Y, Z],
+code_util__translate_builtin_2("float", "builtin_float_plus", 10002, [X, Y, Z],
no, yes(Y - binop(float_minus, var(Z), var(X)))).
-code_util__translate_builtin("float", "+", 10000, [X, Y, Z],
+code_util__translate_builtin_2("float", "+", 10000, [X, Y, Z],
no, yes(Z - binop(float_plus, var(X), var(Y)))).
-code_util__translate_builtin("float", "+", 10001, [X, Y, Z],
+code_util__translate_builtin_2("float", "+", 10001, [X, Y, Z],
no, yes(X - binop(float_minus, var(Z), var(Y)))).
-code_util__translate_builtin("float", "+", 10002, [X, Y, Z],
+code_util__translate_builtin_2("float", "+", 10002, [X, Y, Z],
no, yes(Y - binop(float_minus, var(Z), var(X)))).
-code_util__translate_builtin("float", "builtin_float_minus", 10000, [X, Y, Z],
+code_util__translate_builtin_2("float", "builtin_float_minus", 10000, [X, Y, Z],
no, yes(Z - binop(float_minus, var(X), var(Y)))).
-code_util__translate_builtin("float", "builtin_float_minus", 10001, [X, Y, Z],
+code_util__translate_builtin_2("float", "builtin_float_minus", 10001, [X, Y, Z],
no, yes(X - binop(float_plus, var(Y), var(Z)))).
-code_util__translate_builtin("float", "builtin_float_minus", 10002, [X, Y, Z],
+code_util__translate_builtin_2("float", "builtin_float_minus", 10002, [X, Y, Z],
no, yes(Y - binop(float_minus, var(X), var(Z)))).
-code_util__translate_builtin("float", "-", 10000, [X, Y, Z],
+code_util__translate_builtin_2("float", "-", 10000, [X, Y, Z],
no, yes(Z - binop(float_minus, var(X), var(Y)))).
-code_util__translate_builtin("float", "-", 10001, [X, Y, Z],
+code_util__translate_builtin_2("float", "-", 10001, [X, Y, Z],
no, yes(X - binop(float_plus, var(Y), var(Z)))).
-code_util__translate_builtin("float", "-", 10002, [X, Y, Z],
+code_util__translate_builtin_2("float", "-", 10002, [X, Y, Z],
no, yes(Y - binop(float_minus, var(X), var(Z)))).
-code_util__translate_builtin("float", "builtin_float_times", 10000, [X, Y, Z],
+code_util__translate_builtin_2("float", "builtin_float_times", 10000, [X, Y, Z],
no, yes(Z - binop(float_times, var(X), var(Y)))).
-code_util__translate_builtin("float", "builtin_float_times", 10001, [X, Y, Z],
+code_util__translate_builtin_2("float", "builtin_float_times", 10001, [X, Y, Z],
no, yes(X - binop(float_divide, var(Z), var(Y)))).
-code_util__translate_builtin("float", "builtin_float_times", 10002, [X, Y, Z],
+code_util__translate_builtin_2("float", "builtin_float_times", 10002, [X, Y, Z],
no, yes(Y - binop(float_divide, var(Z), var(X)))).
-code_util__translate_builtin("float", "*", 10000, [X, Y, Z],
+code_util__translate_builtin_2("float", "*", 10000, [X, Y, Z],
no, yes(Z - binop(float_times, var(X), var(Y)))).
-code_util__translate_builtin("float", "*", 10001, [X, Y, Z],
+code_util__translate_builtin_2("float", "*", 10001, [X, Y, Z],
no, yes(X - binop(float_divide, var(Z), var(Y)))).
-code_util__translate_builtin("float", "*", 10002, [X, Y, Z],
+code_util__translate_builtin_2("float", "*", 10002, [X, Y, Z],
no, yes(Y - binop(float_divide, var(Z), var(X)))).
-code_util__translate_builtin("float", "builtin_float_divide", 10000, [X, Y, Z],
+code_util__translate_builtin_2("float", "builtin_float_divide", 10000, [X, Y, Z],
no, yes(Z - binop(float_divide, var(X), var(Y)))).
-code_util__translate_builtin("float", "builtin_float_divide", 10001, [X, Y, Z],
+code_util__translate_builtin_2("float", "builtin_float_divide", 10001, [X, Y, Z],
no, yes(X - binop(float_times, var(Y), var(Z)))).
-code_util__translate_builtin("float", "builtin_float_divide", 10002, [X, Y, Z],
+code_util__translate_builtin_2("float", "builtin_float_divide", 10002, [X, Y, Z],
no, yes(Y - binop(float_divide, var(X), var(Z)))).
-code_util__translate_builtin("float", "/", 10000, [X, Y, Z],
+code_util__translate_builtin_2("float", "/", 10000, [X, Y, Z],
no, yes(Z - binop(float_divide, var(X), var(Y)))).
-code_util__translate_builtin("float", "/", 10001, [X, Y, Z],
+code_util__translate_builtin_2("float", "/", 10001, [X, Y, Z],
no, yes(X - binop(float_times, var(Y), var(Z)))).
-code_util__translate_builtin("float", "/", 10002, [X, Y, Z],
+code_util__translate_builtin_2("float", "/", 10002, [X, Y, Z],
no, yes(Y - binop(float_divide, var(X), var(Z)))).
-code_util__translate_builtin("float", "+", 10000, [X, Y],
+code_util__translate_builtin_2("float", "+", 10000, [X, Y],
no, yes(Y - var(X))).
-code_util__translate_builtin("float", "-", 10000, [X, Y],
+code_util__translate_builtin_2("float", "-", 10000, [X, Y],
no, yes(Y - binop(float_minus, const(float_const(0.0)), var(X)))).
-code_util__translate_builtin("float", "builtin_float_gt", 0, [X, Y],
+code_util__translate_builtin_2("float", "builtin_float_gt", 0, [X, Y],
yes(binop(float_gt, var(X), var(Y))), no).
-code_util__translate_builtin("float", ">", 0, [X, Y],
+code_util__translate_builtin_2("float", ">", 0, [X, Y],
yes(binop(float_gt, var(X), var(Y))), no).
-code_util__translate_builtin("float", "builtin_float_lt", 0, [X, Y],
+code_util__translate_builtin_2("float", "builtin_float_lt", 0, [X, Y],
yes(binop(float_lt, var(X), var(Y))), no).
-code_util__translate_builtin("float", "<", 0, [X, Y],
+code_util__translate_builtin_2("float", "<", 0, [X, Y],
yes(binop(float_lt, var(X), var(Y))), no).
-code_util__translate_builtin("float", "builtin_float_ge", 0, [X, Y],
+code_util__translate_builtin_2("float", "builtin_float_ge", 0, [X, Y],
yes(binop(float_ge, var(X), var(Y))), no).
-code_util__translate_builtin("float", ">=", 0, [X, Y],
+code_util__translate_builtin_2("float", ">=", 0, [X, Y],
yes(binop(float_ge, var(X), var(Y))), no).
-code_util__translate_builtin("float", "builtin_float_le", 0, [X, Y],
+code_util__translate_builtin_2("float", "builtin_float_le", 0, [X, Y],
yes(binop(float_le, var(X), var(Y))), no).
-code_util__translate_builtin("float", "=<", 0, [X, Y],
+code_util__translate_builtin_2("float", "=<", 0, [X, Y],
yes(binop(float_le, var(X), var(Y))), no).
%-----------------------------------------------------------------------------%
Index: dead_proc_elim.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/dead_proc_elim.m,v
retrieving revision 1.24
diff -u -r1.24 dead_proc_elim.m
--- dead_proc_elim.m 1997/02/23 06:05:46 1.24
+++ dead_proc_elim.m 1997/02/27 06:05:45
@@ -447,9 +447,13 @@
% Find out if the predicate is defined in this module.
% If yes, find out also whether any of its procedures
% must be kept.
- ( Status = local, Keep = no
- ; Status = pseudo_imported, Keep = no
- ; Status = pseudo_exported, Keep = yes(0)
+ ( Status = local,
+ Keep = no
+ ; Status = pseudo_imported,
+ Keep = no
+ ; Status = pseudo_exported,
+ hlds_pred__initial_proc_id(InitProcId),
+ Keep = yes(InitProcId)
)
->
pred_info_procids(PredInfo0, ProcIds0),
Index: fact_table.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/fact_table.m,v
retrieving revision 1.2
diff -u -r1.2 fact_table.m
--- fact_table.m 1997/02/12 05:38:46 1.2
+++ fact_table.m 1997/02/27 06:22:29
@@ -539,7 +539,8 @@
open_sort_files([], _, []) --> [].
open_sort_files([ProcID | ProcIDs], BaseName, ProcStreams) -->
- { string__format("%s.tmp.%d", [s(BaseName), i(ProcID)], SortFileName) },
+ { proc_id_to_int(ProcID, ProcInt) },
+ { string__format("%s.tmp.%d", [s(BaseName), i(ProcInt)], SortFileName) },
io__open_output(SortFileName, Result),
(
{ Result = ok(Stream) },
Index: hlds_module.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/hlds_module.m,v
retrieving revision 1.16
diff -u -r1.16 hlds_module.m
--- hlds_module.m 1997/02/23 06:06:33 1.16
+++ hlds_module.m 1997/02/27 06:12:06
@@ -442,7 +442,8 @@
( map__search(Preds, PredId, PredInfoPrime) ->
PredInfo = PredInfoPrime
;
- string__int_to_string(PredId, PredStr),
+ pred_id_to_int(PredId, PredInt),
+ string__int_to_string(PredInt, PredStr),
string__append("cannot find predicate number ", PredStr, Msg),
error(Msg)
).
@@ -996,14 +997,6 @@
predicate_table).
:- mode predicate_table_insert(in, in, out, out) is det.
- % Return an invalid pred_id. Used to initialize the pred_id
- % in call(...) goals before we do typechecking or when type-checking
- % finds that there was no predicate which matched the call.
-
-:- pred invalid_pred_id(pred_id).
-:- mode invalid_pred_id(out) is det.
-:- mode invalid_pred_id(in) is semidet.
-
:- pred predicate_id(module_info, pred_id, module_name, string, arity).
:- mode predicate_id(in, in, out, out, out) is det.
@@ -1060,7 +1053,7 @@
Pred_N_Index, Pred_NA_Index, Pred_MNA_Index,
Func_N_Index, Func_NA_Index, Func_MNA_Index),
map__init(Preds),
- NextPredId = 0,
+ hlds_pred__initial_pred_id(NextPredId),
PredIds = [],
map__init(Pred_N_Index),
map__init(Pred_NA_Index),
@@ -1345,7 +1338,7 @@
% allocate a new pred_id
PredId = NextPredId0,
- NextPredId is PredId + 1,
+ hlds_pred__next_pred_id(PredId, NextPredId),
% insert the pred_id into either the function or predicate
% indices, as appropriate
@@ -1497,10 +1490,6 @@
Msg),
error(Msg)
).
-
-%-----------------------------------------------------------------------------%
-
-invalid_pred_id(-1).
%-----------------------------------------------------------------------------%
Index: hlds_out.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/hlds_out.m,v
retrieving revision 1.157
diff -u -r1.157 hlds_out.m
--- hlds_out.m 1997/02/23 06:06:36 1.157
+++ hlds_out.m 1997/02/28 04:08:01
@@ -246,7 +246,8 @@
hlds_out__write_pred_proc_id(ModuleInfo, PredId, ProcId) -->
hlds_out__write_pred_id(ModuleInfo, PredId),
io__write_string(" mode "),
- { ModeNum is ProcId mod 10000 },
+ { proc_id_to_int(ProcId, ProcInt) },
+ { ModeNum is ProcInt mod 10000 },
io__write_int(ModeNum).
hlds_out__write_call_id(PredOrFunc, Name/Arity) -->
@@ -402,7 +403,8 @@
% mode for them
{ pred_info_is_pseudo_imported(PredInfo) },
{ pred_info_procids(PredInfo, ProcIds) },
- { ProcIds = [0] }
+ { hlds_pred__initial_proc_id(InitProcId) },
+ { ProcIds = [InitProcId] }
->
[]
;
@@ -432,7 +434,8 @@
{ ClausesInfo = clauses_info(VarSet, _, VarTypes, HeadVars, Clauses) },
hlds_out__write_indent(Indent),
io__write_string("% pred id: "),
- io__write_int(PredId),
+ { pred_id_to_int(PredId, PredInt) },
+ io__write_int(PredInt),
io__write_string(", category: "),
hlds_out__write_pred_or_func(PredOrFunc),
io__write_string(", status: "),
@@ -533,7 +536,9 @@
( { string__contains_char(Verbose, 'm') } ->
hlds_out__write_indent(Indent),
io__write_string("% Modes for which this clause applies: "),
- hlds_out__write_intlist(Modes),
+ { list__map(lambda([Mode :: in, ModeInt :: out] is det,
+ proc_id_to_int(Mode, ModeInt)), Modes, ModeInts) },
+ hlds_out__write_intlist(ModeInts),
io__write_string("\n")
;
[]
@@ -1740,7 +1745,8 @@
hlds_out__write_indent(Indent1),
io__write_string("% mode number "),
- io__write_int(ProcId),
+ { proc_id_to_int(ProcId, ProcInt) },
+ io__write_int(ProcInt),
io__write_string(" of "),
hlds_out__write_pred_id(ModuleInfo, PredId),
io__write_string(" ("),
@@ -1756,7 +1762,10 @@
mercury_output_pred_mode_decl(ModeVarSet, unqualified(PredName),
HeadModes, DeclaredDeterminism, ModeContext),
- ( { ImportStatus = pseudo_imported, ProcId = 0 } ->
+ (
+ { ImportStatus = pseudo_imported },
+ { hlds_pred__initial_proc_id(ProcId) }
+ ->
[]
;
{ proc_info_stack_slots(Proc, StackSlots) },
Index: hlds_pred.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/hlds_pred.m,v
retrieving revision 1.26
diff -u -r1.26 hlds_pred.m
--- hlds_pred.m 1997/02/23 06:06:38 1.26
+++ hlds_pred.m 1997/02/28 02:57:43
@@ -25,12 +25,43 @@
:- interface.
- % A proc_id is a mode number within a particular predicate -
+ % A proc_id is the name of a mode within a particular predicate -
% not to be confused with a mode_id, which is the name of a
% user-defined mode.
-:- type proc_id == int.
-:- type pred_id == int.
+:- type pred_id.
+:- type proc_id.
+
+:- pred hlds_pred__initial_pred_id(pred_id).
+:- mode hlds_pred__initial_pred_id(out) is det.
+
+:- pred hlds_pred__initial_proc_id(proc_id).
+:- mode hlds_pred__initial_proc_id(out) is det.
+
+:- pred hlds_pred__next_pred_id(pred_id, pred_id).
+:- mode hlds_pred__next_pred_id(in, out) is det.
+
+:- pred hlds_pred__next_proc_id(proc_id, proc_id).
+:- mode hlds_pred__next_proc_id(in, out) is det.
+
+:- pred pred_id_to_int(pred_id, int).
+:- mode pred_id_to_int(in, out) is det.
+:- mode pred_id_to_int(out, in) is det.
+
+:- pred proc_id_to_int(proc_id, int).
+:- mode proc_id_to_int(in, out) is det.
+:- mode proc_id_to_int(out, in) is det.
+
+:- pred hlds_pred__in_in_unification_proc_id(proc_id).
+:- mode hlds_pred__in_in_unification_proc_id(out) is det.
+
+ % Return an invalid pred_id. Used to initialize the pred_id
+ % in call(...) goals before we do typechecking or when type-checking
+ % finds that there was no predicate which matched the call.
+
+:- pred invalid_pred_id(pred_id).
+:- mode invalid_pred_id(out) is det.
+:- mode invalid_pred_id(in) is semidet.
:- type pred_info.
:- type proc_info.
@@ -292,6 +323,27 @@
%-----------------------------------------------------------------------------%
:- implementation.
+
+:- type pred_id == int.
+:- type proc_id == int.
+
+hlds_pred__initial_pred_id(0).
+
+hlds_pred__initial_proc_id(0).
+
+hlds_pred__next_pred_id(PredId, NextPredId) :-
+ NextPredId is PredId + 1.
+
+hlds_pred__next_proc_id(ProcId, NextProcId) :-
+ NextProcId is ProcId + 1.
+
+pred_id_to_int(PredId, PredId).
+
+proc_id_to_int(ProcId, ProcId).
+
+hlds_pred__in_in_unification_proc_id(0).
+
+invalid_pred_id(-1).
% The information specific to a predicate, as opposed to a procedure.
% Any changes in this type definition will almost certainly require
Index: inlining.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/inlining.m,v
retrieving revision 1.57
diff -u -r1.57 inlining.m
--- inlining.m 1997/02/23 06:06:40 1.57
+++ inlining.m 1997/02/27 06:26:50
@@ -548,7 +548,10 @@
\+ pred_info_is_imported(PredInfo),
% this next line catches the case of locally defined
% unification predicates for imported types.
- \+ (pred_info_is_pseudo_imported(PredInfo), ProcId = 0),
+ \+ (
+ pred_info_is_pseudo_imported(PredInfo),
+ hlds_pred__in_in_unification_proc_id(ProcId)
+ ),
% OK, we could inline it - but should we? Apply our heuristic.
(
Index: intermod.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/intermod.m,v
retrieving revision 1.17
diff -u -r1.17 intermod.m
--- intermod.m 1997/02/23 06:06:41 1.17
+++ intermod.m 1997/02/27 06:28:04
@@ -832,8 +832,10 @@
% same proc_id in the importing modules.
{ CompareProcId =
lambda([ProcId1::in, ProcId2::in, Result::out] is det, (
- ActualProcId1 is ProcId1 mod 10000,
- ActualProcId2 is ProcId2 mod 10000,
+ 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)
)) },
{ list__sort(CompareProcId, ProcIds, SortedProcIds) },
Index: llds.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/llds.m,v
retrieving revision 1.201
diff -u -r1.201 llds.m
--- llds.m 1997/02/23 06:06:53 1.201
+++ llds.m 1997/02/27 05:52:33
@@ -477,10 +477,10 @@
% from `.opt' files, the defining module's name is added as a
% qualifier to the label.
:- type proc_label
- ---> proc(string, pred_or_func, string, string, int, int)
+ ---> proc(string, pred_or_func, string, string, int, proc_id)
% defining module, predicate/function,
% declaring module, name, arity, mode #
- ; special_proc(string, string, string, string, int, int).
+ ; special_proc(string, string, string, string, int, proc_id).
% defining module, pred name, type module,
% type name, type arity, mode #
Index: llds_out.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/llds_out.m,v
retrieving revision 1.40
diff -u -r1.40 llds_out.m
--- llds_out.m 1997/02/24 05:36:33 1.40
+++ llds_out.m 1997/02/27 06:34:42
@@ -887,8 +887,9 @@
output_instruction(Instr) -->
{ set__init(ContLabelSet) },
- { ProfInfo = local(proc("DEBUG", predicate, "DEBUG", "DEBUG", 0, 0))
- - ContLabelSet },
+ { hlds_pred__initial_proc_id(ProcId) },
+ { ProfInfo = local(proc("DEBUG", predicate, "DEBUG", "DEBUG", 0,
+ ProcId)) - ContLabelSet },
output_instruction(Instr, ProfInfo).
:- pred output_instruction(instr, pair(label, set(label)),
@@ -2140,7 +2141,8 @@
OrigArity = Arity
),
string__int_to_string(OrigArity, ArityString),
- ModeNum is ModeNum0 mod 10000, % strip off the priority
+ proc_id_to_int(ModeNum0, ModeInt),
+ ModeNum is ModeInt mod 10000, % strip off the priority
string__int_to_string(ModeNum, ModeNumString),
string__append_list([LabelName, "_", ArityString, "_", ModeNumString],
ProcLabelString).
@@ -2152,7 +2154,8 @@
DummyArity = -1, % not used by get_label_name.
get_label_name("", predicate, "", PredName, DummyArity, LabelName),
string__int_to_string(TypeArity, TypeArityString),
- ModeNum is ModeNum0 mod 10000, % strip off the priority
+ proc_id_to_int(ModeNum0, ModeInt),
+ ModeNum is ModeInt mod 10000, % strip off the priority
string__int_to_string(ModeNum, ModeNumString),
% Handle locally produced unification preds for imported types.
( Module \= TypeModule ->
Index: make_hlds.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/make_hlds.m,v
retrieving revision 1.222
diff -u -r1.222 make_hlds.m
--- make_hlds.m 1997/02/23 06:07:03 1.222
+++ make_hlds.m 1997/02/28 03:35:13
@@ -1095,7 +1095,7 @@
% construct the pseudo-recursive call to Module:Name(HeadVars)
%
SymName = qualified(Module, Name),
- ModeId = 0, % mode checking will figure it out
+ hlds_pred__initial_proc_id(ModeId), % mode checking will figure it out
MaybeUnifyContext = no,
Call = call(PredId, ModeId, HeadVars, inline_builtin, MaybeUnifyContext,
SymName),
@@ -1383,7 +1383,8 @@
;
true
),
- ModeId is ModeId0 + Priority.
+ ModeInt is ModeId0 + Priority,
+ 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
@@ -2468,7 +2469,7 @@
;
% initialize some fields to junk
invalid_pred_id(PredId),
- ModeId = 0,
+ hlds_pred__initial_proc_id(ModeId),
MaybeUnifyContext = no,
Call = call(PredId, ModeId, HeadVars, not_builtin,
MaybeUnifyContext, Name)
Index: mercury_to_c.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/mercury_to_c.m,v
retrieving revision 1.22
diff -u -r1.22 mercury_to_c.m
--- mercury_to_c.m 1997/02/23 06:07:08 1.22
+++ mercury_to_c.m 1997/02/27 06:18:46
@@ -396,7 +396,8 @@
io__write_string("_"),
io__write_int(Arity),
io__write_string("_"),
- { ModeNum is ProcId mod 10000 }, % strip off the priority
+ { proc_id_to_int(ProcId, ProcInt) },
+ { ModeNum is ProcInt mod 10000 }, % strip off the priority
io__write_int(ModeNum).
:- pred c_gen_select_output_vars(module_info, list(var), list(mode), list(var)).
Index: mercury_to_mercury.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/mercury_to_mercury.m,v
retrieving revision 1.94
diff -u -r1.94 mercury_to_mercury.m
--- mercury_to_mercury.m 1997/02/17 01:26:44 1.94
+++ mercury_to_mercury.m 1997/02/27 06:20:05
@@ -299,7 +299,8 @@
io__write_string(", "),
io__write_int(Arity),
io__write_string(", "),
- io__write_int(ProcId),
+ { proc_id_to_int(ProcId, ProcInt) },
+ io__write_int(ProcInt),
io__write_string(", ["),
mercury_output_int_list(UnusedArgs),
io__write_string("]).\n").
Index: modecheck_call.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/modecheck_call.m,v
retrieving revision 1.7
diff -u -r1.7 modecheck_call.m
--- modecheck_call.m 1997/02/23 06:07:25 1.7
+++ modecheck_call.m 1997/02/28 03:36:36
@@ -149,7 +149,7 @@
set__init(WaitingVars),
mode_info_error(WaitingVars, mode_error_no_mode_decl,
ModeInfo0, ModeInfo),
- TheProcId = 0,
+ hlds_pred__initial_proc_id(TheProcId),
ArgVars = ArgVars0,
ExtraGoals = [] - []
;
@@ -237,7 +237,7 @@
instmap__init_unreachable(Instmap),
mode_info_set_instmap(Instmap, ModeInfo1, ModeInfo)
;
- TheProcId = 0, % dummy value
+ hlds_pred__initial_proc_id(TheProcId), % dummy value
mode_info_get_instmap(ModeInfo0, InstMap),
instmap__lookup_vars(ArgVars, InstMap, ArgInsts),
mode_info_set_call_arg_context(0, ModeInfo0, ModeInfo1),
Index: modecheck_unify.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/modecheck_unify.m,v
retrieving revision 1.10
diff -u -r1.10 modecheck_unify.m
--- modecheck_unify.m 1997/02/23 06:07:27 1.10
+++ modecheck_unify.m 1997/02/28 03:37:30
@@ -187,7 +187,7 @@
% replace `X = f(A, B, C)'
% with `f(A, B, C, X)'
%
- ProcId = 0,
+ hlds_pred__initial_proc_id(ProcId),
list__append(ArgVars0, [X0], ArgVars),
FuncCallUnifyContext = call_unify_context(X0,
functor(ConsId, ArgVars0), UnifyContext),
Index: opt_debug.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/opt_debug.m,v
retrieving revision 1.66
diff -u -r1.66 opt_debug.m
--- opt_debug.m 1997/02/23 01:13:09 1.66
+++ opt_debug.m 1997/02/28 03:47:39
@@ -185,7 +185,7 @@
:- implementation.
-:- import_module llds_out, opt_util, vn_util.
+:- import_module llds_out, opt_util, vn_util, hlds_pred.
:- import_module int, set, map, string.
opt_debug__msg(OptDebug, Msg) -->
@@ -758,8 +758,9 @@
string__append_list([" ", L1_str, "-", L2_str, L_str], Str).
opt_debug__dump_proclabel(proc(Module, _PredOrFunc, PredModule,
- PredName, Arity, Mode), Str) :-
+ PredName, Arity, ProcId), Str) :-
string__int_to_string(Arity, A_str),
+ proc_id_to_int(ProcId, Mode),
string__int_to_string(Mode, M_str),
( Module = PredModule ->
ExtraModule = ""
@@ -769,8 +770,9 @@
string__append_list([ExtraModule, Module, "_", PredName,
"_", A_str, "_", M_str], Str).
opt_debug__dump_proclabel(special_proc(Module, Pred, TypeModule,
- Type, Arity, Mode), Str) :-
+ Type, Arity, ProcId), Str) :-
string__int_to_string(Arity, A_str),
+ proc_id_to_int(ProcId, Mode),
string__int_to_string(Mode, M_str),
llds_out__maybe_qualify_name(TypeModule, Type, TypeName),
string__append_list([Module, "_", Pred, "_",
Index: opt_util.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/opt_util.m,v
retrieving revision 1.79
diff -u -r1.79 opt_util.m
--- opt_util.m 1997/01/29 00:48:02 1.79
+++ opt_util.m 1997/02/28 05:10:14
@@ -309,7 +309,7 @@
:- implementation.
-:- import_module exprn_aux, llds_out.
+:- import_module exprn_aux, llds_out, hlds_pred.
:- import_module int, string, set, map, require.
opt_util__get_prologue(Instrs0, ProcLabel, LabelInstr, Comments, Instrs) :-
@@ -1252,14 +1252,16 @@
:- pred opt_util__format_proclabel(proc_label, string).
:- mode opt_util__format_proclabel(in, out) is det.
-opt_util__format_proclabel(proc(_Module, _PredOrFunc, _, Name, Arity, Mode),
+opt_util__format_proclabel(proc(_Module, _PredOrFunc, _, Name, Arity, ProcId),
Str) :-
string__int_to_string(Arity, ArityStr),
+ proc_id_to_int(ProcId, Mode),
string__int_to_string(Mode, ModeStr),
string__append_list([Name, "/", ArityStr, " mode ", ModeStr], Str).
-opt_util__format_proclabel(special_proc(_Module, Pred, _, Type, Arity, Mode),
+opt_util__format_proclabel(special_proc(_Module, Pred, _, Type, Arity, ProcId),
Str) :-
string__int_to_string(Arity, ArityStr),
+ proc_id_to_int(ProcId, Mode),
string__int_to_string(Mode, ModeStr),
string__append_list(
[Pred, "_", Type, "/", ArityStr, " mode ", ModeStr], Str).
Index: polymorphism.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/polymorphism.m,v
retrieving revision 1.98
diff -u -r1.98 polymorphism.m
--- polymorphism.m 1997/02/23 06:07:37 1.98
+++ polymorphism.m 1997/02/28 03:44:00
@@ -471,7 +471,7 @@
% and report an error (e.g. "unification of
% polymorphically typed variables in partially
% instantiated mode") if it isn't
- { ProcId = 0 },
+ { hlds_pred__in_in_unification_proc_id(ProcId) },
{ map__lookup(TypeInfoMap, TypeVar, TypeInfoVar) },
{ SymName = unqualified("unify") },
{ ArgVars = [TypeInfoVar, XVar, YVar] },
@@ -496,7 +496,7 @@
;
error("can't locate mercury_builtin:builtin_unify_pred/2")
},
- { ProcId = 0 },
+ { hlds_pred__in_in_unification_proc_id(ProcId) },
{ CallContext = call_unify_context(XVar, Y, Context) },
{ Call = call(PredId, ProcId, ArgVars, not_builtin,
yes(CallContext), SymName) },
@@ -1135,7 +1135,8 @@
PredId),
PredName = unqualified(Name)
),
- special_pred_mode_num(SpecialPredId, ProcId).
+ special_pred_mode_num(SpecialPredId, ProcInt),
+ proc_id_to_int(ProcId, ProcInt).
:- pred polymorphism__get_category_name(builtin_type, string).
:- mode polymorphism__get_category_name(in, out) is det.
Index: prog_io_pragma.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/prog_io_pragma.m,v
retrieving revision 1.3
diff -u -r1.3 prog_io_pragma.m
--- prog_io_pragma.m 1997/02/02 12:56:43 1.3
+++ prog_io_pragma.m 1997/02/28 03:45:19
@@ -247,9 +247,10 @@
PredOrFuncTerm,
PredNameTerm,
term__functor(term__integer(Arity), [], _),
- term__functor(term__integer(ProcId), [], _),
+ term__functor(term__integer(ProcInt), [], _),
UnusedArgsTerm
],
+ proc_id_to_int(ProcId, ProcInt),
(
PredOrFuncTerm = term__functor(
term__atom("predicate"), [], _),
Index: shapes.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/shapes.m,v
retrieving revision 1.39
diff -u -r1.39 shapes.m
--- shapes.m 1997/01/29 00:48:13 1.39
+++ shapes.m 1997/02/28 03:58:09
@@ -88,7 +88,7 @@
:- implementation.
-:- import_module code_util, hlds_data, llds, prog_data, type_util.
+:- import_module code_util, hlds_pred, hlds_data, llds, prog_data, type_util.
:- import_module int, assoc_list, map, std_util, require.
:- type bit_number ---> bit_zero; bit_one; bit_two; bit_three.
@@ -212,7 +212,8 @@
shapes__create_special_preds([L | Ls], ModuleInfo, SpecialPredShapes) :-
shapes__create_special_preds(Ls, ModuleInfo, SpecialPredShapes0),
L = TypeId - MaybeShapeNum,
- code_util__make_uni_label(ModuleInfo, TypeId, 1, UniLabel),
+ proc_id_to_int(ProcId, 1),
+ code_util__make_uni_label(ModuleInfo, TypeId, ProcId, UniLabel),
Label = local(UniLabel),
(
MaybeShapeNum = yes(ShapeNum)
Index: unify_proc.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/unify_proc.m,v
retrieving revision 1.53
diff -u -r1.53 unify_proc.m
--- unify_proc.m 1997/02/23 06:08:29 1.53
+++ unify_proc.m 1997/02/28 03:52:42
@@ -174,15 +174,15 @@
inst_is_ground(ModuleInfo, XInitial),
inst_is_ground(ModuleInfo, YInitial)
->
- ProcId = 0
+ hlds_pred__in_in_unification_proc_id(ProcId)
;
XInitial = not_reached
->
- ProcId = 0
+ proc_id_to_int(ProcId, 0)
;
YInitial = not_reached
->
- ProcId = 0
+ proc_id_to_int(ProcId, 0)
;
module_info_get_unify_requests(ModuleInfo, Requests),
unify_proc__get_req_map(Requests, ReqMap),
@@ -1270,7 +1270,7 @@
ErrorMessage),
error(ErrorMessage)
},
- { ModeId = 0 },
+ { hlds_pred__initial_proc_id(ModeId) },
% We cheat by not providing a context for the call.
% Since automatically generated procedures should not have errors,
% the absence of a context should not be a problem.
Index: unused_args.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/unused_args.m,v
retrieving revision 1.26
diff -u -r1.26 unused_args.m
--- unused_args.m 1997/02/23 06:08:34 1.26
+++ unused_args.m 1997/02/28 03:53:49
@@ -234,7 +234,7 @@
PredProcs1 = PredProcs0
;
pred_info_is_pseudo_imported(PredInfo),
- ProcId = 0
+ hlds_pred__initial_proc_id(ProcId)
->
PredProcs1 = PredProcs0,
OptProcs1 = OptProcs0,
@@ -847,7 +847,8 @@
pred_info_module(PredInfo0, PredModule),
pred_info_name(PredInfo0, Name0),
pred_info_get_is_pred_or_func(PredInfo0, PredOrFunc),
- string__int_to_string(ProcId, Id),
+ proc_id_to_int(ProcId, ProcInt),
+ string__int_to_string(ProcInt, Id),
pred_info_arg_types(PredInfo0, Tvars, ArgTypes0),
% create a unique new pred name using the old proc_id
(
@@ -1031,11 +1032,12 @@
io__write_string("% Fixing up `"),
{ predicate_name(ModuleInfo0, PredId, Name) },
{ predicate_arity(ModuleInfo0, PredId, Arity) },
+ { proc_id_to_int(ProcId, ProcInt) },
io__write_string(Name),
io__write_string("/"),
io__write_int(Arity),
io__write_string("' in mode "),
- io__write_int(ProcId),
+ io__write_int(ProcInt),
io__write_char('\n')
;
[]
More information about the developers
mailing list