-fspecialize-all or the like?

Nicholas Nethercote njn25@cam.ac.uk
Tue, 7 May 2002 15:07:03 +0100 (BST)


On Mon, 22 Apr 2002, Simon Peyton-Jones wrote:

> Actually, GHC does automatically specialise for all types
> at which the function is called in that module, but it doesn't do
> it across modules.  Why not?  Because it compiles bottom-up,
> whereas the specialisation info is really top-down.
>
> Have often thought that we could spit out specialisation info
> into .spec files, and have some separate program to eat up
> all the .spec files and produce specialisation pragmas for
> all the modules... but never got around to it.  It would produce
> quite a worthwhile speedup though, if anyone feels inclined to
> tackle it.
>
> (If anyone does, I have a good plan of action in my head.)

I advise anyone thinking of doing this to read:

F. Bueno, M. Garcia de la Banda, M. Hermenegildo, K. Marriott, G.
Puebla, and P. Stuckey. A model for inter-module analysis and optimizing
compilation. In Kung-Kiu Lau, editor, Tenth International Workshop on
Logic-based Program Synthesis and Transformation, LNCS 2042, pages
86--102. Springer-Verlag, July 2001.
www.cs.mu.oz.au/~pjs/papers/lopstr2000.ps.gz

The examples are all logic programming based, but much should be
applicable to functional programs.

And if that doesn't scare you off, maybe this will:

Nicholas Nethercote. The Analysis Framework of HAL. Master's Thesis,
University of Melbourne, September 2001.
www.cl.cam.ac.uk/~njn25/pubs/masters2001.ps.gz
(Chapter 7)

It's more specific (describes a particular implementation) and goes into more
of the gruesome details.

--
Nick Nethercote
njn25@cam.ac.uk