Branches: main
Store double-precision `float' constructor arguments in unboxed form,
in high-level C grades on 32-bit platforms, i.e. `float' (and equivalent)
arguments may occupy two machine words.
As the C code generated by the MLDS back-end makes use of MR_Float variables
and parameters, float (un)boxing may be reduced substantially in many programs.
compiler/prog_data.m:
Add `double_word' as a new option for constructor argument widths,
only used for float arguments as yet.
compiler/make_hlds_passes.m:
Set constructor arguments to have `double_word' width if required,
and possible.
compiler/type_util.m:
Add helper predicate.
compiler/builtin_ops.m:
compiler/c_util.m:
compiler/llds.m:
Add two new binary operators used by the MLDS back-end.
compiler/arg_pack.m:
Handle `double_word' arguments.
compiler/ml_code_util.m:
Deciding whether or not a float constructor argument requires boxing
now depends on the width of the field.
compiler/ml_global_data.m:
When a float constant appears as an initialiser of a generic array
element, it is now always unboxed, irrespective of --unboxed-float.
compiler/ml_type_gen.m:
Take double-word arguments into account when generating structure
fields.
compiler/ml_unify_gen.m:
Handle double-word float constructor arguments in (de)constructions.
In some cases we break a float argument into its two words, so
generating two assignments statements or two separate rvals.
Take double-word arguments into account when calculating field offsets.
compiler/mlds_to_c.m:
The new binary operators require no changes here.
As a special case, write `MR_float_from_dword_ptr(&X)' instead of
`MR_float_from_dword(X, Y)' when X, Y are consecutive words within a
field. The definition of `MR_float_from_dword_ptr' is more
straightforward, and gcc produces better code than if we use the more
general `MR_float_from_dword'.
compiler/rtti_out.m:
For double-word arguments, generate MR_DuArgLocn structures with
MR_arg_bits set to -1.
compiler/rtti_to_mlds.m:
Handle double-word arguments in field offset calculation.
compiler/unify_gen.m:
Partially handle double_word arguments in LLDS back-end.
compiler/handle_options.m:
Set --unboxed-float when targetting Java, C# and Erlang.
compiler/structure_reuse.direct.choose_reuse.m:
Rename a predicate.
compiler/bytecode.m:
compiler/equiv_type.m:
compiler/equiv_type_hlds.m:
compiler/llds_to_x86_64.m:
compiler/mlds_to_gcc.m:
compiler/mlds_to_il.m:
compiler/opt_debug.m:
Conform to changes.
library/construct.m:
library/store.m:
Handle double-word constructor arguments.
runtime/mercury_conf.h.in:
Clarify what `MR_BOXED_FLOAT' now means.
runtime/mercury_float.h:
Add helper macros for converting between doubles and word/dwords.
runtime/mercury_deconstruct.c:
runtime/mercury_deconstruct.h:
Add a macro `MR_arg_value' and a helper function to extract a
constructor argument value. This replaces `MR_unpack_arg'.
runtime/mercury_type_info.h:
Remove `MR_unpack_arg'.
Document that MR_DuArgLocn.MR_arg_bits may be -1.
runtime/mercury_deconstruct_macros.h:
runtime/mercury_deep_copy_body.h:
runtime/mercury_ml_arg_body.h:
runtime/mercury_table_type_body.h:
runtime/mercury_tabling.c:
runtime/mercury_type_info.c:
Handle double-word constructor arguments.
tests/hard_coded/Mercury.options:
tests/hard_coded/Mmakefile:
tests/hard_coded/lco_double.exp:
tests/hard_coded/lco_double.m:
tests/hard_coded/pack_args_float.exp:
tests/hard_coded/pack_args_float.m:
Add test cases.
trace/mercury_trace_vars.c:
Conform to changes.