[m-dev.] option-finetuning (generating trans-opts)

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Sep 13 00:26:56 AEDT 2000


On 12-Sep-2000, Nancy Mazur <Nancy.Mazur at cs.kuleuven.ac.be> wrote:
> [Fergus wrote:]
> > On 12-Sep-2000, Nancy Mazur <Nancy.Mazur at cs.kuleuven.ac.be> wrote:
> > > [Fergus wrote:]
> > > And if I understand it right, termination analysis does not annotate
> > > in any way the HLDS, just verifies termination, which then indeed 
> > > explains the 3 phases? 
> > 
> > Termination analysis does annotate the HLDS.
> > It sets the termination_info field in the proc_info,
> > which is used by simplify.m, which calls code_aux__goal_cannot_loop
> > to determine when certain optimizations are applicable.
> 
> Okay..... but then I don't get it why it's split in 3 phases
> and not only 2

The reason for that is to improve the amount of information available
during code generation in the case there are cyclic dependencies.

With transitive intermodule optimization, the dependencies are like this:

	foo.opt depends only on foo.m (and the .int* files, of course)

	foo.trans_opt depends on
		- the .opt files for ALL of foo's imported modules
		- the .trans_opt files for SOME of foo's imported modules,
		  namely those which occur before foo in the ordering

	foo.c depends on
		- the .opt files for ALL of foo's imported modules
		- the .trans_opt files for ALL of foo's imported modules

The reason why we need three passes is because we have defined the
dependencies in this way.  The .c file can't be generated in the
same pass that generates the .trans_opt file since in the general case
we may not have read in all the .trans_opt files for imported modules
(indeed we can't read them in during that pass, since they may not have
been generated yet).

The reason that we decided that the foo.c file should depend on
the .trans_opt files for ALL of foo's imported modules was to
increase the precision of the information available during code
generation in cases involving cyclic module dependencies.
That decision may perhaps not have been optimal, and so you might
want to reconsider it.

-- 
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.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list