Files
mercury/tests/hard_coded/Mmakefile
Fergus Henderson cc100bcfb2 Enable the --optimize-duplicate-calls' option at -O2',
Branches: main
Estimated hours taken: 1

compiler/options.m:
	Enable the `--optimize-duplicate-calls' option at `-O2',
	like we used to do, since the bug that required it to be
	disabled has long since been fixed
	(it was fixed since 1999/06/30, when we moved the
	polymorphism.m pass to occur before mode analysis).

compiler/common.m:
	Add a comment to clarify the interface.

tests/hard_coded/Mmakefile:
tests/hard_coded/dupcall_impurity.m:
tests/hard_coded/dupcall_impurity.exp:
	Add a test case to test that duplicate call optimization
	doesn't mis-optimize impure calls.
2001-12-06 10:16:44 +00:00

337 lines
8.8 KiB
Plaintext

#-----------------------------------------------------------------------------#
main_target: check
include ../Mmake.common
-include ../Mmake.params
#-----------------------------------------------------------------------------#
ORDINARY_PROGS= \
address_of_builtins \
agg \
bidirectional \
bigtest \
boyer \
c_write_string \
cc_and_non_cc_test \
cc_multi_bug \
cc_nondet_disj \
checked_nondet_tailcall \
closure_extension \
common_type_cast \
compare_spec \
comparison \
constraint \
constraint_order \
construct \
curry \
curry2 \
cut_test \
cycles \
cycles2 \
deconstruct_arg \
deep_copy \
deep_copy_bug \
deep_copy_exist \
det_in_semidet_cntxt \
division_test \
dupcall_types_bug \
dupcall_impurity \
elim_special_pred \
eqv_type_bug \
erroneous_liveness \
error_func \
existential_bound_tvar \
existential_float \
existential_reordering \
existential_type_switch_opt \
existential_types_test \
expand \
export_test \
factt \
float_field \
float_map \
float_reg \
float_rounding_bug \
foreign_import_module \
frameopt_pragma_redirect \
free_free_mode \
func_and_pred \
func_ctor_ambig \
func_test \
getopt_test \
ground_dd \
higher_order_func_test \
higher_order_syntax \
higher_order_syntax2 \
higher_order_type_manip \
ho_func_default_inst \
ho_func_reg \
ho_order \
ho_order2 \
ho_solns \
ho_univ_to_type \
impossible_unify \
impure_prune \
integer_test \
intermod_c_code \
intermod_multimode_main \
join_list \
merge_and_remove_dups \
minint_bug \
mode_choice \
multimode \
myset_test \
name_mangling \
no_fully_strict \
no_inline \
nondet_ctrl_vn \
nondet_copy_out \
nullary_ho_func \
pragma_c_code \
pragma_export \
pragma_import \
pragma_inline \
pretty_printing \
qual_adv_test \
qual_basic_test \
qual_is_test \
quantifier \
quantifier2 \
quoting_bug_test \
rational_test \
redoip_clobber \
relation_test \
remove_file \
reorder_di \
rev_arith \
reverse_arith \
rnd \
rtc_bug \
rtti_strings \
setjmp_test \
shift_test \
solve_quadratic \
space \
string_alignment \
string_alignment_bug \
string_loop \
term_io_test \
term_to_univ_test \
test_bitset \
test_imported_no_tag \
tim_qual1 \
time_test \
tuple_test \
tuple_test \
type_ctor_desc \
type_qual \
type_spec_ho_term \
type_spec_modes \
type_to_term_bug \
unify_expression \
unused_float_box_test \
user_defined_equality2 \
write \
write_reg1 \
write_reg2
# Deep profiling cannot yet handle exceptions being caught, which the
# user_defined_equality test case does.
ifeq "$(findstring profdeep,$(GRADE))" ""
EXCEPTION_PROGS = \
user_defined_equality
else
EXCEPTION_PROGS =
endif
# We do not pass the following tests at all:
#
# XXX var_not_found -- mode error in automatically generated unification
# predicate. This test uses partially instantiated modes,
# which are not yet fully supported.
#
# XXX csharp_test doesn't work yet (not even in il* grades)
#
# XXX needs_init doesn't work yet in profiling grades.
# The following tests are passed only in some grades:
#
# XXX copy_pred and copy_pred_2 do not work in the hl* grades (e.g. hlc.gc),
# because the MLDS back-end doesn't generate the closure layout
# information needed to copy closures.
#
# factt_non does not work in the hl* grades (e.g. hlc.gc),
# because the code for nondet fact tables assumes that
# we're using the LLDS back-end. Also, fact tables and deep profiling do not
# (yet) mix.
#
# type_tables does not work in the hl* grades because the test itself
# is a quick hack that assumes the use of the LLDS backend; it should
# be replaced by a test that exercises functionality enabled by type tables.
# However, this must wait for the implementation of that functionality.
ifeq "$(findstring hl,$(GRADE))" ""
ifeq "$(findstring profdeep,$(GRADE))" ""
BACKEND_PROGS = \
copy_pred \
copy_pred_2 \
factt_non \
type_tables
else
BACKEND_PROGS = \
copy_pred \
copy_pred_2 \
type_tables
endif
else
BACKEND_PROGS =
endif
# The MLDS back-end doesn't support nondet C in trailing grades.
# We also don't support nondet C in deep profiling grades.
ifeq "$(findstring hl,$(GRADE))$(findstring .tr,$(GRADE))" "hl.tr"
NONDET_C_PROGS =
else
ifneq "$(findstring profdeep,$(GRADE))" ""
NONDET_C_PROGS =
else
NONDET_C_PROGS = \
inline_nondet_pragma_c \
nondet_c
endif
endif
PROGS = $(ORDINARY_PROGS) $(EXCEPTION_PROGS) $(BACKEND_PROGS) $(NONDET_C_PROGS)
# --split-c-files does not work in the hl* grades (e.g. hlc.gc),
# because it hasn't yet been implemented yet.
# The same is true for deep profiling grades.
ifeq "$(findstring hl,$(GRADE))$(findstring profdeep,$(GRADE))" ""
SPLIT_PROGS = split_c_files
else
SPLIT_PROGS =
endif
#-----------------------------------------------------------------------------#
# some tests need to be compiled with particular options
MCFLAGS-checked_nondet_tailcall = --checked-nondet-tailcalls
MCFLAGS-bigtest = --intermodule-optimization -O3
MCFLAGS-constraint = --constraint-propagation --enable-termination
MCFLAGS-constraint_order = --constraint-propagation --enable-termination
MCFLAGS-lp = --intermodule-optimization -O3
MCFLAGS-boyer = --infer-all
MCFLAGS-func_test = --infer-all
MCFLAGS-ho_order = --optimize-higher-order
MCFLAGS-ho_order2 = --optimize-higher-order
MCFLAGS-no_fully_strict = --no-fully-strict
MCFLAGS-intermod_c_code = --intermodule-optimization
MCFLAGS-intermod_c_code2 = --intermodule-optimization
MCFLAGS-intermod_multimode = --intermodule-optimization
MCFLAGS-intermod_multimode_main = --intermodule-optimization
MCFLAGS-nondet_copy_out = --no-inlining --nondet-copy-out
MCFLAGS-redoip_clobber = --no-inlining
MCFLAGS-rnd = -O6
MCFLAGS-split_c_files = --trace deep
MCFLAGS-type_qual = --infer-all
MCFLAGS-type_spec = --user-guided-type-specialization
MCFLAGS-existential_types_test = --infer-all
MCFLAGS-existential_float = --infer-all
MCFLAGS-user_defined_equality = --infer-all
MCFLAGS-parse = --trace deep
MCFLAGS-unused_float_box_test = --infer-all
# 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
C2INITFLAGS-parse = --trace
MLFLAGS-parse = --trace --static
C2INITFLAGS-split-c-files = --trace
MLFLAGS-split-c-files = --trace
C2INITFLAGS-needs_init = --include-initialization-code --extra-inits
# no_fully_strict is expected to fail (it calls error/1).
# We also need to pipe the output through sed to avoid hard-coding
# dependencies on particular line numbers in the standard library source code.
no_fully_strict.out: no_fully_strict
if ./no_fully_strict > $@.tmp 2>&1; then \
grep . $@.tmp; \
exit 1; \
else \
sed -e 's/exception.m:[0-9]*/exception.m:NNNN/g' \
-e 's/require.m:[0-9]*/require.m:NNNN/g' \
< $@.tmp > $@; \
rm -f $@.tmp; \
fi
# 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.
integer_test.out: integer_test
MERCURY_OPTIONS="--heap-size 70000" ./integer_test > $@ 2>&1
rational_test.out: rational_test
MERCURY_OPTIONS="--heap-size 20000" ./rational_test > $@ 2>&1
#-----------------------------------------------------------------------------#
DEPS= $(PROGS:%=%.dep) $(SPLIT_PROGS:%=%.dep)
DEPENDS=$(PROGS:%=%.depend) $(SPLIT_PROGS:%=%.depend)
OUTS= $(PROGS:%=%.out) $(SPLIT_PROGS:%=%.split.out)
RESS= $(PROGS:%=%.res) $(SPLIT_PROGS:%=%.split.res)
dep_local: $(DEPS)
depend_local: $(DEPENDS)
check_local: $(OUTS) $(RESS)
all_local: $(PROGS) $(SPLIT_PROGS:%=%.split)
#-----------------------------------------------------------------------------#
SUBDIRS = typeclasses sub-modules exceptions purity
dep_subdirs:
+for dir in $(SUBDIRS); do \
(cd $$dir && $(SUBDIR_MMAKE) dep) || exit 1; \
done
depend_subdirs:
+for dir in $(SUBDIRS); do \
(cd $$dir && $(SUBDIR_MMAKE) depend) || exit 1; \
done
check_subdirs:
+for dir in $(SUBDIRS); do \
(cd $$dir && $(SUBDIR_MMAKE) check) || exit 1; \
done
all_subdirs:
+for dir in $(SUBDIRS); do \
(cd $$dir && $(SUBDIR_MMAKE) all) || exit 1; \
done
clean_subdirs:
+for dir in $(SUBDIRS); do \
(cd $$dir && $(SUBDIR_MMAKE) clean) || exit 1; \
done
realclean_subdirs:
+for dir in $(SUBDIRS); do \
(cd $$dir && $(SUBDIR_MMAKE) realclean) || exit 1; \
done
#-----------------------------------------------------------------------------#