Estimated hours taken: 0.5
Various fixes for problems fjh pointed out in a review.
compiler/ml_code_util.m:
Fix a typo.
compiler/ml_optimize.m:
compiler/mlds_to_c.m:
Move some comments from mlds_output_assign_args to
generate_assign_args.
Remove mlds_output_assign_args as it is now dead code.
compiler/options.m:
Fix a typo, llds-optimize should be mlds-optimize.
doc/user_guide.texi:
Document --no-mlds-optimize.
Estimated hours taken: 5
Do the transformation of self-tailcalls into loops as an MLDS->MLDS
transformation (instead of during mlds_to_c.m). Both the IL and C
backends for MLDS use this transformation.
Also, we transform into label/goto instead of for/continue. This is
because IL doesn't have a for/continue construct. It may be worth
revisiting this decision in future and performing benchmarks.
compiler/mercury_compile.m:
Add an optimization phase to the MLDS end of the compiler.
compiler/ml_optimize.m:
New file that performs MLDS->MLDS optimizations such as turning
self-tail calls into loops.
compiler/ml_tailcall.m:
Use ml_util.
compiler/ml_util.m:
New file containing generic MLDS utilities.
Contents are can_optimize_tailcall and statements_contain_statements.
This code was in mlds_to_c but will be used by more than just
this backend.
compiler/mlds_to_c.m:
Delete old tailcall transformation code (it is either moved into
ml_optimize, ml_util or it is no longer needed).
Only handle general tailcalls.