[m-dev.] for review: rewrite of duplicate elimination.

Fergus Henderson fjh at cs.mu.oz.au
Mon Dec 22 16:01:06 AEDT 1997


On 22-Dec-1997, Zoltan Somogyi <zs at cs.mu.oz.au> wrote:
> 
> Give duplicate code elimination more teeth in dealing with similar arguments
> of difference function symbols.

One test case for this that is worth looking at is rbtree.m.
If this optimization does affect rbtree.m, it might even be worth
rerunning the comparison between rbtree.m and tree234.m.

> -	% Build up three tables mapping labels to instruction sequences.
> -	% A label has an entry in a table if it is followed by a deterministic,
> -	% semideterministic or nondeterministic proceed/succeed; the map target
> -	% gives the code sequence between the label and the proceed/succeed.
> -	% We also build up a map giving the livevals instruction at the label
> -	% if any, and the first real instruction at the label.
> -
> -:- pred jumpopt__build_maps(list(instruction), bool, bool, instrmap, instrmap,
> -	tailmap, tailmap, lvalmap, lvalmap,
> +:- pred jumpopt__build_maps(list(instruction), bool, bool,
> +	instrmap, instrmap, tailmap, tailmap, lvalmap, lvalmap,

Hmm, that comment disappeared and I didn't see anything to replace it.
Was there a reason for that?

> % dupelim.m - eliminate some duplicate code sequences.
...
> :- pred standardize_instr(instr::in, instr::out) is det.
> 
> standardize_instr(Instr1, Instr) :-
> 	(
> 		Instr1 = comment(_),
> 		Instr = Instr1
> 	;
> 		Instr1 = livevals(_),
> 		Instr = Instr1
> 	;
...

This predicate will need to be changed whenever anyone adds a new
instruction, so could you please document it.  The documentation should
be immediately preceding the definition of the predicate and should
explain things in terms that someone who doesn't know anything about
dupelim can understand.

> :- pred standardize_lval(lval::in, lval::out) is det.
...
> :- pred standardize_rval(rval::in, rval::out) is det.
...
> :- pred most_specific_instr(instr::in, instr::in, instr::out) is semidet.
...
> :- pred most_specific_lval(lval::in, lval::in, lval::out) is semidet.
...
> :- pred most_specific_rval(rval::in, rval::in, rval::out) is semidet.

Similarly for these.

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