[m-dev.] trivial diff: delete unused ml_translate_builtin

Fergus Henderson fjh at cs.mu.OZ.AU
Fri May 5 15:29:40 AEST 2000


Estimated hours taken: 0.1

compiler/ml_call_gen.m:
	Delete (for the second time) some unused code that trd seems
	to have accidentally re-added, probably due to a mistake when
	merging my changes with his.

Workspace: /home/pgrad/fjh/ws/hg
Index: compiler/ml_call_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_call_gen.m,v
retrieving revision 1.6
diff -u -d -r1.6 ml_call_gen.m
--- compiler/ml_call_gen.m	2000/05/01 18:43:41	1.6
+++ compiler/ml_call_gen.m	2000/05/05 05:27:02
@@ -618,216 +618,6 @@
 	{ MLDS_Statements = [MLDS_Statement] },
 	{ MLDS_Decls = [] }.
 
-	% Given a module name, a predicate name, a proc_id and a list of
-	% the lvals for the arguments, find out if that procedure of that
-	% predicate is an inline builtin. If yes, the last two arguments
-	% return two things:
-	%
-	% - an rval to execute as a test if the builtin is semidet; or
-	%
-	% - an rval to assign to an lval if the builtin is det.
-	%
-	% Exactly one of these will be present.
-	%
-	% XXX this is not great interface design -
-	% better to return a discriminated union than
-	% returning two maybes.  But I kept it this way so that
-	% the code stays similar to code_util__translate_builtin.
-
-:- pred ml_translate_builtin(module_name, string, proc_id, list(mlds__lval),
-		maybe(mlds__rval), maybe(pair(mlds__lval, mlds__rval))).
-:- mode ml_translate_builtin(in, in, in, in, out, out) is semidet.
-
-ml_translate_builtin(FullyQualifiedModule, PredName, ProcId, Args,
-		TestOp, AssignmentOp) :-
-	proc_id_to_int(ProcId, ProcInt),
-	% -- not yet:
-	% FullyQualifiedModule = qualified(unqualified("std"), ModuleName),
-	FullyQualifiedModule = unqualified(ModuleName),
-	ml_translate_builtin_2(ModuleName, PredName, ProcInt, Args,
-		TestOp, AssignmentOp).
-
-:- pred ml_translate_builtin_2(string, string, int, list(mlds__lval),
-	maybe(mlds__rval), maybe(pair(mlds__lval, mlds__rval))).
-:- mode ml_translate_builtin_2(in, in, in, in, out, out) is semidet.
-
-% WARNING: any changes here may need to be duplicated in
-% code_util__translate_builtin_2 and vice versa.
-
-ml_translate_builtin_2("private_builtin", "unsafe_type_cast", 0,
-		[X, Y], no, yes(Y - lval(X))).
-ml_translate_builtin_2("builtin", "unsafe_promise_unique", 0,
-		[X, Y], no, yes(Y - lval(X))).
-
-ml_translate_builtin_2("private_builtin", "builtin_int_gt", 0, [X, Y],
-	yes(binop((>), lval(X), lval(Y))), no).
-ml_translate_builtin_2("private_builtin", "builtin_int_lt", 0, [X, Y],
-	yes(binop((<), lval(X), lval(Y))), no).
-
-ml_translate_builtin_2("int", "builtin_plus", 0, [X, Y, Z],
-	no, yes(Z - binop((+), lval(X), lval(Y)))).
-ml_translate_builtin_2("int", "builtin_plus", 1, [X, Y, Z],
-	no, yes(X - binop((-), lval(Z), lval(Y)))).
-ml_translate_builtin_2("int", "builtin_plus", 2, [X, Y, Z],
-	no, yes(Y - binop((-), lval(Z), lval(X)))).
-ml_translate_builtin_2("int", "+", 0, [X, Y, Z],
-	no, yes(Z - binop((+), lval(X), lval(Y)))).
-ml_translate_builtin_2("int", "+", 1, [X, Y, Z],
-	no, yes(X - binop((-), lval(Z), lval(Y)))).
-ml_translate_builtin_2("int", "+", 2, [X, Y, Z],
-	no, yes(Y - binop((-), lval(Z), lval(X)))).
-ml_translate_builtin_2("int", "builtin_minus", 0, [X, Y, Z],
-	no, yes(Z - binop((-), lval(X), lval(Y)))).
-ml_translate_builtin_2("int", "builtin_minus", 1, [X, Y, Z],
-	no, yes(X - binop((+), lval(Y), lval(Z)))).
-ml_translate_builtin_2("int", "builtin_minus", 2, [X, Y, Z],
-	no, yes(Y - binop((-), lval(X), lval(Z)))).
-ml_translate_builtin_2("int", "-", 0, [X, Y, Z],
-	no, yes(Z - binop((-), lval(X), lval(Y)))).
-ml_translate_builtin_2("int", "-", 1, [X, Y, Z],
-	no, yes(X - binop((+), lval(Y), lval(Z)))).
-ml_translate_builtin_2("int", "-", 2, [X, Y, Z],
-	no, yes(Y - binop((-), lval(X), lval(Z)))).
-ml_translate_builtin_2("int", "builtin_times", 0, [X, Y, Z],
-	no, yes(Z - binop((*), lval(X), lval(Y)))).
-ml_translate_builtin_2("int", "builtin_times", 1, [X, Y, Z],
-	no, yes(X - binop((/), lval(Z), lval(Y)))).
-ml_translate_builtin_2("int", "builtin_times", 2, [X, Y, Z],
-	no, yes(Y - binop((/), lval(Z), lval(X)))).
-ml_translate_builtin_2("int", "*", 0, [X, Y, Z],
-	no, yes(Z - binop((*), lval(X), lval(Y)))).
-ml_translate_builtin_2("int", "*", 1, [X, Y, Z],
-	no, yes(X - binop((/), lval(Z), lval(Y)))).
-ml_translate_builtin_2("int", "*", 2, [X, Y, Z],
-	no, yes(Y - binop((/), lval(Z), lval(X)))).
-ml_translate_builtin_2("int", "builtin_div", 0, [X, Y, Z],
-	no, yes(Z - binop((/), lval(X), lval(Y)))).
-ml_translate_builtin_2("int", "builtin_div", 1, [X, Y, Z],
-	no, yes(X - binop((*), lval(Y), lval(Z)))).
-ml_translate_builtin_2("int", "builtin_div", 2, [X, Y, Z],
-	no, yes(Y - binop((/), lval(X), lval(Z)))).
-ml_translate_builtin_2("int", "//", 0, [X, Y, Z],
-	no, yes(Z - binop((/), lval(X), lval(Y)))).
-ml_translate_builtin_2("int", "//", 1, [X, Y, Z],
-	no, yes(X - binop((*), lval(Y), lval(Z)))).
-ml_translate_builtin_2("int", "//", 2, [X, Y, Z],
-	no, yes(Y - binop((/), lval(X), lval(Z)))).
-ml_translate_builtin_2("int", "builtin_mod", 0, [X, Y, Z],
-	no, yes(Z - binop((mod), lval(X), lval(Y)))).
-ml_translate_builtin_2("int", "rem", 0, [X, Y, Z],
-	no, yes(Z - binop((mod), lval(X), lval(Y)))).
-ml_translate_builtin_2("int", "builtin_left_shift", 0, [X, Y, Z],
-	no, yes(Z - binop((<<), lval(X), lval(Y)))).
-ml_translate_builtin_2("int", "unchecked_left_shift", 0, [X, Y, Z],
-	no, yes(Z - binop((<<), lval(X), lval(Y)))).
-ml_translate_builtin_2("int", "builtin_right_shift", 0, [X, Y, Z],
-	no, yes(Z - binop((>>), lval(X), lval(Y)))).
-ml_translate_builtin_2("int", "unchecked_right_shift", 0, [X, Y, Z],
-	no, yes(Z - binop((>>), lval(X), lval(Y)))).
-ml_translate_builtin_2("int", "builtin_bit_and", 0, [X, Y, Z],
-	no, yes(Z - binop((&), lval(X), lval(Y)))).
-ml_translate_builtin_2("int", "/\\", 0, [X, Y, Z],
-	no, yes(Z - binop((&), lval(X), lval(Y)))).
-ml_translate_builtin_2("int", "builtin_bit_or", 0, [X, Y, Z],
-	no, yes(Z - binop(('|'), lval(X), lval(Y)))).
-ml_translate_builtin_2("int", "\\/", 0, [X, Y, Z],
-	no, yes(Z - binop(('|'), lval(X), lval(Y)))).
-ml_translate_builtin_2("int", "builtin_bit_xor", 0, [X, Y, Z],
-	no, yes(Z - binop((^), lval(X), lval(Y)))).
-ml_translate_builtin_2("int", "^", 0, [X, Y, Z],
-	no, yes(Z - binop((^), lval(X), lval(Y)))).
-ml_translate_builtin_2("int", "xor", 0, [X, Y, Z],
-	no, yes(Z - binop((^), lval(X), lval(Y)))).
-ml_translate_builtin_2("int", "builtin_unary_plus", 0, [X, Y],
-	no, yes(Y - lval(X))).
-ml_translate_builtin_2("int", "+", 0, [X, Y],
-	no, yes(Y - lval(X))).
-ml_translate_builtin_2("int", "builtin_unary_minus", 0, [X, Y],
-	no, yes(Y - binop((-), const(int_const(0)), lval(X)))).
-ml_translate_builtin_2("int", "-", 0, [X, Y],
-	no, yes(Y - binop((-), const(int_const(0)), lval(X)))).
-ml_translate_builtin_2("int", "builtin_bit_neg", 0, [X, Y],
-	no, yes(Y - unop(std_unop(bitwise_complement), lval(X)))).
-ml_translate_builtin_2("int", "\\", 0, [X, Y],
-	no, yes(Y - unop(std_unop(bitwise_complement), lval(X)))).
-ml_translate_builtin_2("int", ">", 0, [X, Y],
-	yes(binop((>), lval(X), lval(Y))), no).
-ml_translate_builtin_2("int", "<", 0, [X, Y],
-	yes(binop((<), lval(X), lval(Y))), no).
-ml_translate_builtin_2("int", ">=", 0, [X, Y],
-	yes(binop((>=), lval(X), lval(Y))), no).
-ml_translate_builtin_2("int", "=<", 0, [X, Y],
-	yes(binop((<=), lval(X), lval(Y))), no).
-
-ml_translate_builtin_2("float", "builtin_float_plus", 0, [X, Y, Z],
-	no, yes(Z - binop(float_plus, lval(X), lval(Y)))).
-ml_translate_builtin_2("float", "builtin_float_plus", 1, [X, Y, Z],
-	no, yes(X - binop(float_minus, lval(Z), lval(Y)))).
-ml_translate_builtin_2("float", "builtin_float_plus", 2, [X, Y, Z],
-	no, yes(Y - binop(float_minus, lval(Z), lval(X)))).
-ml_translate_builtin_2("float", "+", 0, [X, Y, Z],
-	no, yes(Z - binop(float_plus, lval(X), lval(Y)))).
-ml_translate_builtin_2("float", "+", 1, [X, Y, Z],
-	no, yes(X - binop(float_minus, lval(Z), lval(Y)))).
-ml_translate_builtin_2("float", "+", 2, [X, Y, Z],
-	no, yes(Y - binop(float_minus, lval(Z), lval(X)))).
-ml_translate_builtin_2("float", "builtin_float_minus", 0, [X, Y, Z],
-	no, yes(Z - binop(float_minus, lval(X), lval(Y)))).
-ml_translate_builtin_2("float", "builtin_float_minus", 1, [X, Y, Z],
-	no, yes(X - binop(float_plus, lval(Y), lval(Z)))).
-ml_translate_builtin_2("float", "builtin_float_minus", 2, [X, Y, Z],
-	no, yes(Y - binop(float_minus, lval(X), lval(Z)))).
-ml_translate_builtin_2("float", "-", 0, [X, Y, Z],
-	no, yes(Z - binop(float_minus, lval(X), lval(Y)))).
-ml_translate_builtin_2("float", "-", 1, [X, Y, Z],
-	no, yes(X - binop(float_plus, lval(Y), lval(Z)))).
-ml_translate_builtin_2("float", "-", 2, [X, Y, Z],
-	no, yes(Y - binop(float_minus, lval(X), lval(Z)))).
-ml_translate_builtin_2("float", "builtin_float_times", 0, [X, Y, Z],
-	no, yes(Z - binop(float_times, lval(X), lval(Y)))).
-ml_translate_builtin_2("float", "builtin_float_times", 1, [X, Y, Z],
-	no, yes(X - binop(float_divide, lval(Z), lval(Y)))).
-ml_translate_builtin_2("float", "builtin_float_times", 2, [X, Y, Z],
-	no, yes(Y - binop(float_divide, lval(Z), lval(X)))).
-ml_translate_builtin_2("float", "*", 0, [X, Y, Z],
-	no, yes(Z - binop(float_times, lval(X), lval(Y)))).
-ml_translate_builtin_2("float", "*", 1, [X, Y, Z],
-	no, yes(X - binop(float_divide, lval(Z), lval(Y)))).
-ml_translate_builtin_2("float", "*", 2, [X, Y, Z],
-	no, yes(Y - binop(float_divide, lval(Z), lval(X)))).
-ml_translate_builtin_2("float", "builtin_float_divide", 0, [X, Y, Z],
-	no, yes(Z - binop(float_divide, lval(X), lval(Y)))).
-ml_translate_builtin_2("float", "builtin_float_divide", 1, [X, Y, Z],
-	no, yes(X - binop(float_times, lval(Y), lval(Z)))).
-ml_translate_builtin_2("float", "builtin_float_divide", 2, [X, Y, Z],
-	no, yes(Y - binop(float_divide, lval(X), lval(Z)))).
-ml_translate_builtin_2("float", "/", 0, [X, Y, Z],
-	no, yes(Z - binop(float_divide, lval(X), lval(Y)))).
-ml_translate_builtin_2("float", "/", 1, [X, Y, Z],
-	no, yes(X - binop(float_times, lval(Y), lval(Z)))).
-ml_translate_builtin_2("float", "/", 2, [X, Y, Z],
-	no, yes(Y - binop(float_divide, lval(X), lval(Z)))).
-ml_translate_builtin_2("float", "+", 0, [X, Y],
-	no, yes(Y - lval(X))).
-ml_translate_builtin_2("float", "-", 0, [X, Y],
-	no, yes(Y - binop(float_minus, const(float_const(0.0)), lval(X)))).
-ml_translate_builtin_2("float", "builtin_float_gt", 0, [X, Y],
-	yes(binop(float_gt, lval(X), lval(Y))), no).
-ml_translate_builtin_2("float", ">", 0, [X, Y],
-	yes(binop(float_gt, lval(X), lval(Y))), no).
-ml_translate_builtin_2("float", "builtin_float_lt", 0, [X, Y],
-	yes(binop(float_lt, lval(X), lval(Y))), no).
-ml_translate_builtin_2("float", "<", 0, [X, Y],
-	yes(binop(float_lt, lval(X), lval(Y))), no).
-ml_translate_builtin_2("float", "builtin_float_ge", 0, [X, Y],
-	yes(binop(float_ge, lval(X), lval(Y))), no).
-ml_translate_builtin_2("float", ">=", 0, [X, Y],
-	yes(binop(float_ge, lval(X), lval(Y))), no).
-ml_translate_builtin_2("float", "builtin_float_le", 0, [X, Y],
-	yes(binop(float_le, lval(X), lval(Y))), no).
-ml_translate_builtin_2("float", "=<", 0, [X, Y],
-	yes(binop(float_le, lval(X), lval(Y))), no).
-
 :- func ml_gen_simple_expr(simple_expr(mlds__lval)) = mlds__rval.
 ml_gen_simple_expr(leaf(Lval)) = lval(Lval).
 ml_gen_simple_expr(int_const(Int)) = const(int_const(Int)).

-- 
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