[MLton-user] more optimization questions

Stephen Weeks MLton-user@mlton.org
Sun, 20 Nov 2005 16:07:32 -0800


> > Where in the compiler would the SLICMP live ?
> 
> In either the SSA optimization passes or the SSA2 optimization passes. 
> I'd vote for SSA, since it is a slightly simpler intermediate language, 
> though there has been some argument for migrating all the optimizations 
> from SSA to SSA2 and then eliminating SSA.

I don't think there is a significant difference in complexity between
SSA and SSA2.  Furthermore, there are some flaws in SSA that prevent
certain optimizations from being expressed, while the converse is not
true.  Of particular relevance to SLICMP is the fact that in SSA,
selects from variants are not explicit, while in SSA2 they are.  I
also believe that the right way to go design-wise for MLton is to
eliminate SSA in favor of SSA2, and that at some point MLton will go
that direction.

All that to say that I believe that SLICMP (and most any new
optimization) should be written for SSA2.

> I seem to recall that at one point in time, we had inline assembly
> for overflow checking arithmetic in the (support code for the)
> C-codgen.  When we had the native x86-codegen, we simplified that
> away, but it might be worthwhile to see what inline PowerPC assembly
> for overflow checking arithmetic gives you.

IIRC, the support for overflow in the C codegen didn't implement the
correct semantics, it simply jumped to some label that terminated the
program.