[m-dev.] for review: add types to MLDS statements

Fergus Henderson fjh at cs.mu.OZ.AU
Sat Feb 26 00:43:28 AEDT 2000


On 23-Feb-2000, Tyson Dowd <trd at cs.mu.OZ.AU> wrote:
> +++ compiler/ml_code_gen.m	2000/02/17 07:07:59
> -:- func ml_gen_local_var_decl(prog_varset, map(prog_var, prog_type),
> -		mlds__context, prog_var) = mlds__defn.
> -ml_gen_local_var_decl(VarSet, VarTypes, Context, Var) = MLDS_Defn :-
> +:- pred ml_gen_local_var_decl(prog_varset, map(prog_var, prog_type),
> +		mlds__context, prog_var, mlds__defn).
> +:- mode ml_gen_local_var_decl(in, in, in, in, out) is semidet.
> +ml_gen_local_var_decl(VarSet, VarTypes, Context, Var, MLDS_Defn) :-
>  	map__lookup(VarTypes, Var, Type),
> +	not type_util__is_dummy_argument_type(Type),
>  	VarName = ml_gen_var_name(VarSet, Var),
>  	MLDS_Defn = ml_gen_var_decl(VarName, Type, Context).

That change is not mentioned in the log message.

> Index: compiler/ml_unify_gen.m
> @@ -946,7 +949,10 @@
>  	% Generate lvals for the LHS and the RHS
>  	%
>  	{ FieldId = offset(const(int_const(ArgNum))) },
> -	{ FieldLval = field(yes(PrimaryTag), lval(VarLval), FieldId) },
> +	{ MLDS_ArgType = mercury_type_to_mlds_type(ArgType) },
> +		% XXX these types might not be right
> +	{ FieldLval = field(yes(PrimaryTag), lval(VarLval), FieldId,
> +		MLDS_ArgType, mlds__generic_type) },
>  	ml_gen_var(Arg, ArgLval),

The type `mlds__generic_type' there is wrong.
I think you need to pass down the type from
ml_gen_det_deconstruct, though ml_gen_unify_args
and ml_gen_unify_args_2, to here.

>  	% Now generate code to unify them
> @@ -1128,8 +1134,10 @@
>  	binop(and,
>  		binop(eq,	unop(std_unop(tag), Rval),
>  				unop(std_unop(mktag), const(int_const(Bits)))), 
> +				% XXX these types might not be right
>  		binop(eq,	lval(field(yes(Bits), Rval,
> -					offset(const(int_const(0))))),
> +					offset(const(int_const(0))),
> +					mlds__int_type, mlds__generic_type)),

The type `mlds__generic_type' there is wrong.
I think you need to pass down the type from
ml_gen_tag_test.

Apart from that, this change looks fine.
But I'd like to see a diff or relative diff
for the change to make `cast' an mlds__unary_op
rather than an mlds__stmt.

Cheers,
	Fergus.

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