Skip to content
Snippets Groups Projects
Commit 0d12b155 authored by erwan's avatar erwan
Browse files

more work on -rte

parent 33110858
No related branches found
No related tags found
No related merge requests found
Pipeline #168157 failed
(* Time-stamp: <modified the 17/11/2023 (at 10:41) by Erwan Jahier> *) (* Time-stamp: <modified the 19/01/2024 (at 10:48) by Erwan Jahier> *)
(* (*
This module is used both for This module is used both for
...@@ -55,7 +55,6 @@ let rec is_a_tuple (e:Lic.val_exp) : bool = ...@@ -55,7 +55,6 @@ let rec is_a_tuple (e:Lic.val_exp) : bool =
| CallByPosLic ({ it = TUPLE ; _ }, vel) -> List.length vel > 1 | CallByPosLic ({ it = TUPLE ; _ }, vel) -> List.length vel > 1
| _ -> false | _ -> false
(******************************************************************************) (******************************************************************************)
let string_of_ident forprint x = let string_of_ident forprint x =
if global_opt.kcg then if global_opt.kcg then
...@@ -66,6 +65,10 @@ let string_of_ident forprint x = ...@@ -66,6 +65,10 @@ let string_of_ident forprint x =
else Lv6Id.string_of_long forprint x else Lv6Id.string_of_long forprint x
let (machine_int: string -> bool) = function
| "int8" | "int16" | "int32" | "int64" -> true
| _ -> false
(* the flag forprint controls whether those functions are used for printing (* the flag forprint controls whether those functions are used for printing
into a file or not (i.e. for internal use) *) into a file or not (i.e. for internal use) *)
...@@ -193,10 +196,10 @@ and string_of_type_eff forprint = function ...@@ -193,10 +196,10 @@ and string_of_type_eff forprint = function
| Bool_type_eff -> "bool" | Bool_type_eff -> "bool"
| Int_type_eff -> | Int_type_eff ->
(* XXX ne marche que pour les entiers !! *) (* XXX for integers only! *)
(match global_opt.rte with (match global_opt.rte with
| Some str -> sprintf "%s" str | Some str -> sprintf "%s" str
| None -> "int") | None -> "int")
| Real_type_eff -> "real" | Real_type_eff -> "real"
...@@ -446,7 +449,8 @@ and (array_of_size_one : Lic.val_exp -> bool) = ...@@ -446,7 +449,8 @@ and (array_of_size_one : Lic.val_exp -> bool) =
| {ve_typ= [Array_type_eff(Bool_type_eff, size)] ; _ } -> size = 1 | {ve_typ= [Array_type_eff(Bool_type_eff, size)] ; _ } -> size = 1
| {ve_typ= [_];_ } -> true | {ve_typ= [_];_ } -> true
| _ -> false | _ -> false
and (string_of_by_pos_op_eff: bool -> Lic.by_pos_op srcflagged -> Lic.val_exp list -> string) = and (string_of_by_pos_op_eff:
bool -> Lic.by_pos_op srcflagged -> Lic.val_exp list -> string) =
fun forprint posop vel -> fun forprint posop vel ->
let sov ve = string_of_val_exp_eff forprint ve in let sov ve = string_of_val_exp_eff forprint ve in
let tuple vel = (String.concat ", " (List.map (string_of_val_exp_eff forprint) vel)) in let tuple vel = (String.concat ", " (List.map (string_of_val_exp_eff forprint) vel)) in
...@@ -490,9 +494,18 @@ and (string_of_by_pos_op_eff: bool -> Lic.by_pos_op srcflagged -> Lic.val_exp li ...@@ -490,9 +494,18 @@ and (string_of_by_pos_op_eff: bool -> Lic.by_pos_op srcflagged -> Lic.val_exp li
if AstPredef.is_a_predef_op (snd(fst op.it)) then if AstPredef.is_a_predef_op (snd(fst op.it)) then
let op_str = snd (fst op.it) in let op_str = snd (fst op.it) in
let op_short_str,rte = match global_opt.rte, op_str with let op_short_str,rte = match global_opt.rte, op_str with
| Some _,("plus"|"slash"|"minus"|"uminus"|"times"|"iplus" | Some _, ("plus"|"slash"|"minus"|"uminus"|"times"|"iplus"
|"islash"|"iminus"|"iuminus"|"itimes"|"mod" |"islash"|"iminus"|"iuminus"|"itimes"|"mod"
|"div") -> "rte_" ^ op_str, true |"div") -> (
try
let ve = List.hd vel in
(match ve.ve_typ with
| (External_type_eff(_,mint))::_ ->
"rte_" ^ op_str ^"_"^mint, true
| _ -> assert false (* SNO *)
)
with _ -> assert false (* SNO *)
)
| _,_ -> op2string (AstPredef.string_to_op op_str), false | _,_ -> op2string (AstPredef.string_to_op op_str), false
in in
if AstPredef.is_infix (AstPredef.string_to_op op_str) if AstPredef.is_infix (AstPredef.string_to_op op_str)
...@@ -510,14 +523,19 @@ and (string_of_by_pos_op_eff: bool -> Lic.by_pos_op srcflagged -> Lic.val_exp li ...@@ -510,14 +523,19 @@ and (string_of_by_pos_op_eff: bool -> Lic.by_pos_op srcflagged -> Lic.val_exp li
) )
) )
else else
let rte = global_opt.rte <> None in
let nk = op.it in let nk = op.it in
let vel_str = tuple_par vel in let vel_str = tuple_par vel in
assert(vel_str<>""); (* SNO *) assert(vel_str<>""); (* SNO *)
let vel_str = if vel_str.[0] <> '(' then "("^vel_str^")" else vel_str in let vel_str_par = if vel_str.[0] <> '(' then "("^vel_str^")" else vel_str in
if global_opt.lv4 || global_opt.inline_iterator then if global_opt.lv4 || global_opt.inline_iterator then
((string_of_node_key_rec forprint global_opt.no_prefix nk) ^ vel_str) let node_str = string_of_node_key_rec forprint global_opt.no_prefix nk in
if rte && machine_int node_str then
"("^node_str ^ " " ^ vel_str ^ ")"
else
node_str ^ vel_str_par
else else
((string_of_node_key forprint nk) ^ vel_str) ((string_of_node_key forprint nk) ^ vel_str_par)
) )
| CONST_REF idl, _ -> dump_long forprint idl | CONST_REF idl, _ -> dump_long forprint idl
| VAR_REF id, _ -> id | VAR_REF id, _ -> id
......
(* Time-stamp: <modified the 16/11/2023 (at 14:15) by Erwan Jahier> *) (* Time-stamp: <modified the 19/01/2024 (at 10:47) by Erwan Jahier> *)
(* (*
Le manager d'argument adapt de celui de lutin, plus joli 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, N.B. solution un peu batarde : les options sont stockes, comme avant, dans Global,
...@@ -347,20 +347,20 @@ let mkoptab (opt:t) : unit = ( ...@@ -347,20 +347,20 @@ let mkoptab (opt:t) : unit = (
mkopt opt ~doc_level:Advanced mkopt opt ~doc_level:Advanced
["-ocaml"] ["-ocaml"]
(Arg.Unit(function () -> opt.gen_ocaml <- true)) (Arg.Unit(function () -> opt.gen_ocaml <- true))
["Generate ocaml glue code that makes it possible to call the lv6 interpreter "; ["Generate ocaml glue code that makes it possible to call the lv6 interpreter";
"from ocaml with the current set of arguments (with Lv6Run.make)"] "from ocaml with the current set of arguments (with Lv6Run.make)"]
; ;
mkopt opt ~doc_level:Dev mkopt opt ~doc_level:Dev
["-knc"; "--keep-nested-calls"] ["-knc"; "--keep-nested-calls"]
(Arg.Unit (fun _ -> global_opt.one_op_per_equation_set <- true; global_opt.one_op_per_equation <- false)) (Arg.Unit (fun _ -> global_opt.one_op_per_equation_set <- true; global_opt.one_op_per_equation <- false))
["Keep nested calls (use with care: it breaks some programs with "; ["Keep nested calls (use with care: it breaks some programs with";
"some options combination)"] "some options combination)"]
; ;
mkopt opt ~doc_level:Dev mkopt opt ~doc_level:Dev
["-knpc"; "--keep-nested-predef-calls"] ["-knpc"; "--keep-nested-predef-calls"]
(Arg.Unit (fun _ -> global_opt.one_user_op_per_equation_set <- true; global_opt.one_user_op_per_equation <- false)) (Arg.Unit (fun _ -> global_opt.one_user_op_per_equation_set <- true; global_opt.one_user_op_per_equation <- false))
["Keep nested calls for predefined operators (use with care: it breaks some programs with "; ["Keep nested calls for predefined operators (use with care: it breaks some programs with";
"some options combination)"] "some options combination)"]
; ;
mkopt opt ~doc_level:Dev mkopt opt ~doc_level:Dev
...@@ -371,7 +371,7 @@ let mkoptab (opt:t) : unit = ( ...@@ -371,7 +371,7 @@ let mkoptab (opt:t) : unit = (
mkopt opt ~doc_level:Advanced mkopt opt ~doc_level:Advanced
["--when-on-ident"] ["--when-on-ident"]
(Arg.Unit (fun _ -> global_opt.when_on_ident <- true)) (Arg.Unit (fun _ -> global_opt.when_on_ident <- true))
["Invent ident names so that when only operates on idents (to be able "; ["Invent ident names so that when only operates on idents (to be able";
"to translate enums into ec/v4)"] "to translate enums into ec/v4)"]
; ;
mkopt opt ~doc_level:Advanced mkopt opt ~doc_level:Advanced
...@@ -417,7 +417,7 @@ let mkoptab (opt:t) : unit = ( ...@@ -417,7 +417,7 @@ let mkoptab (opt:t) : unit = (
["-et"; "--expand-io-type"] ["-et"; "--expand-io-type"]
(Arg.Unit (fun _ -> opt.expand_io_type <- true)) (Arg.Unit (fun _ -> opt.expand_io_type <- true))
["Expand structured types of the main node (impact the rif output only)."; ["Expand structured types of the main node (impact the rif output only).";
"Necessary to use lurette and rdbg in presence of lutin (that only "; "Necessary to use lurette and rdbg in presence of lutin (that only";
"knows about basic the types int/bool/real)" ] "knows about basic the types int/bool/real)" ]
; ;
mkopt opt ~doc_level:Advanced mkopt opt ~doc_level:Advanced
...@@ -441,7 +441,7 @@ let mkoptab (opt:t) : unit = ( ...@@ -441,7 +441,7 @@ let mkoptab (opt:t) : unit = (
mkopt opt ~doc_level:Advanced mkopt opt ~doc_level:Advanced
["-rte"; "--runtime-error"] ["-rte"; "--runtime-error"]
(Arg.String (fun str -> global_opt.rte <- Some str; set_v4_options opt)) (Arg.String (fun str -> global_opt.rte <- Some str; set_v4_options opt))
["Generate kind2 contracts to check for runtime errors (force '-lv4')"] ["Experimental: Generate kind2 contracts to check for runtime errors (force '-lv4')"]
; ;
mkopt opt ~doc_level:Dev mkopt opt ~doc_level:Dev
["-kcg"; "--generate-scade-lustre"] ["-kcg"; "--generate-scade-lustre"]
...@@ -633,7 +633,7 @@ let mkoptab (opt:t) : unit = ( ...@@ -633,7 +633,7 @@ let mkoptab (opt:t) : unit = (
(Arg.Unit (fun () -> (Arg.Unit (fun () ->
if not global_opt.one_op_per_equation_set then global_opt.one_op_per_equation <- true; if not global_opt.one_op_per_equation_set then global_opt.one_op_per_equation <- true;
global_opt.gen_autotest <- true)) global_opt.gen_autotest <- true))
["Generate a Lutin Stimulator and a Lustre oracle to compare the "; ["Generate a Lutin Stimulator and a Lustre oracle to compare the";
"result of 2 Lustre compilers"] "result of 2 Lustre compilers"]
; ;
(* misc debug flag *) (* misc debug flag *)
......
==> lus2lic0.sum <== ==> lus2lic0.sum <==
Test run by jahier on Wed Nov 22 16:23:11 Test run by jahier on Fri Jan 19 10:44:11
Native configuration is x86_64-pc-linux-gnu Native configuration is x86_64-pc-linux-gnu
=== lus2lic0 tests === === lus2lic0 tests ===
...@@ -66,7 +66,7 @@ XFAIL: Test bad programs (assert): test_lus2lic_no_node should_fail/assert/lecte ...@@ -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 XFAIL: Test bad programs (assert): test_lus2lic_no_node should_fail/assert/s.lus
==> lus2lic1.sum <== ==> lus2lic1.sum <==
Test run by jahier on Wed Nov 22 16:23:13 Test run by jahier on Fri Jan 19 10:44:13
Native configuration is x86_64-pc-linux-gnu Native configuration is x86_64-pc-linux-gnu
=== lus2lic1 tests === === lus2lic1 tests ===
...@@ -631,7 +631,7 @@ PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c multipar.lus {} ...@@ -631,7 +631,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 {} PASS: /home/jahier/lus2lic/test/../utils/compare_lv6_and_lv6_en multipar.lus {}
==> lus2lic2.sum <== ==> lus2lic2.sum <==
Test run by jahier on Wed Nov 22 16:31:14 Test run by jahier on Fri Jan 19 10:50:58
Native configuration is x86_64-pc-linux-gnu Native configuration is x86_64-pc-linux-gnu
=== lus2lic2 tests === === lus2lic2 tests ===
...@@ -1177,7 +1177,7 @@ PASS: /home/jahier/lus2lic/test/../utils/compare_lv6_and_lv6_en zzz2.lus {} ...@@ -1177,7 +1177,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 {} PASS: /home/jahier/lus2lic/test/../utils/compare_gcc_and_clang zzz2.lus {}
==> lus2lic3.sum <== ==> lus2lic3.sum <==
Test run by jahier on Wed Nov 22 16:39:30 Test run by jahier on Fri Jan 19 10:57:57
Native configuration is x86_64-pc-linux-gnu Native configuration is x86_64-pc-linux-gnu
=== lus2lic3 tests === === lus2lic3 tests ===
...@@ -1696,7 +1696,7 @@ PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node multipar.lus {} ...@@ -1696,7 +1696,7 @@ PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node multipar.lus {}
==> lus2lic4.sum <== ==> lus2lic4.sum <==
Test run by jahier on Wed Nov 22 16:41:03 Test run by jahier on Fri Jan 19 10:59:36
Native configuration is x86_64-pc-linux-gnu Native configuration is x86_64-pc-linux-gnu
=== lus2lic4 tests === === lus2lic4 tests ===
...@@ -2224,11 +2224,11 @@ PASS: /home/jahier/lus2lic/test/../utils/compare_gcc_and_clang multipar.lus {} ...@@ -2224,11 +2224,11 @@ PASS: /home/jahier/lus2lic/test/../utils/compare_gcc_and_clang multipar.lus {}
=============================== ===============================
# Total number of failures: 17 # Total number of failures: 17
lus2lic0.log:testcase ./lus2lic.tests/test0.exp completed in 2 seconds lus2lic0.log:testcase ./lus2lic.tests/test0.exp completed in 2 seconds
lus2lic1.log:testcase ./lus2lic.tests/test1.exp completed in 481 seconds lus2lic1.log:testcase ./lus2lic.tests/test1.exp completed in 405 seconds
lus2lic2.log:testcase ./lus2lic.tests/test2.exp completed in 496 seconds lus2lic2.log:testcase ./lus2lic.tests/test2.exp completed in 419 seconds
lus2lic3.log:testcase ./lus2lic.tests/test3.exp completed in 93 seconds lus2lic3.log:testcase ./lus2lic.tests/test3.exp completed in 99 seconds
lus2lic4.log:testcase ./lus2lic.tests/test4.exp completed in 78 seconds lus2lic4.log:testcase ./lus2lic.tests/test4.exp completed in 64 seconds
* Ref time: * Ref time:
393.11user 106.70system 19:09.76elapsed 43%CPU (0avgtext+0avgdata 99572maxresident)k 340.47user 100.85system 16:29.39elapsed 44%CPU (0avgtext+0avgdata 99380maxresident)k
32inputs+584392outputs (5major+20959490minor)pagefaults 0swaps 259048inputs+585872outputs (1332major+20958893minor)pagefaults 0swaps
* Quick time (-j 4): * Quick time (-j 4):
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment