mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-23 21:33:49 +00:00
If the compiler decides that a du type should use the direct-arg
representation for some of its constructors, it must include information
about that into the .opt file of the module defining the type, in the
form of `where direct_arg is' clauses, which will be used by modules
opt-importing that module and that type. That information was not being
included for du types defined in the *interface* section of a module.
Also fix a related issue that was uncovered: a word_aligned_pointer
assertion on a foreign_type definition would have no effect if there is
a no-tag du type definition for the same type constructor.
compiler/intermod.m:
compler/intermod_decide.m:
Make should_opt_export_type_defn and some_type_needs_to_be_written
succeed for `status_exported' du type definitions with direct-arg
constructors. While `status_exported' suggests those type
definitions would be redundant in .opt files, the information about
the direct-arg constructors is not redundant.
compiler/du_type_layout.m:
Add a is_word_aligned_ptr() value to the ComponentTypeMap if a
no-tag du type also has a foreign_type definition for the current
target language with a word_aligned_pointer assertion. Previously,
this was only being done for single ctor NON no-tag du types.
Add a XXX mentioning that we silently ignore word_aligned_pointer
assertions in other cases.
tests/hard_coded/Mercury.options:
tests/hard_coded/Mmakefile:
tests/hard_coded/direct_arg_opt.m:
tests/hard_coded/direct_arg_opt_helper_1.m:
tests/hard_coded/direct_arg_opt_helper_1.direct_arg_opt_helper_2.m:
tests/hard_coded/direct_arg_opt.exp:
Add a test case.
249 lines
14 KiB
Bash
249 lines
14 KiB
Bash
#---------------------------------------------------------------------------#
|
|
# vim: ts=4 sw=4 expandtab ft=sh
|
|
#---------------------------------------------------------------------------#
|
|
|
|
MCFLAGS-allow_stubs += --allow-stubs --no-warn-stubs
|
|
MCFLAGS-allow_stubs += --infer-all --no-inform-inferred-types
|
|
MCFLAGS-allow_stubs += --no-inform-inferred-modes
|
|
MCFLAGS-any_call_hoist_bug += --loop-invariants
|
|
MCFLAGS-bad_direct_reuse += --ctgc
|
|
MCFLAGS-bad_indirect_reuse_1 += --ctgc --no-common-struct
|
|
MCFLAGS-bad_indirect_reuse_2 += --ctgc --no-common-struct
|
|
MCFLAGS-bad_indirect_reuse_3 += --ctgc --no-common-struct
|
|
MCFLAGS-bad_indirect_reuse_4 += --ctgc --no-common-struct
|
|
MCFLAGS-big_array_from_list += --optimize-tailcalls
|
|
MCFLAGS-bigtest += --intermodule-optimization -O3
|
|
MCFLAGS-boyer += --infer-all --no-inform-inferred-types
|
|
MCFLAGS-bug103 += --optimize-constructor-last-call
|
|
MCFLAGS-bug160 += -w --optimize-peep-mkword
|
|
MCFLAGS-bug240 += -O1
|
|
MCFLAGS-bug300 += --no-const-struct
|
|
MCFLAGS-bug300 += --no-const-struct
|
|
MCFLAGS-bug300 += --optimize-constructor-last-call
|
|
MCFLAGS-bug314 += --trace deep
|
|
MCFLAGS-bug392 += -O0 --deforestation
|
|
MCFLAGS-bug455 += --intermodule-optimization
|
|
MCFLAGS-bug548 += --inlining
|
|
MCFLAGS-bug567 += -O2 --merge-code-after-switch
|
|
MCFLAGS-bug570 += -O2 --deforestation
|
|
MCFLAGS-checked_nondet_tailcall += --checked-nondet-tailcalls
|
|
MCFLAGS-checked_nondet_tailcall_noinline += --checked-nondet-tailcalls
|
|
MCFLAGS-checked_nondet_tailcall_noinline += --no-inlining
|
|
MCFLAGS-cc_and_non_cc_test += --no-inlining
|
|
MCFLAGS-constraint += --constraint-propagation
|
|
MCFLAGS-constraint += --enable-termination
|
|
MCFLAGS-constraint_order += --constraint-propagation
|
|
MCFLAGS-constraint_order += --enable-termination
|
|
MCFLAGS-coerce_opt += --intermodule-optimization
|
|
MCFLAGS-deforest_cc_bug += --deforestation
|
|
MCFLAGS-delay_partial_test_1 += --delay-partial-instantiations
|
|
MCFLAGS-delay_partial_test_2 += --delay-partial-instantiations
|
|
MCFLAGS-delay_partial_test_2 += --no-warn-simple-code
|
|
MCFLAGS-direct_arg_opt += --intermodule-optimization
|
|
MCFLAGS-direct_arg_opt_helper_1 += --intermodule-optimization
|
|
MCFLAGS-ground_terms += --from-ground-term-threshold=2
|
|
MCFLAGS-impl_defn_literals += --no-warn-simple-code
|
|
MCFLAGS-lp += --intermodule-optimization -O3
|
|
MCFLAGS-elim_local_var_char += --eliminate-local-vars
|
|
MCFLAGS-erroneous_liveness += --no-warn-obsolete
|
|
MCFLAGS-existential_float += --no-inform-inferred-types
|
|
MCFLAGS-existential_float += --no-inform-inferred-modes
|
|
MCFLAGS-float_consistency += --optimize-constant-propagation
|
|
MCFLAGS-foreign_enum_mod += --intermodule-optimization
|
|
MCFLAGS-foreign_enum_mod_helper_1 += --intermodule-optimization
|
|
MCFLAGS-from_ground_term_bug += --from-ground-term-threshold=4
|
|
MCFLAGS-func_test += --infer-all
|
|
MCFLAGS-ho_order_1 += --optimize-higher-order
|
|
MCFLAGS-ho_order_2 += --optimize-higher-order
|
|
MCFLAGS-ho_float_reg += --no-warn-overlapping-scopes
|
|
MCFLAGS-no_fully_strict += --no-fully-strict
|
|
MCFLAGS-one_member += -O5
|
|
MCFLAGS-impure_foreign += --optimize-duplicate-calls
|
|
MCFLAGS-int8_static_data += -O0
|
|
MCFLAGS-intermod_c_code += --intermodule-optimization
|
|
MCFLAGS-intermod_c_code_helper_1 += --intermodule-optimization
|
|
MCFLAGS-intermod_foreign_type += --intermodule-optimization
|
|
MCFLAGS-intermod_foreign_type_helper_1 += --intermodule-optimization
|
|
MCFLAGS-intermod_may_export_body += --intermodule-optimization
|
|
MCFLAGS-intermod_may_export_body_helper_1 += --intermodule-optimization
|
|
MCFLAGS-intermod_multimode += --intermodule-optimization
|
|
MCFLAGS-intermod_multimode_helper_1 += --intermodule-optimization
|
|
MCFLAGS-intermod_poly_mode += --intermodule-optimization
|
|
MCFLAGS-intermod_poly_mode_helper_1 += --intermodule-optimization
|
|
MCFLAGS-intermod_pragma_clause += --intermodule-optimization
|
|
MCFLAGS-intermod_pragma_clause_helper_1 += --intermodule-optimization
|
|
MCFLAGS-intermod_try_goal += --intermodule-optimization
|
|
MCFLAGS-intermod_try_goal_helper_1 += --intermodule-optimization
|
|
MCFLAGS-intermod_type_qual += --intermodule-optimization
|
|
MCFLAGS-intermod_type_qual_helper_1 += --intermodule-optimization
|
|
MCFLAGS-io_globals_deadlock += --no-warn-obsolete
|
|
MCFLAGS-lco_double += --optimize-constructor-last-call
|
|
MCFLAGS-lco_mday_bug_1 += --optimize-constructor-last-call
|
|
MCFLAGS-lco_mday_bug_2 += --optimize-constructor-last-call
|
|
MCFLAGS-lco_no_inline += --optimize-constructor-last-call
|
|
MCFLAGS-lco_no_inline += --no-inline-builtins
|
|
MCFLAGS-lco_pack_args_1 += --optimize-constructor-last-call
|
|
MCFLAGS-lco_pack_args_2 += --optimize-constructor-last-call
|
|
MCFLAGS-lco_pack_args_3 += --optimize-constructor-last-call
|
|
MCFLAGS-lco_reorder += --optimize-constructor-last-call
|
|
MCFLAGS-lookup_switch_simple_non += --no-warn-det-decls-too-lax
|
|
MCFLAGS-mode_check_clauses += --no-warn-det-decls-too-lax
|
|
MCFLAGS-mode_choice += --no-warn-det-decls-too-lax
|
|
MCFLAGS-no_fully_strict += --no-warn-det-decls-too-lax
|
|
MCFLAGS-nullary_ho_func += --no-warn-unresolved-polymorphism
|
|
MCFLAGS-opt_format += --optimize-format-calls
|
|
MCFLAGS-opt_format_sign_extend += --optimize-format-calls
|
|
MCFLAGS-pack_args_reuse += --structure-reuse
|
|
MCFLAGS-reuse_double += --ctgc
|
|
MCFLAGS-reuse_ho += --ctgc --no-optimise-higher-order
|
|
MCFLAGS-sharing_comb += --ctgc --structure-sharing-widening 2
|
|
MCFLAGS-simplify_multi_arm_switch += -O3
|
|
MCFLAGS-string_alignment_bug += --no-warn-obsolete
|
|
MCFLAGS-subtype_pack += --allow-packing-dummies
|
|
MCFLAGS-subtype_rtti += --allow-packing-local-sectags
|
|
MCFLAGS-subtype_rtti += --allow-packing-remote-sectags
|
|
MCFLAGS-term_io_test += --no-warn-unresolved-polymorphism
|
|
MCFLAGS-test_imported_no_tag += --no-warn-interface-imports
|
|
MCFLAGS-test_split_switch_arms += --split-switch-arms
|
|
MCFLAGS-type_info_const_ins += --const-struct
|
|
MCFLAGS-type_info_const_ins += --optimise-constant-propagation
|
|
MCFLAGS-type_qual += --no-inform-inferred-types
|
|
MCFLAGS-uncond_reuse += --ctgc
|
|
MCFLAGS-uncond_reuse_bad += --ctgc
|
|
MCFLAGS-unused_float_box_test += --no-inform-inferred-types
|
|
MCFLAGS-unused_float_box_test += --no-inform-inferred-modes
|
|
MCFLAGS-user_defined_equality_1 += --no-inform-inferred-types
|
|
MCFLAGS-user_defined_equality_1 += --no-inform-inferred-modes
|
|
MCFLAGS-user_defined_equality_2 += --no-warn-det-decls-too-lax
|
|
MCFLAGS-uo_regression1 += --from-ground-term-threshold=4
|
|
MCFLAGS-write += --no-warn-unresolved-polymorphism
|
|
# We disable intermodule-optimization here because it isn't compatible with
|
|
# intermodule-analysis.
|
|
MCFLAGS-intermod_unused_args += --no-intermodule-optimization
|
|
MCFLAGS-intermod_unused_args += --intermodule-analysis
|
|
MCFLAGS-intermod_unused_args += --optimise-unused-args
|
|
MCFLAGS-intermod_unused_args_helper_1 += --no-intermodule-optimization
|
|
MCFLAGS-intermod_unused_args_helper_1 += --intermodule-analysis
|
|
MCFLAGS-intermod_unused_args_helper_1 += --optimise-unused-args
|
|
MCFLAGS-loop_inv_extra_test_1 += --loop-invariants --trace-optimized
|
|
MCFLAGS-loop_inv_extra_test_2 += --loop-invariants --trace-optimized
|
|
MCFLAGS-loop_inv_test_1 += --loop-invariants --trace-optimized
|
|
MCFLAGS-loop_inv_test_2 += --loop-invariants --trace-optimized
|
|
MCFLAGS-loop_inv_test_3 += --loop-invariants
|
|
MCFLAGS-loop_inv_test_4 += --loop-invariants
|
|
MCFLAGS-prince_frameopt += --intermodule-optimization -O5
|
|
MCFLAGS-prince_frameopt_helper_1 += --intermodule-optimization -O5
|
|
MCFLAGS-prince_frameopt_helper_1.prince_frameopt_helper_2 += \
|
|
--intermodule-optimization -O5
|
|
|
|
# Compile string_switch_1 with trie, hash and binary search switches
|
|
# all effectively disabled, to test the basic indexing algorithm.
|
|
# Compile string_switch_2 with only trie switches allowed.
|
|
# Compile string_switch_3 with only hash switches allowed.
|
|
# Compile string_switch_4 with only binary search switches allowed.
|
|
MCFLAGS-string_switch_1 += \
|
|
--string-trie-switch-size=100 \
|
|
--string-hash-switch-size=100 \
|
|
--string-binary-switch-size=100
|
|
MCFLAGS-string_switch_2 += \
|
|
--string-trie-switch-size=1 \
|
|
--string-hash-switch-size=100 \
|
|
--string-binary-switch-size=100
|
|
MCFLAGS-string_switch_3 += \
|
|
--string-trie-switch-size=100 \
|
|
--string-hash-switch-size=1 \
|
|
--string-binary-switch-size=100
|
|
MCFLAGS-string_switch_4 += \
|
|
--string-trie-switch-size=100 \
|
|
--string-hash-switch-size=100 \
|
|
--string-binary-switch-size=1
|
|
# Compile space.m with only trie hashes allowed as well, since it has
|
|
# a predicate (figure_key) that is a useful test for string trie lookup
|
|
# switches.
|
|
MCFLAGS-space += \
|
|
--string-trie-switch-size=1 \
|
|
--string-hash-switch-size=100 \
|
|
--string-binary-switch-size=100
|
|
|
|
# This bug only shows up at optimization levels -O2 and below.
|
|
MCFLAGS-profdeep_seg_fault += -O2
|
|
MCFLAGS-puzzle_detism_bug += --trace-optimized --inlining
|
|
MCFLAGS-no_inline_builtins += --no-inline-builtins
|
|
MCFLAGS-no_warn_singleton += --halt-at-warn
|
|
MCFLAGS-nondet_copy_out += --no-inlining --nondet-copy-out
|
|
MCFLAGS-opt_dup_bug += -O2 --optimize-dups --optimize-frames
|
|
MCFLAGS-redoip_clobber += --no-inlining
|
|
MCFLAGS-rnd += -O6
|
|
MCFLAGS-switch_detect += --halt-at-warn
|
|
# The trace_goal_1 and trace_goal_2 test cases differ only in that
|
|
# we compile the latter without any --trace-flag arguments.
|
|
MCFLAGS-trace_goal_1 += --trace-flag=abc --trace-flag def
|
|
MCFLAGS-trace_goal_3 += --trace-flag=abc
|
|
MCFLAGS-trace_goal_env_1 += --trace-flag=abc
|
|
MCFLAGS-trace_goal_env_2 += --trace-flag=abc
|
|
MCFLAGS-trace_goal_opt += --intermod-opt
|
|
MCFLAGS-trans_intermod_user_eq += --intermodule-optimization
|
|
MCFLAGS-trans_intermod_user_eq += --transitive-intermodule-optimization
|
|
MCFLAGS-trans_intermod_user_eq_helper_1 += --intermodule-optimization
|
|
MCFLAGS-trans_intermod_user_eq_helper_1 += --transitive-intermodule-optimization
|
|
MCFLAGS-trans_intermod_user_eq_helper_2 += --intermodule-optimization
|
|
MCFLAGS-trans_intermod_user_eq_helper_2 += --transitive-intermodule-optimization
|
|
MCFLAGS-type_qual += --infer-all
|
|
MCFLAGS-type_qual += --from-ground-term-threshold=4
|
|
MCFLAGS-type_spec += --user-guided-type-specialization
|
|
MCFLAGS-existential_types_test += --infer-all
|
|
MCFLAGS-existential_float += --infer-all
|
|
MCFLAGS-user_defined_equality_1 += --infer-all
|
|
MCFLAGS-parse += --trace rep
|
|
MCFLAGS-unused_float_box_test += --infer-all
|
|
|
|
MCFLAGS-constant_prop_1 += --optimize-constant-propagation
|
|
MCFLAGS-constant_prop_1 += --trace-optimized
|
|
MCFLAGS-constant_prop_2 += --optimize-constant-propagation
|
|
MCFLAGS-constant_prop_2 += --optimize-dead-procs --trace-optimized
|
|
MCFLAGS-constant_prop_int += --optimize-constant-propagation
|
|
MCFLAGS-constant_prop_loop_inv += --optimize-constant-propagation
|
|
MCFLAGS-constant_prop_loop_inv += --optimize-dead-procs --trace-optimized
|
|
MCFLAGS-constant_prop_loop_inv += --loop-invariants
|
|
|
|
# XXX MSVC - this won't work due to the object file extension being hardcoded
|
|
# to ".o".
|
|
MCFLAGS-target_mlobjs += --pre-link-command "mmake target_mlobjs_c.o"
|
|
MLOBJS-target_mlobjs += target_mlobjs_c.o
|
|
|
|
# We can get this warning if the user-provided type-specific compare predicate
|
|
# compare_foo is inlined at some call sites. Since our setup asks the C
|
|
# compiler to treat any warning as an error, we turn off the warning.
|
|
#
|
|
# XXX MSVC - passing GCC / clang options to MSVC will not work.
|
|
CFLAGS-user_compare += -Wno-tautological-compare
|
|
|
|
# In grade `none' with options `-O1 --opt-space' on kryten
|
|
# (a sparc-sun-solaris2.5 system), mode_choice needs to be linked
|
|
# with `--no-strip', otherwise it gets a seg fault.
|
|
# The test case ../hard_coded/string_test suffers from a similar problem.
|
|
# This is probably a bug in one of the underlying tools (e.g. the Solaris
|
|
# linker) rather than a bug in Mercury, and since it is goes away when you
|
|
# compile with debugging information, it is very difficult to debug.
|
|
# It is much easier to just work around it this way rather than
|
|
# tracking it down.
|
|
MLFLAGS-mode_choice += --no-strip
|
|
|
|
CFLAGS-no_refs_to_deleted_labels += -DMR_DEBUG_LABEL_NAMES
|
|
|
|
MLFLAGS-parse += --trace
|
|
MLFLAGS-split-c-files += --trace
|
|
MLFLAGS-needs_init += --include-initialization-code
|
|
MLFLAGS-needs_init += --extra-inits
|
|
|
|
# These tests run out of memory in non-GC grades
|
|
# unless we increase the heap size from the default 4M.
|
|
# The sizes specified here (70 Mb and 20 Mb respectively)
|
|
# are sufficient for running these tests on 64-bit systems.
|
|
# The setting of `--mdb-out' tests the quoting of runtime
|
|
# options containing special characters.
|
|
|
|
MLFLAGS-integer_test += \
|
|
--runtime-flags "--heap-size 70000 --mdb-out \"mdb\\mdb out\""
|
|
MLFLAGS-rational_test += --runtime-flags "--heap-size 20000"
|