mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-14 05:12:33 +00:00
Generalize the mechanism we use to implement mutual tail recursion optimization
in the MLDS backend to handle TSCCs that contain both predicates and functions.
This generalization also simplifies the split of responsibilities between
the MLDS functions that implement each TSCC procedure for external callers
(which we now call the container function) on the one hand, and their main
components, the bodies of the procedures themselves (which we now call the
wrapped procedures, since each container function wraps up the bodies
of *all* the procedures in the TSCC).
In the new scheme, wrapped functions always give output arguments
to container functions by value. It is the job of the container functions
to return these output arguments to the caller according to the requirements
imposed by the container function's calling convention. This allows
different container functions to return output arguments differently
(some may return an output by value, while some may do so by reference)
while still allowing the wrapped procedure bodies to be generated just once
and then duplicated for each container function.
compiler/notes/mlds_tail_recursion.html:
A new file explaining both the scheme we use to generate code for
TSCCs, and the reasons why we use that scheme.
compiler/notes/Mmakefile:
Include the new file in the list of compiler notes files.
compiler/ml_args_util.m:
Update the code that generated code fragments handling arguments
for TSCCs to follow the updated scheme. Use the terminology in the
new notes file to clarify variable names where relevant. Group
related arguments together.
compiler/ml_proc_gen.m:
Update the code that created wrapped procedures and container functions
to follow the updated scheme. Use the terminology in the new notes file
to clarify both function and variable names where relevant. Delete the
documentation which is now in notes/mlds_tail_recursion.html (in greatly
enhanced form).
Split the predicate for adding local variable definitions to MLDS
functions, since when generating code for TSCCs using the new scheme,
we only need one of its two halves.
compiler/mlds.m:
Add the new forms of compiler generated variables needed by the new
translation scheme.
compiler/ml_gen_info.m:
Change the type of the field containing the byref output vars
from a list to a set. All its users want to treat it as a set,
so it is simpler and faster to convert it just once, when it is set,
instead of on every use.
compiler/ml_code_util.m:
compiler/ml_commit_gen.m:
Conform to the change in ml_gen_info.m.
84 lines
2.4 KiB
Plaintext
84 lines
2.4 KiB
Plaintext
#-----------------------------------------------------------------------------#
|
|
# vim: ts=8 sw=8 noexpandtab
|
|
#-----------------------------------------------------------------------------#
|
|
# Copyright (C) 1996-1997, 1999, 2001, 2003 The University of Melbourne.
|
|
# This file may only be copied under the terms of the GNU General
|
|
# Public License - see the file COPYING in the Mercury distribution.
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
# Mmake - Mmake file for the Mercury documentation.
|
|
|
|
MAIN_TARGET=all
|
|
|
|
MERCURY_DIR=../..
|
|
include $(MERCURY_DIR)/Mmake.common
|
|
|
|
INSTALL_WEB_SUBDIR=$(INSTALL_WEBDIR)/developer
|
|
|
|
# Note that we need to explicitly set TERM=vt100,
|
|
# because otherwise lynx complains if TERM is not set properly
|
|
# (as is the case when this Makefile is run from a cron job).
|
|
# This is a bug in lynx -- it should ignore TERM when given
|
|
# the `-dump' option.
|
|
HTML_TO_TEXT=TERM=vt100 lynx -dump
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
.SUFFIXES: .html .text
|
|
|
|
.html.text:
|
|
$(HTML_TO_TEXT) $< > $@
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
DOCS_HTML = \
|
|
allocation.html \
|
|
analysis.html \
|
|
bootstrapping.html \
|
|
bytecode.html \
|
|
c_coding_standard.html \
|
|
coding_standards.html \
|
|
compiler_design.html \
|
|
developer_intro.html \
|
|
failure.html \
|
|
gc_and_c_code.html \
|
|
glossary.html \
|
|
grade_library.html \
|
|
index.html \
|
|
mlds_tail_recursion.html \
|
|
overall_design.html \
|
|
promise_ex.html \
|
|
release_checklist.html \
|
|
reviews.html \
|
|
todo.html \
|
|
trailing.html \
|
|
type_class_transformation.html \
|
|
upgrade_boehm_gc.html \
|
|
work_in_progress.html
|
|
|
|
DOCS_TEXT = $(subst .html,.text,$(DOCS_HTML))
|
|
|
|
DOCS_ALL = $(DOCS_TEXT) $(DOCS_HTML)
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
.PHONY: all
|
|
all: $(DOCS_ALL)
|
|
|
|
# This install is for installing the Mercury webpage, which goes to
|
|
# a different directory (supplied by the environment variable
|
|
# INSTALL_WEBDIR).
|
|
# Currently the webpage and this documentation on it is installed by
|
|
# a different method. A copy if the repository is checked out on the
|
|
# webserver and linked to.
|
|
|
|
.PHONY: install
|
|
install: $(DOCS_ALL)
|
|
[ -d $(INSTALL_WEB_SUBDIR) ] || mkdir -p $(INSTALL_WEB_SUBDIR)
|
|
cp $(DOCS_ALL) $(INSTALL_WEB_SUBDIR)
|
|
|
|
clean_local:
|
|
rm -f $(DOCS_TEXT)
|
|
|
|
#-----------------------------------------------------------------------------#
|