[m-dev.] for review: add reverse modes of int__xor

Zoltan Somogyi zs at cs.mu.OZ.AU
Thu Mar 9 14:51:39 AEDT 2000


On 09-Mar-2000, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> --- compiler/code_util.m	2000/01/16 04:34:35	1.116
> +++ compiler/code_util.m	2000/03/08 16:27:04
> @@ -485,6 +485,10 @@
>  	no, yes(Z - binop((^), var(X), var(Y)))).
>  code_util__translate_builtin_2("int", "xor", 0, [X, Y, Z],
>  	no, yes(Z - binop((^), var(X), var(Y)))).
> +code_util__translate_builtin_2("int", "xor", 1, [X, Y, Z],
> +	no, yes(Y - binop((^), var(X), var(Z)))).
> +code_util__translate_builtin_2("int", "xor", 2, [X, Y, Z],
> +	no, yes(X - binop((^), var(Y), var(Z)))).
>  code_util__translate_builtin_2("int", "builtin_unary_plus", 0, [X, Y],
>  	no, yes(Y - var(X))).
>  code_util__translate_builtin_2("int", "+", 0, [X, Y],
> --- compiler/ml_call_gen.m	1999/12/29 08:09:10	1.1
> +++ compiler/ml_call_gen.m	2000/03/08 16:28:02
> @@ -722,6 +722,10 @@
>  	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", "xor", 1, [X, Y, Z],
> +	no, yes(Y - binop((^), lval(X), lval(Z)))).
> +ml_translate_builtin_2("int", "xor", 2, [X, Y, Z],
> +	no, yes(X - binop((^), lval(Y), lval(Z)))).
>  ml_translate_builtin_2("int", "builtin_unary_plus", 0, [X, Y],
>  	no, yes(Y - lval(X))).
>  ml_translate_builtin_2("int", "+", 0, [X, Y],

There seems to be a lot of code duplication here, with only minor LLDS/MLDS
differences. You should factor out the common code.

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