mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-16 18:03:36 +00:00
... in the remaining test case directories.
tests/hard_coded/write_reg_1.exp[2345]:
Rename these files to complete the update to the hard_coded test dir.
tests/invalid/Mmakefile:
tests/invalid/coerce_mode_error_1.err_exp:
tests/invalid/coerce_mode_error_1.m:
tests/invalid/coerce_mode_error_2.err_exp:
tests/invalid/coerce_mode_error_2.m:
Rename the coerce_mode_error and coerce_mode_error2 test cases
to coerce_mode_error_[12].
tests/tabling/Mercury.options:
tests/tabling/Mmakefile:
tests/tabling/coup_1.exp:
tests/tabling/coup_1.m:
tests/tabling/coup_2.exp:
tests/tabling/coup_2.m:
tests/tabling/coup_3.exp:
tests/tabling/coup_3.m:
tests/tabling/coup_4.exp:
tests/tabling/coup_4.m:
Rename the coup and coup[233] test cases to coup_[1234].
tests/tabling/seq_1.exp:
tests/tabling/seq_1.m:
tests/tabling/seq_2.exp:
tests/tabling/seq_2.m:
tests/tabling/seq_3.exp:
tests/tabling/seq_3.m:
tests/tabling/seq_4.exp:
tests/tabling/seq_4.m:
Rename the seq and seq[233] test cases to seq_[1234].
tests/tabling/tc_memo_1.exp:
tests/tabling/tc_memo_1.m:
tests/tabling/tc_memo_2.exp:
tests/tabling/tc_memo_2.m:
Rename the tc_memo and tc_memo2 test cases to tc_memo_[12].
tests/tabling/tc_minimal_1.exp:
tests/tabling/tc_minimal_1.m:
tests/tabling/tc_minimal_2.exp:
tests/tabling/tc_minimal_2.m:
Rename the tc_minimal and tc_minimal2 test cases to tc_minimal_[12].
tests/trailing/Mercury.options:
tests/trailing/Mmakefile:
tests/trailing/func_trail_test_1.exp:
tests/trailing/func_trail_test_1.m:
Rename the func_trail_test test case to func_trail_test_1,
due to the existence of func_trail_test_2.
tests/trailing/tu_test_1.exp:
tests/trailing/tu_test_1.m:
tests/trailing/tu_test_2.exp:
tests/trailing/tu_test_2.m:
Rename the tu_test[12] test cases to tu_test_[12].
tests/typeclasses/Mercury.options:
Fix an old oversight by updating a previously-changed module name.
tests/typeclasses/Mmakefile:
tests/typeclasses/ground_constraint_1.exp:
tests/typeclasses/ground_constraint_1.m:
Rename the ground_constraint test case to ground_constraint_1,
due to the existence of ground_constraint_2.
tests/typeclasses/inference_test_1.exp:
tests/typeclasses/inference_test_1.m:
Rename the inference_test test case to inference_test_1,
due to the existence of inference_test_2..
tests/typeclasses/superclass_bug_1.exp:
tests/typeclasses/superclass_bug_1.m:
tests/typeclasses/superclass_bug_2.exp:
tests/typeclasses/superclass_bug_2.m:
tests/typeclasses/superclass_bug_3.exp:
tests/typeclasses/superclass_bug_3.m:
Rename the superclass_bug and superclass_bug[23] test cases
to superclass_bug_[123].
tests/typeclasses/typeclass_exist_method_1.exp:
tests/typeclasses/typeclass_exist_method_1.m:
Rename the typeclass_exist_method test case to typeclass_exist_method_1,
due to the existence of typeclass_exist_method_2.
tests/typeclasses/typeclass_order_bug_1.exp:
tests/typeclasses/typeclass_order_bug_1.m:
tests/typeclasses/typeclass_order_bug_2.exp:
tests/typeclasses/typeclass_order_bug_2.m:
tests/typeclasses/typeclass_order_bug_3.exp:
tests/typeclasses/typeclass_order_bug_3.m:
Rename the typeclass_order_bug and typeclass_order_bug[23] test cases
to typeclass_order_bug_[123].
tests/valid/Mercury.options:
Execute the mpj_7 test case with --infer-all, as its source code says
it should be executed.
tests/valid/Mmakefile:
tests/valid/agc_unbound_typevars_1.m:
tests/valid/agc_unbound_typevars_2.m:
Rename the agc_unbound_typevars and agc_unbound_typevars2 test cases
to agc_unbound_typevars_[12].
tests/valid/exists_fundeps_1.m:
Rename the exists_fundeps test case to exists_fundeps_1,
due to the existence of exists_fundeps_[23].
tests/valid/higher_order_1.m:
tests/valid/higher_order_2.m:
tests/valid/higher_order_3.m:
tests/valid/higher_order_4.m:
tests/valid/higher_order_5.m:
Rename the higher_order and higher_order[2345] test cases
to higher_order_[12345].
tests/valid/ho_func_call_1.m:
Rename the ho_func_call test case to ho_func_call_1,
due to the existence of ho_func_call_2.
tests/valid/lambda_instmap_bug_1.m:
tests/valid/lambda_instmap_bug_2.m:
Rename the lambda_instmap_bug and lambda_instmap_bug2 test cases
to lambda_instmap_bug_[12].
tests/valid/livevars_shallow_1.m:
tests/valid/livevars_shallow_2.m:
Rename the livevars_shallow and livevars_shallow2 test cases
to livevars_shallow_[12].
tests/valid/mpj_2.m:
tests/valid/mpj_5.m:
tests/valid/mpj_6.m:
tests/valid/mpj_7.m:
Rename the mpj_[2567] test cases to mpj_[2567].
tests/valid/multidet_prune.m:
Rename the multidet_prune1 test case to multidet_prune,
since there is no other multidet_prune* test case.
tests/valid/record_syntax_bug_1.m:
Rename the record_syntax_bug test case to record_syntax_bug_1
due to the existence of record_syntax_bug_[234].
tests/valid/reuse_static_1.m:
tests/valid/reuse_static_2.m:
Rename the reuse_static and reuse_static2 test cases
to reuse_static_[12].
tests/valid/sharing_loop_1.m:
tests/valid/sharing_loop_2.m:
tests/valid/sharing_loop_3.m:
Rename the sharing_loop and sharing_loop[23] test cases
to sharing_loop_[123].
tests/valid/simplify_bug_1.m:
tests/valid/simplify_bug_2.m:
Rename the simplify_bug and simplify_bug2 test cases
to simplify_bug_[12].
tests/valid/solver_type_bug_1.m:
Rename the solver_type_bug test case to solver_type_bug_1,
due to the existence of solver_type_bug_2.
tests/valid/state_var_mode_bug_1.m:
tests/valid/state_var_mode_bug_2.m:
Rename the state_var_mode_bug and state_var_mode_bug2 test cases
to state_var_mode_bug_[12].
tests/valid/switch_detection_bug_1.m:
tests/valid/switch_detection_bug_2.m:
Rename the switch_detection_bug and switch_detection_bug2 test cases
to switch_detection_bug_[12].
tests/valid/tricky_assert.m:
Rename the tricky_assert2 test case to tricky_assert,
since there is no other tricky_assert* test case.
tests/valid/unused_args_test.m:
Rename the unused_args_test2 test case to unused_args_test,
since there is no other unused_args_test* test case.
182 lines
4.8 KiB
Mathematica
182 lines
4.8 KiB
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
%
|
|
% Regression test for structure sharing analysis with
|
|
% --structure-sharing-widening set to certain values.
|
|
|
|
:- module sharing_loop_3.
|
|
:- interface.
|
|
|
|
:- type instrmap == mymap(label, instruction).
|
|
:- type mymap(T, U).
|
|
|
|
:- pred short_labels_rval(instrmap::in, rval::in, rval::out) is det.
|
|
|
|
:- type instruction
|
|
---> llds_instr(instr, string).
|
|
|
|
:- type instr
|
|
---> label(label)
|
|
; goto.
|
|
|
|
:- type label
|
|
---> internal_label(string).
|
|
|
|
:- type code_addr
|
|
---> code_label(label).
|
|
|
|
:- type lval
|
|
---> succip_slot(rval)
|
|
; mem_ref(rval).
|
|
|
|
:- type rval
|
|
---> lval(lval)
|
|
; const(rval_const)
|
|
; binop(rval, rval)
|
|
; mem_addr(int).
|
|
|
|
:- type rval_const
|
|
---> llconst_code_addr(code_addr).
|
|
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- implementation.
|
|
|
|
:- pred short_label(instrmap::in, label::in, label::out) is det.
|
|
|
|
short_label(Instrmap, Label0, Label) :-
|
|
( if search(Instrmap, Label0, Instr0) then
|
|
final_dest(Instrmap, Label0, Label, Instr0, _Instr)
|
|
else
|
|
Label = Label0
|
|
).
|
|
|
|
:- pred final_dest(instrmap::in, label::in, label::out, instruction::in,
|
|
instruction::out) is det.
|
|
|
|
final_dest(Instrmap, SrcLabel, DestLabel, SrcInstr, DestInstr) :-
|
|
( if
|
|
SrcInstr = llds_instr(SrcUinstr, _Comment),
|
|
SrcUinstr = label(TargetLabel),
|
|
search(Instrmap, TargetLabel, TargetInstr)
|
|
then
|
|
final_dest(Instrmap,
|
|
TargetLabel, DestLabel, TargetInstr, DestInstr)
|
|
else
|
|
DestLabel = SrcLabel,
|
|
DestInstr = SrcInstr
|
|
).
|
|
|
|
short_labels_rval(Instrmap, lval(Lval0), lval(Lval)) :-
|
|
short_labels_lval(Instrmap, Lval0, Lval).
|
|
short_labels_rval(Instrmap, const(Const0), const(Const)) :-
|
|
short_labels_const(Instrmap, Const0, Const).
|
|
short_labels_rval(Instrmap, binop(LRval0, RRval0),
|
|
binop(LRval, RRval)) :-
|
|
short_labels_rval(Instrmap, LRval0, LRval),
|
|
short_labels_rval(Instrmap, RRval0, RRval).
|
|
short_labels_rval(_, mem_addr(MemRef), mem_addr(MemRef)).
|
|
|
|
:- pred short_labels_const(instrmap::in,
|
|
rval_const::in, rval_const::out) is det.
|
|
|
|
short_labels_const(Instrmap, llconst_code_addr(CodeAddr0),
|
|
llconst_code_addr(CodeAddr)) :-
|
|
CodeAddr0 = code_label(Label0),
|
|
short_label(Instrmap, Label0, Label),
|
|
CodeAddr = code_label(Label).
|
|
|
|
:- pred short_labels_lval(instrmap::in, lval::in, lval::out) is det.
|
|
|
|
short_labels_lval(Instrmap, succip_slot(Rval0), succip_slot(Rval)) :-
|
|
short_labels_rval(Instrmap, Rval0, Rval).
|
|
short_labels_lval(Instrmap, mem_ref(Rval0), mem_ref(Rval)) :-
|
|
short_labels_rval(Instrmap, Rval0, Rval).
|
|
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- type mymap(K, V)
|
|
---> empty
|
|
; two(K, V, mymap(K, V), mymap(K, V))
|
|
; three(K, V, K, V, mymap(K, V), mymap(K, V), mymap(K, V))
|
|
; four(K, V, K, V, K, V, mymap(K, V), mymap(K, V),
|
|
mymap(K, V), mymap(K, V)).
|
|
|
|
:- pred search(mymap(K, V)::in, K::in, V::out) is semidet.
|
|
|
|
search(T, K, V) :-
|
|
(
|
|
T = empty,
|
|
fail
|
|
;
|
|
T = two(K0, V0, T0, T1),
|
|
compare(Result, K, K0),
|
|
(
|
|
Result = (<),
|
|
search(T0, K, V)
|
|
;
|
|
Result = (=),
|
|
V = V0
|
|
;
|
|
Result = (>),
|
|
search(T1, K, V)
|
|
)
|
|
;
|
|
T = three(K0, V0, K1, V1, T0, T1, T2),
|
|
compare(Result0, K, K0),
|
|
(
|
|
Result0 = (<),
|
|
search(T0, K, V)
|
|
;
|
|
Result0 = (=),
|
|
V = V0
|
|
;
|
|
Result0 = (>),
|
|
compare(Result1, K, K1),
|
|
(
|
|
Result1 = (<),
|
|
search(T1, K, V)
|
|
;
|
|
Result1 = (=),
|
|
V = V1
|
|
;
|
|
Result1 = (>),
|
|
search(T2, K, V)
|
|
)
|
|
)
|
|
;
|
|
T = four(K0, V0, K1, V1, K2, V2, T0, T1, T2, T3),
|
|
compare(Result1, K, K1),
|
|
(
|
|
Result1 = (<),
|
|
compare(Result0, K, K0),
|
|
(
|
|
Result0 = (<),
|
|
search(T0, K, V)
|
|
;
|
|
Result0 = (=),
|
|
V = V0
|
|
;
|
|
Result0 = (>),
|
|
search(T1, K, V)
|
|
)
|
|
;
|
|
Result1 = (=),
|
|
V = V1
|
|
;
|
|
Result1 = (>),
|
|
compare(Result2, K, K2),
|
|
(
|
|
Result2 = (<),
|
|
search(T2, K, V)
|
|
;
|
|
Result2 = (=),
|
|
V = V2
|
|
;
|
|
Result2 = (>),
|
|
search(T3, K, V)
|
|
)
|
|
)
|
|
).
|