Files
mercury/compiler/notes
Zoltan Somogyi 2980737352 A new LLDS->LLDS transformation that optimizes instruction sequences such
Estimated hours taken: 24
Branches: main

A new LLDS->LLDS transformation that optimizes instruction sequences such
as the following extract from tree234__search:

	MR_r1 = MR_stackvar(3);
	MR_r2 = MR_stackvar(4);
	MR_r3 = MR_const_field(MR_mktag(1), MR_stackvar(1), (MR_Integer) 2);
	MR_r4 = MR_stackvar(2);
	MR_succip = (MR_Code *) MR_stackvar(5);
	if ((MR_tag(MR_r3) != MR_mktag((MR_Integer) 1))) {
		MR_GOTO_LABEL(mercury__x3__search_3_0_i1);
	}
	MR_stackvar(1) = MR_r3;
	MR_stackvar(2) = MR_r4;
	MR_stackvar(3) = MR_r1;
	MR_stackvar(4) = MR_r2;
	MR_r2 = MR_r4;
	MR_r3 = MR_const_field(MR_mktag(1), MR_r3, (MR_Integer) 0);
	MR_call_localret(...)

The code before the if-then-else is part of the procedure epilogue; the code
after it is the code from the initial part of the procedure that fulljump
optimization replaces the self-tail-call with.

The transformation deletes the redundant assignments to stackvars 2, 3 and 4.
It reduces both the size and the runtime of the compiler by about 0.5%.

compiler/reassign.m:
	The new module that does the work.

compiler/optimize.m:
	Invoke the new module if the optimization is enabled. Invoke it after
	most other optimizations have been run, since they may create more
	opportunities for it.

compiler/option.m:
	Add a new option to control whether the new optimization is enabled.
	Turn on the new optimization at optimization level 3.

doc/user_guide.texi:
	Document the new option.

compiler/notes/compiler_design.html:
	Document the new module.
2002-03-13 01:01:15 +00:00
..
2001-03-05 12:04:25 +00:00
1995-05-30 09:28:30 +00:00
1994-04-12 15:15:05 +00:00