[MLton] Possible contributions to optimization
Kristopher Micinski
kryptechcoder at gmail.com
Tue Mar 4 19:17:31 PST 2008
On Tue, Mar 4, 2008 at 5:08 AM, Matthew Fluet <fluet at tti-c.org> wrote:
>
> Hi Kristopher,
>
> If you are interested in contributing to MLton, you should subscribe to
> the MLton development list (mlton at mlton.org; link available from
> http://mlton.org/Contact).
>
> The wiki contains a number of pages that point towards various aspects of
> development:
> http://mlton.org/Development -- overview of development pages
> http://mlton.org/CompilerOverview -- overview of compiler structure,
> including links to various intermediate languages and optimization
> passes (themselves with links to the corresponding source files).
> http://mlton.org/Projects -- short list of suggested projects
> http://mlton.org/Talk -- a very brief overview talk of the compiler
> http://mlton.org/References#Weeks06 -- a longer talk about the compiler
>
> Based on your self-description, I would probably suggest thinking about
> implementing a loop-invariant code motion optimization pass in the SSA IL.
> Because MLton uses a defunctionalization technique
> (http://mlton.org/References#CejtinEtAl00) to turn higher-order functions
> into first-order functions, the SSA IL looks very much like one you would
> see in a first-order language compiler (like one for C). This means that
> a lot of "traditional" compiler optimizations can be implemented in a
> fairly straightforward manner. Nearly every compiler textbook will have a
> description of loop-invariant code motion, and there is a good chance that
> it would have some measurable impact on code. It should also be fairly
> easy to adapt to the SSA IL.
>
> Some starting points would be to familiarize yourself with the SSA IL,
> familiarize yourself with some of the other SSA IL optimizations
> (http://mlton.org/SSASimplify; the CommonSubexp optimization is fairly
> straightforward and should be familar from a compiler textbook). You can
> use the "-keep-pass passName" and "-diag-pass passName" compiler options
> to dump the program as it appears before and after a pass and to dump
> various diagnostics generated by the pass. Also, the "-keep ssa" compiler
> option will dump the final SSA IL program during the compilation.
> Browsing through some of the dumped .ssa files will help you see what the
> intermediate code looks like.
>
> And, of course, feel free to ask questions on the development list.
>
> -Matthew
Yes, I intend to by Appel's book, and have already read the Dragon
book and "Modern Compiler Design" (which also includes functional
language compilation, though only a small section). I plan to read the
code in MLton, but want to know if it would be worth implementing a
backend for LLVM (which can then optimize even more with generated
SSA), or if this is just an off the wall idea.
Sorry, didn't have much time, but I plan to subscribe to the developer list.
Thanks all,
-- Kristopher Micinski
More information about the MLton
mailing list