[m-rev.] Handle polymorphic inequality goals
Simon Taylor
stayl at cs.mu.OZ.AU
Thu Oct 24 18:46:30 AEST 2002
On 24-Oct-2002, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> Hmm. Is the compiler really still capable of generating efficient code
> for `X < 42'?
>
> It would need to do a quite complicated set of transformations:
>
> X =< Y
>
> ==> (via your change to simplification)
>
> some [R] (compare(R, X, Y), R \= (>))
>
> ==> (via specialization)
>
> some [R] (
> builtin_compare_int(R, X, Y),
> R \= (>))
> )
>
> ==> (via inlining)
>
> some [R] (
> ( X < Y ->
> R = (<)
> ; X = Y ->
> R = (=)
> ;
> R = (>)
> ),
> \+ (R = (>))
> )
>
> ==> (how???)
>
> \+ builtin_int_gt(X, Y)
==> (via local constraint propagation)
some [R] (
( X < Y ->
R = (<),
\+ (R = (>))
; X = Y ->
R = (=),
\+ (R = (>))
;
R = (>),
\+ (R = (>))
)
)
==> (via simplification, this currently doesn't work because
mode_util__recompute_instmap_delta_unify doesn't do a very good job,
but it should be simple to fix it to handle this case)
some [R] (
( X < Y ->
true
; X = Y ->
true
;
fail
)
)
I think this is as far as the Mercury compiler will get.
Unfortunately, gcc doesn't seem to be able to optimize this further.
Simon.
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list