Commit 074961b4 authored by erwan's avatar erwan
Browse files

feat: add a --remove-nested-call option, and do not split expression by default

parent b6403e90
(** Time-stamp: <modified the 29/08/2019 (at 15:42) by Erwan Jahier> *)
(** Time-stamp: <modified the 05/05/2022 (at 08:40) by Erwan Jahier> *)
open Lxm
open Lic
......@@ -311,10 +311,11 @@ let (create_map_body: local_ctx -> Lic.static_arg list -> Lic.node_body * var_in
for all i = 0, ..., c-1; (Y1[i], ... ,Yl[i]) = N(X_1[i], ... ,X_k[i])
*)
let iter_node,c = match List.sort compare sargs with
| [ConstStaticArgLic(_,Int_const_eff(c)) ; NodeStaticArgLic(_,_node_key)]
| [ConstStaticArgLic(_,Int_const_eff(c));TypeStaticArgLic(_); NodeStaticArgLic(_,_node_key)]
| [ConstStaticArgLic(_,Int_const_eff(c)) ; NodeStaticArgLic(_,node_key)]
| [ConstStaticArgLic(_,Int_const_eff(c)) ; TypeStaticArgLic(_);
NodeStaticArgLic(_,node_key)]
->
_node_key,c
node_key,c
| _ -> assert false
in
let iter_node = Lxm.flagit iter_node lxm in
......@@ -324,14 +325,14 @@ let (create_map_body: local_ctx -> Lic.static_arg list -> Lic.node_body * var_in
let index_list = fill 0 c in
let neqs =
List.map
(fun i ->
(fun i ->
let (xi_j:val_exp list) = (* X1[i], ... ,Xn[i] *)
List.map (array_var_to_val_exp lxm i) y1_yl
in
let (lhs : left list) = (* Y1[i], ... ,Yl[i] *)
List.map (array_var_to_left i) x1_xn
in
let cl =
let cl =
List.map (fun l -> snd (Lic.var_info_of_left l).var_clock_eff) lhs
in
let p,n = fst iter_node.it in
......@@ -346,11 +347,12 @@ let (create_map_body: local_ctx -> Lic.static_arg list -> Lic.node_body * var_in
ve_src = lxm
}
in
let eq = { src = lxm ; it = (lhs, rhs) } in
let eq = { src = lxm ; it = (lhs, rhs) } in
eq
)
index_list
in
{ asserts_eff = []; eqs_eff = List.rev neqs }, []
let (create_boolred_body: local_ctx -> int -> int -> int -> Lic.node_body * var_info list) =
......
(* Time-stamp: <modified the 22/09/2021 (at 11:22) by Erwan Jahier> *)
(* Time-stamp: <modified the 05/05/2022 (at 08:47) by Erwan Jahier> *)
(*
Le manager d'argument adapt de celui de lutin, plus joli
N.B. solution un peu batarde : les options sont stockes, comme avant, dans Global,
......@@ -81,7 +81,7 @@ let (global_opt:global_opt) =
lv4 = false;
kcg = false;
ec = false;
one_op_per_equation = true;
one_op_per_equation = false;
when_on_ident = false;
no_when_not = false;
no_prefix = false;
......@@ -247,8 +247,8 @@ let set_v4_options opt =
| AsInt | AsConst | AsBool -> ());
opt.inline_iterator <- true;
global_opt.when_on_ident <- true;
opt.expand_arrays <- true;
opt.expand_nodes <- true (* because expand_arrays is true *)
opt.expand_arrays <- true
(* ; opt.expand_nodes <- true (* because expand_arrays is true *) *)
let set_ec_options opt =
......@@ -263,7 +263,8 @@ let set_ec_options opt =
()
let set_c_options opt =
opt.gen_c <- true;
opt.gen_c <- true;
global_opt.one_op_per_equation <- true;
(match global_opt.expand_enums with
| AsEnum -> global_opt.expand_enums <- AsInt;
(* only override the default in this case *)
......@@ -292,8 +293,9 @@ let mkoptab (opt:t) : unit = (
mkopt opt
["-exec"]
(Arg.Unit (fun _ ->
opt.exec <- true;
global_opt.expand_enums <- AsInt;
opt.exec <- true;
global_opt.one_op_per_equation <- true;
global_opt.expand_enums <- AsInt;
))
["Interpret the program using RIF conventions for I/O (force -eei)"]
;
......@@ -328,7 +330,12 @@ let mkoptab (opt:t) : unit = (
["-knc"; "--keep-nested-calls"]
(Arg.Unit (fun _ -> global_opt.one_op_per_equation <- false))
["Keep nested calls (inhibited by -en). By default, only one node ";
"per equation is generated (don't work with -exec or -2c)"]
"per equation is generated (ignored with -exec or -2c*)"]
;
mkopt opt ~doc_level:Dev
["-rnc"; "--remove-nested-calls"]
(Arg.Unit (fun _ -> global_opt.one_op_per_equation <- true))
["Remove nested calls"]
;
mkopt opt ~doc_level:Advanced
["--when-on-ident"]
......@@ -365,7 +372,7 @@ let mkoptab (opt:t) : unit = (
["-esa"; "--expand-structs-and-arrays"]
(Arg.Unit (fun _ ->
opt.expand_arrays <- true;
opt.expand_nodes <- true;
(* opt.expand_nodes <- true; *)
opt.inline_iterator <- true))
["Expand structures and arrays (force '-ei' and '-en')"]
;
......@@ -478,7 +485,7 @@ let mkoptab (opt:t) : unit = (
;
(* to show Hidden opt *)
mkopt opt
["-more";"--advanced-options"]
["-m";"-more";"--more";"--advanced-options"]
(* (Arg.Unit(fun _ -> opt.see_all_options <- true)) *)
(Arg.Unit (full_help opt))
["Show more options"]
......@@ -579,7 +586,7 @@ let mkoptab (opt:t) : unit = (
;
mkopt opt ~doc_level:Dev
["--gen-autotest"]
(Arg.Unit (fun () -> global_opt.gen_autotest <- true))
(Arg.Unit (fun () -> global_opt.one_op_per_equation <- true;global_opt.gen_autotest <- true))
["Generate a Lutin Stimulator and a Lustre oracle to compare the ";
"result of 2 Lustre compilers"]
;
......
==> lus2lic0.sum <==
Test run by jahier on Fri Apr 8 15:06:47
Test run by jahier on Thu May 5 08:47:41
Native configuration is x86_64-pc-linux-gnu
=== lus2lic0 tests ===
......@@ -66,7 +66,7 @@ XFAIL: Test bad programs (assert): test_lus2lic_no_node should_fail/assert/lecte
XFAIL: Test bad programs (assert): test_lus2lic_no_node should_fail/assert/s.lus
==> lus2lic1.sum <==
Test run by jahier on Fri Apr 8 15:06:48
Test run by jahier on Thu May 5 08:47:43
Native configuration is x86_64-pc-linux-gnu
=== lus2lic1 tests ===
......@@ -112,11 +112,6 @@ PASS: sh Gyroscope.sh
PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c Gyroscope.lus {}
PASS: /home/jahier/lus2lic/test/../utils/compare_lv6_and_lv6_en Gyroscope.lus {}
PASS: /home/jahier/lus2lic/test/../utils/compare_gcc_and_clang Gyroscope.lus {}
PASS: ./lus2lic {-2c Gyroscope2.lus -n Gyroscope2}
PASS: sh Gyroscope2.sh
PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c Gyroscope2.lus {}
PASS: /home/jahier/lus2lic/test/../utils/compare_lv6_and_lv6_en Gyroscope2.lus {}
PASS: /home/jahier/lus2lic/test/../utils/compare_gcc_and_clang Gyroscope2.lus {}
PASS: ./lus2lic {-2c aa.lus -n aa}
PASS: sh aa.sh
PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c aa.lus {}
......@@ -626,7 +621,7 @@ PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c multipar.lus {}
PASS: /home/jahier/lus2lic/test/../utils/compare_lv6_and_lv6_en multipar.lus {}
==> lus2lic2.sum <==
Test run by jahier on Fri Apr 8 15:10:09
Test run by jahier on Thu May 5 08:53:53
Native configuration is x86_64-pc-linux-gnu
=== lus2lic2 tests ===
......@@ -925,7 +920,6 @@ PASS: sh redoptest.sh
PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c redoptest.lus {}
PASS: /home/jahier/lus2lic/test/../utils/compare_lv6_and_lv6_en redoptest.lus {}
PASS: /home/jahier/lus2lic/test/../utils/compare_gcc_and_clang redoptest.lus {}
PASS: ./lus2lic {-2c remplissage.lus -n remplissage}
PASS: ./lus2lic {-2c rs.lus -n rs}
PASS: sh rs.sh
PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c rs.lus {}
......@@ -1056,6 +1050,7 @@ PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c test_merge.lus {}
PASS: /home/jahier/lus2lic/test/../utils/compare_lv6_and_lv6_en test_merge.lus {}
PASS: /home/jahier/lus2lic/test/../utils/compare_gcc_and_clang test_merge.lus {}
PASS: ./lus2lic {-2c test_model.lus -n test_model}
FAIL: Generate c code : ./lus2lic {-2c test_model2.lus -n test_model2}
PASS: ./lus2lic {-2c test_node_expand.lus -n test_node_expand}
PASS: sh test_node_expand.sh
PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c test_node_expand.lus {}
......@@ -1170,7 +1165,7 @@ PASS: /home/jahier/lus2lic/test/../utils/compare_lv6_and_lv6_en zzz2.lus {}
PASS: /home/jahier/lus2lic/test/../utils/compare_gcc_and_clang zzz2.lus {}
==> lus2lic3.sum <==
Test run by jahier on Fri Apr 8 15:13:53
Test run by jahier on Thu May 5 09:01:28
Native configuration is x86_64-pc-linux-gnu
=== lus2lic3 tests ===
......@@ -1210,10 +1205,7 @@ PASS: ./lus2lic {} {-lic -o Gyroscope.lic Gyroscope.lus -n Gyroscope}
PASS: ./lus2lic {-ec -o Gyroscope.ec Gyroscope.lus -n Gyroscope}
PASS: ./myec2c {-o Gyroscope.c Gyroscope.ec}
PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node Gyroscope.lus {}
PASS: ./lus2lic {} {-lic -o Gyroscope2.lic Gyroscope2.lus -n Gyroscope2}
PASS: ./lus2lic {-ec -o Gyroscope2.ec Gyroscope2.lus -n Gyroscope2}
PASS: ./myec2c {-o Gyroscope2.c Gyroscope2.ec}
PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node Gyroscope2.lus {}
FAIL: without any option: ./lus2lic {} {-lic -o Gyroscope2.lic Gyroscope2.lus -n Gyroscope2}
PASS: ./lus2lic {} {-lic -o aa.lic aa.lus -n aa}
PASS: ./lus2lic {-ec -o aa.ec aa.lus -n aa}
PASS: ./myec2c {-o aa.c aa.ec}
......@@ -1685,7 +1677,7 @@ PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node multipar.lus {}
==> lus2lic4.sum <==
Test run by jahier on Fri Apr 8 15:14:47
Test run by jahier on Thu May 5 09:02:37
Native configuration is x86_64-pc-linux-gnu
=== lus2lic4 tests ===
......@@ -1947,9 +1939,7 @@ PASS: ./lus2lic {} {-lic -o redoptest.lic redoptest.lus -n redoptest}
PASS: ./lus2lic {-ec -o redoptest.ec redoptest.lus -n redoptest}
PASS: ./myec2c {-o redoptest.c redoptest.ec}
PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node redoptest.lus {}
PASS: ./lus2lic {} {-lic -o remplissage.lic remplissage.lus -n remplissage}
PASS: ./lus2lic {-ec -o remplissage.ec remplissage.lus -n remplissage}
PASS: ./myec2c {-o remplissage.c remplissage.ec}
FAIL: without any option: ./lus2lic {} {-lic -o remplissage.lic remplissage.lus -n remplissage}
PASS: ./lus2lic {} {-lic -o rs.lic rs.lus -n rs}
PASS: ./lus2lic {-ec -o rs.ec rs.lus -n rs}
PASS: ./myec2c {-o rs.c rs.ec}
......@@ -2073,7 +2063,9 @@ PASS: ./lus2lic {-ec -o test_merge.ec test_merge.lus -n test_merge}
PASS: ./lus2lic {} {-lic -o test_model.lic test_model.lus -n test_model}
PASS: ./lus2lic {-ec -o test_model.ec test_model.lus -n test_model}
PASS: ./myec2c {-o test_model.c test_model.ec}
FAIL: without any option: ./lus2lic {} {-lic -o test_model2.lic test_model2.lus -n test_model2}
PASS: ./lus2lic {} {-lic -o test_model2.lic test_model2.lus -n test_model2}
PASS: ./lus2lic {-ec -o test_model2.ec test_model2.lus -n test_model2}
PASS: ./myec2c {-o test_model2.c test_model2.ec}
PASS: ./lus2lic {} {-lic -o test_node_expand.lic test_node_expand.lus -n test_node_expand}
PASS: ./lus2lic {-ec -o test_node_expand.ec test_node_expand.lus -n test_node_expand}
PASS: ./myec2c {-o test_node_expand.c test_node_expand.ec}
......@@ -2183,20 +2175,20 @@ PASS: /home/jahier/lus2lic/test/../utils/compare_gcc_and_clang multipar.lus {}
=== lus2lic1 Summary ===
# of expected passes 549
# of expected passes 544
==> lus2lic2.sum <==
=== lus2lic2 Summary ===
# of expected passes 529
# of unexpected failures 3
# of expected passes 528
# of unexpected failures 4
==> lus2lic3.sum <==
=== lus2lic3 Summary ===
# of expected passes 493
# of unexpected failures 8
# of expected passes 489
# of unexpected failures 9
# of unresolved testcases 1
==> lus2lic4.sum <==
......@@ -2206,13 +2198,13 @@ PASS: /home/jahier/lus2lic/test/../utils/compare_gcc_and_clang multipar.lus {}
# of expected passes 470
# of unexpected failures 6
===============================
# Total number of failures: 17
# Total number of failures: 19
lus2lic0.log:testcase ./lus2lic.tests/test0.exp completed in 1 seconds
lus2lic1.log:testcase ./lus2lic.tests/test1.exp completed in 201 seconds
lus2lic2.log:testcase ./lus2lic.tests/test2.exp completed in 223 seconds
lus2lic3.log:testcase ./lus2lic.tests/test3.exp completed in 54 seconds
lus2lic4.log:testcase ./lus2lic.tests/test4.exp completed in 35 seconds
lus2lic1.log:testcase ./lus2lic.tests/test1.exp completed in 369 seconds
lus2lic2.log:testcase ./lus2lic.tests/test2.exp completed in 455 seconds
lus2lic3.log:testcase ./lus2lic.tests/test3.exp completed in 69 seconds
lus2lic4.log:testcase ./lus2lic.tests/test4.exp completed in 59 seconds
* Ref time:
174.91user 48.72system 8:35.23elapsed 43%CPU (0avgtext+0avgdata 76980maxresident)k
195048inputs+456896outputs (669major+19477308minor)pagefaults 0swaps
331.43user 98.32system 15:55.64elapsed 44%CPU (0avgtext+0avgdata 76876maxresident)k
46544inputs+449472outputs (111major+19306350minor)pagefaults 0swaps
* Quick time (-j 4):
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment