Estimated hours taken: 7
Restructure the RTTI implementation to eliminate dependencies on the LLDS,
so that it can be used for the MLDS back-end as well as the LLDS back-end.
(Note that I have not yet modified the MLDS back-end to actually make
use of it; that will be a separate change.)
compiler/rtti.m:
Eliminate the dependency on LLDS, by replacing code_addr with a new
type `rtti_proc_label'. Add a procedure `rtti__make_proc_label' for
constructing these.
compiler/type_ctor_info.m:
Eliminate the dependency on LLDS, by calling rtti__make_proc_label
rather than code_util__make_entry_label.
compiler/ml_code_util.m:
Add a new procedure `ml_gen_pred_label_from_rtti',
for (eventual) use by ml_base_type_info.m.
Restructure the implementation of ml_gen_pred_label so that it
works by first calling rtti__make_proc_label and then calling
ml_gen_pred_label_from_rtti.
compiler/code_util.m:
Add new procedure `make_entry_label_from_rtti', for use by rtti_out.m.
Restructure the implementation of the predicates make_entry_label,
make_local_entry_label, and make_proc_label so that they work by first
calling rtti__make_proc_label. Change make_user_proc_label to take
a boolean rather than an import_status.
Also update the documentation for code_util__compiler_generated,
adding an XXX comment saying that the name is misleading.
compiler/rtti_out.m:
Call code_util__make_entry_label_from_rtti to
convert the rtti_proc_labels in the RTTI into code_addrs.
compiler/rl.m:
Update to reflect the changed interface to
code_util__make_user_proc_label.
Estimated hours taken: 16 (some work done in tandem with fjh)
Extend MLDS to cope with alternate backends, and hopefully to allow
easier implementation of high level data structures in the C backend.
Add type information that is required for more heavily typed backends
(with C you can just cast to void * to escape the type system when it is
inconvenient, with other systems this is impossible, e.g. a Java backend).
Introduce new "cast" unop, that does casts.
compiler/mercury_compile.m:
Split the generation of MLDS from outputting high-level C code.
MLDS can be connected up to other backends.
compiler/ml_base_type_info.m:
compiler/ml_call_gen.m:
compiler/ml_code_gen.m:
compiler/ml_code_util.m:
compiler/ml_tailcall.m:
compiler/ml_unify_gen.m:
Add a type to code address constants (the type signature of the
function).
Add the type of the field and the type of the object to field
instructions.
Add a type to mem_ref (the type of the reference).
Don't create local definitions if the locals are dummy types.
compiler/ml_elim_nested.m:
Add types to code addresses, fields and mem_refs.
Use cast where appropriate.
compiler/mlds.m:
Add cast statement.
Add types to code addresses, fields and mem_refs.
compiler/mlds_to_c.m:
Output casts, generally ignore the types in code addresses,
fields and mem_refs (high level C code doesn't really need them,
although it might be nice to use them in future).
Estimated hours taken: 0.25
compiler/mlds.m:
compiler/mlds_to_c.m:
compiler/ml_unify_gen.m:
compiler/ml_code_util.m:
Rename mlds__int_type, mlds__float_type, etc.
to mlds__native_int_type, mlds__native_float_type, etc.,
to make it clearer that these types are for the native
MLDS types, which may be different from the MLDS types
used to represent the correspondingly-named Mercury types.
Estimated hours taken: 1
Add support for `pragma memo' and `pragma loopcheck'
to the MLDS back-end.
compiler/ml_code_util.m:
Change the interface to ml_gen_mlds_var_decl so that it takes
an mlds__data_name rather than an mlds__var_name, so that it
can be used to generate declarations for tabling_pointer
variables.
compiler/ml_code_gen.m:
compiler/ml_code_util.m:
compiler/ml_unify_gen.m:
Change calls to ml_gen_mlds_var_decl to match its new interface.
compiler/ml_code_gen.m:
For tabled procedures, generate a definition of the
variable which holds the table.
compiler/mlds_to_c.m:
Add code to handling output the names of the variables
used to hold tables.
Estimated hours taken: 4
Split up ml_code_gen.m into four modules.
compiler/ml_call_gen.m:
New module, contains the MLDS code generation for
calls and builtins.
compiler/ml_unify_gen.m:
New module, contains the MLDS code generation for
unifications.
compiler/ml_code_util.m:
New module, contains stuff shared between
ml_call_gen.m, ml_unify_gen.m, and ml_code_gen.m.
compiler/ml_code_gen.m:
Move about 60% of the code here into the three new
modules.