Commit Graph

6 Commits

Author SHA1 Message Date
Peter Ross
d89afe3839 Merge changes from the reuse branch back onto the main branch.
Estimated hours taken: 0.25
Branches: main

Merge changes from the reuse branch back onto the main branch.

compiler/ml_unify_gen.m:
    Handle the case where the tag on the cell to be reused is unknown.

compiler/hlds_goal.m:
    Add a field which records what possible cons_ids the cell to be
    reused can be tagged with.

compiler/builtin_ops.m:
    Add the unary builtin operator strip_tag.

compiler/bytecode.m:
compiler/c_util.m:
compiler/java_util.m:
compiler/llds.m:
compiler/mlds_to_il.m:
compiler/opt_debug.m:
bytecode/mb_disasm.c:
bytecode/mb_exec.c:
    Handle the strip_tag operator.
2001-03-13 12:40:19 +00:00
Fergus Henderson
9d453c5a7b Delete the `cast_to_unsigned' unary operator from builtin_ops, and
Estimated hours taken: 4

Delete the `cast_to_unsigned' unary operator from builtin_ops, and
replace it with an `unsigned_le' binary operator for doing unsigned
less-then-or-equal comparisons.

This change makes the semantics and typing of the builtin operators
more consistent.

compiler/builtin_ops.m:
	Delete the `cast_to_unsigned' unary_op.
	Add a new `unsigned_le' binary_op.

compiler/dense_switch.m:
compiler/lookup_switch.m:
compiler/ml_simplify_switch.m:
	Use `binop(unsigned_le, X, Y)' rather than
	`binop(<=, unop(cast_to_unsigned, X), Y)'.

compiler/bytecode.m:
compiler/c_util.m:
compiler/llds.m:
compiler/llds_out.m:
compiler/mlds_to_gcc.m:
compiler/mlds_to_il.m:
compiler/opt_debug.m:
compiler/vn_util.m:
compiler/vn_cost.m:
	Delete code for handling `cast_to_unsigned'
	and instead add code for handling `unsigned_le'.

compiler/vn_cost.m:
	Also add `mktag' and `unmktag' as zero_cost_unops.

compiler/c_util.m:
	Add a new procedure `c_util__unsigned_comparison_op',
	for use by llds_out.m.
2001-01-20 15:42:48 +00:00
Fergus Henderson
0df51740ff Fix a problem with unsafe_type_cast that stopped the
Estimated hours taken: 2

Fix a problem with unsafe_type_cast that stopped the
compiler from bootstrapping in MLDS grades.

compiler/builtin_ops.m:
	Add a comment about unsafe_type_cast.

compiler/ml_code_gen.m:
	Generate code for unsafe_type_cast as an inline builtin.

compiler/mlds_to_c.m:
	Delete a hack that was previously needed for unsafe_type_cast.

library/private_builtin.m:
	Delete the `:- external' declaration for unsafe_type_cast;
	this is not needed, and could cause problems because it
	suppresses the definition for unsafe_type_cast,
	which could cause problems if you take its address.

runtime/mercury.h:
	Delete the definition of unsafe_type_cast, since it is
	no longer needed.
2000-12-14 02:04:59 +00:00
Peter Ross
35d1d914e7 Update the MLDS backend to handle structure reuse and compile time gc.
Estimated hours taken: 20

Update the MLDS backend to handle structure reuse and compile time gc.
Note that currently no pass on the main branch currently generates this
information yet.

mlds.m:
    Add a new instruction delete_object which is to be inserted
    whenever a lval can be compile time garbage collected.

ml_unify_gen.m:
    Handle the case where the HowToConstruct field of a construction
    is reuse_cell(_).
    Handle the case where a deconstruction can be compile time gc'd.

hlds_goal.m:
    Add a new field, can_cgc, to deconstruction unifications.  This
    field is `yes' if the deconstruction unification can be compile time
    garbage collected.

hlds_out.m:
    Output the can_cgc field.  Output unification information if we
    request the structure reuse information.

ml_elim_nested.m:
mlds_to_c.m:
    Handle the delete_object instruction.

builtin_ops.m:
    Fix a bug where body was an unary op instead of a binary op.

bytecode.m:
c_util.m:
llds.m:
opt_debug.m:
vn_cost.m:
    Changes to reflect that body is a binary op.

bytecode_gen.m:
code_aux.m:
common.m:
cse_detection.m:
dependency_graph.m:
det_analysis.m:
goal_util.m:
higher_order.m:
mark_static_terms.m:
mode_util.m:
modecheck_unify.m:
pd_cost.m:
pd_util.m:
prog_rep.m:
rl_exprn.m:
rl_key.m:
simplify.m:
switch_detection.m:
term_traversal.m:
unify_gen.m:
unused_args.m:
    Handle the can compile time gc field in deconstruction unifications.
2000-10-06 10:18:39 +00:00
Fergus Henderson
1f85335505 Refactor the handling of code generation for builtin
Estimated hours taken: 5

Refactor the handling of code generation for builtin
procedures to avoid code duplication and to reduce
dependencies between different sub-systems.

compiler/builtin_ops.m:
	Add a new `simple_expr' type.
	Add a new procedure `translate_builtin' that returns this type.
	This procedure is very similar to code_util__translate_builtin
	and ml_call_gen:ml_translate_builtin, but with a slightly
	simpler and somewhat safer interface.

compiler/ml_call_gen.m:
	Use builtin_ops__translate_builtin rather than ml_translate_builtin.

compiler/code_util.m:
compiler/call_gen.m:
compiler/bytecode_gen.m:
compiler/rl_exprn.m:
	Use builtin_ops__translate_builtin rather than
	code_util__translate_builtin.
2000-03-15 08:30:54 +00:00
Fergus Henderson
773bd702cc Some more changes to minimize the complexity of the intermodule dependencies.
Estimated hours taken: 2.5

Some more changes to minimize the complexity of the intermodule dependencies.
In particular, ensure that bytecode.m does not need to import llds.m.

compiler/llds.m:
compiler/builtin_ops.m:
	Move the definitions of the unary_op and binary_op types into
	a new module `builtin_ops'.  These types are used by three of the
	different back-ends (bytecode, llds, and mlds) and therefore deserve
	to be in their own module.

compiler/bytecode.m:
	Define a type `byte_reg_type' and use that instead of llds__reg_type.
	Delete the import of module llds.

compiler/notes/compiler_design.html:
	Document the new module builtin_ops.

compiler/rl_exprn.m:
	Add a comment explaining why we need to import llds (and builtin_ops).

compiler/base_type_layout.m:
compiler/bytecode.m:
compiler/code_util.m:
compiler/dense_switch.m:
compiler/ite_gen.m:
compiler/jumpopt.m:
compiler/llds_out.m:
compiler/lookup_switch.m:
compiler/middle_rec.m:
compiler/opt_debug.m:
compiler/opt_util.m:
compiler/rl_exprn.m:
compiler/string_switch.m:
compiler/tag_switch.m:
compiler/transform_llds.m:
compiler/unify_gen.m:
compiler/value_number.m:
compiler/vn_block.m:
compiler/vn_cost.m:
compiler/vn_flush.m:
compiler/vn_type.m:
compiler/vn_util.m:
compiler/vn_verify.m:
	Add imports of module builtin_ops to lots of modules that
	imported llds.
1999-07-10 07:20:09 +00:00