diff --git a/release-lv6/Makefile b/release-lv6/Makefile index bd14b9f8dce4e91a99b23bc982dbb58dcb1c5942..5fc91286a7f0c729b069416d42e1ac0047e20bac 100644 --- a/release-lv6/Makefile +++ b/release-lv6/Makefile @@ -22,7 +22,11 @@ doc: cp ~/slides/lv6/*.pdf $(RELNAME)/doc lus2lic: - cd $(LUS2LICDIR)/src ; make + cd $(LUS2LICDIR)/src ; make nc + cp $(LUS2LIC) $(RELNAME)/bin/ + +lus2licbc: + cd $(LUS2LICDIR)/src ; make bc cp $(LUS2LIC) $(RELNAME)/bin/ lic2c: @@ -36,13 +40,16 @@ test_files: cp $$f $(RELNAME)/test/; \ done -# ($(RELNAME)/bin/lic2c --out-format loc /tmp/xx.lus > /dev/null || (echo "*** lic2c $$f failed" ; exit 1)) && \ +# ($(RELNAME)/bin/lic2c --out-format loc /tmp/xx.lus > /dev/null || (echo "*** lic2c $$f failed" ; exit 1)) && + + $(RELNAME).tgz: tar cvfz $(RELNAME).tgz $(RELNAME) WWW_DIR=/usr/local/www/DIST-TOOLS/SYNCHRONE/lustre-v6 www: $(RELNAME).tgz cp $(RELNAME).tgz $(WWW_DIR) + cp $(LUS2LICDIR)/lv6-ref-man/lv6-ref-man.pdf $(WWW_DIR)/doc/ verimag: diff --git a/src/lazyCompiler.ml b/src/lazyCompiler.ml index 9b10147cade1782b81722e397a7f1922f846e305..7513cbb7981a5b439fb0f8346c3a5196d70a16ba 100644 --- a/src/lazyCompiler.ml +++ b/src/lazyCompiler.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 13/04/2010 (at 18:12) by Erwan Jahier> *) +(** Time-stamp: <modified the 14/04/2010 (at 14:43) by Erwan Jahier> *) open Lxm @@ -1001,11 +1001,15 @@ and (node_check_do: t -> Eff.node_key -> Lxm.t -> SymbolTab.t -> in let res_struct = if - !Global.expand_structs + (!Global.expand_structs && not (res.is_polym_eff) && ((not !Global.expand_nodes) || is_main_node) (* it is useless otherwise *) + ) || is_extern_oper then - StructArrayExpand.node node_id_solver local_env res + ( + Verbose.printf ~level:3 "-- Expand node %s \n" (Ident.long_to_string (fst nk)); + StructArrayExpand.node node_id_solver local_env res + ) else res in @@ -1014,7 +1018,7 @@ and (node_check_do: t -> Eff.node_key -> Lxm.t -> SymbolTab.t -> ( if not !Global.expand_nodes || is_extern_oper || is_main_node then if res.is_polym_eff then - Polymorphism.push_on_polymorphic_node_stack (node_id_solver,local_env,res) + Polymorphism.push_on_polymorphic_node_stack (node_id_solver,local_env,res_struct) else let str = LicDump.node_of_node_exp_eff res_struct in output_string !Global.oc str diff --git a/src/nodesExpand.ml b/src/nodesExpand.ml index 68f9ec69c1f5e243e4144833430dd429b20f7d48..a51c66b6333fd20217ab64af6fc3e53226fb461f 100644 --- a/src/nodesExpand.ml +++ b/src/nodesExpand.ml @@ -1,71 +1,5 @@ -(** Time-stamp: <modified the 13/05/2009 (at 16:24) by Erwan Jahier> *) +(** Time-stamp: <modified the 14/04/2010 (at 11:19) by Erwan Jahier> *) -(** - nb : only user nodes are expanded. - - Expand nodes: - ------------ - - if n is a node defined as follows - - node n(x,y) returns(a,b); - var v1,v2; - let - v1 = x+y; - v2 = x*y; - a = v1*x; - b = v2*y; - tel - - equations such as : - - o1,o2 = n(i1, i2); - - becomes - - h1 = i1+i2; - h2 = i1*i2; - o1 = h1*i1; - o2 = h2*i2; - - where h1 and h2 are fresh local vars - - In other terms, we need to - - create a fresh local var for each local var of n - - take all the equations of n, and substitute - - the inputs parameters by intput args - - the outputs parameters by lhs list - - the local vars by the fresh local var names - - - nb : to simplify, for equations like - - f.a = n(t[1], 3); - - we first create fresh vars for "f.a", "t[1]", and "3" - - _v1 = t[1]; - _v2 = 3; - f.a = _v3; - _v3 = n(_v1,_v2); - - and then we apply the transformation - - Expand assertions: - ----------------- - - In order to deal with assertions on nodes, i.e., of the form - - assert (n(i1,i2)); - - we first transform it into - - assert_var = n(i1,i2); - assert(assert_var); - - where assert_var is a fresh bool local var, and we apply the transformation - on the first equation. - *) open Lxm open Eff diff --git a/src/nodesExpand.mli b/src/nodesExpand.mli index 3fb1a12c59a840d2b214812852a8e57c0019045e..5b3cb7d31f17b06cd4b43c3beb77edd26f10d774 100644 --- a/src/nodesExpand.mli +++ b/src/nodesExpand.mli @@ -1,5 +1,71 @@ -(** Time-stamp: <modified the 08/01/2009 (at 14:59) by Erwan Jahier> *) +(** Time-stamp: <modified the 14/04/2010 (at 11:19) by Erwan Jahier> *) +(** + nb : only user nodes are expanded. + + Expand nodes: + ------------ + + if n is a node defined as follows + + node n(x,y) returns(a,b); + var v1,v2; + let + v1 = x+y; + v2 = x*y; + a = v1*x; + b = v2*y; + tel + + equations such as : + + o1,o2 = n(i1, i2); + + becomes + + h1 = i1+i2; + h2 = i1*i2; + o1 = h1*i1; + o2 = h2*i2; + + where h1 and h2 are fresh local vars + + In other terms, we need to + - create a fresh local var for each local var of n + - take all the equations of n, and substitute + - the inputs parameters by intput args + - the outputs parameters by lhs list + - the local vars by the fresh local var names + + + nb : to simplify, for equations like + + f.a = n(t[1], 3); + + we first create fresh vars for "f.a", "t[1]", and "3" + + _v1 = t[1]; + _v2 = 3; + f.a = _v3; + _v3 = n(_v1,_v2); + + and then we apply the transformation + + Expand assertions: + ----------------- + + In order to deal with assertions on nodes, i.e., of the form + + assert (n(i1,i2)); + + we first transform it into + + assert_var = n(i1,i2); + assert(assert_var); + + where assert_var is a fresh bool local var, and we apply the transformation + on the first equation. + *) val f : Eff.local_env -> Eff.node_exp -> Eff.node_exp diff --git a/src/structArrayExpand.ml b/src/structArrayExpand.ml index b5652f7b099a3d29708d11cd400fb5631173e7aa..9178fc0c153a95459c3a3a8183987c796ec6c4cf 100644 --- a/src/structArrayExpand.ml +++ b/src/structArrayExpand.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 08/04/2010 (at 17:23) by Erwan Jahier> *) +(** Time-stamp: <modified the 14/04/2010 (at 14:28) by Erwan Jahier> *) (* Replace structures and arrays by as many variables as necessary. Since structures can be recursive, it migth be a lot of new variables... @@ -553,33 +553,36 @@ and (expand_var_info: Eff.local_env -> Eff.id_solver -> var_info list * acc -> let rec (node : Eff.id_solver -> Eff.local_env -> Eff.node_exp -> Eff.node_exp) = fun is n_env n -> - match n.def_eff with - | ExternEff - | AbstractEff None -> n - | AbstractEff (Some pn) -> - { n with def_eff = AbstractEff (Some (node is n_env pn)) } - | BodyEff b -> - let loclist = match n.loclist_eff with None -> [] | Some l -> l in - let inlist = n.inlist_eff in - let outlist = n.outlist_eff in - let acc = ([],[],[]) in - let inlist, acc = List.fold_left (expand_var_info n_env is) ([],acc) inlist in - let outlist, acc = List.fold_left (expand_var_info n_env is) ([],acc) outlist in - let loclist, acc = List.fold_left (expand_var_info n_env is) ([],acc) loclist in - let acc = List.fold_left (expand_eq n_env is) acc b.eqs_eff in - let acc = List.fold_left (expand_assert n_env is) acc b.asserts_eff in - let (asserts,neqs, nv) = acc in - let nb = { - eqs_eff = neqs ; - asserts_eff = asserts - } - in - let res = - { n with - inlist_eff = List.rev inlist; - outlist_eff = List.rev outlist; - loclist_eff = Some (List.rev_append loclist nv); - def_eff = BodyEff nb - } - in - res + + let inlist = n.inlist_eff in + let outlist = n.outlist_eff in + let acc = ([],[],[]) in + let inlist, acc = List.fold_left (expand_var_info n_env is) ([],acc) inlist in + let outlist, acc = List.fold_left (expand_var_info n_env is) ([],acc) outlist in + let n = + match n.def_eff with + | ExternEff + | AbstractEff None -> n + | AbstractEff (Some pn) -> + { n with def_eff = AbstractEff (Some (node is n_env pn)) } + | BodyEff b -> + let loclist = match n.loclist_eff with None -> [] | Some l -> l in + let loclist, acc = List.fold_left (expand_var_info n_env is) ([],acc) loclist in + let acc = List.fold_left (expand_eq n_env is) acc b.eqs_eff in + let acc = List.fold_left (expand_assert n_env is) acc b.asserts_eff in + let (asserts,neqs, nv) = acc in + let nb = { + eqs_eff = neqs ; + asserts_eff = asserts + } + in + { n with + loclist_eff = Some (List.rev_append loclist nv); + def_eff = BodyEff nb + } + in + { n with + inlist_eff = List.rev inlist; + outlist_eff = List.rev outlist; + } + diff --git a/src/test/test.res.exp b/src/test/test.res.exp index 4dba58835b97e0ef0587153fe41d8c32d3fd8a32..cac0669f359a8c7602bb4699c3603797ffc9159e 100644 --- a/src/test/test.res.exp +++ b/src/test/test.res.exp @@ -11893,18 +11893,77 @@ extern function decl::f1( b1:_decl::couleur; c1:_decl::couleur) returns ( - d1:A_bool_2); + d1_0:bool; + d1_1:bool); extern node decl::n2( - a1:A__decl::t1_8; - b1:A__decl::t1_8; - c1:A__decl::t1_8; + a1_0:_decl::t1; + a1_1:_decl::t1; + a1_2:_decl::t1; + a1_3:_decl::t1; + a1_4:_decl::t1; + a1_5:_decl::t1; + a1_6:_decl::t1; + a1_7:_decl::t1; + b1_0:_decl::t1; + b1_1:_decl::t1; + b1_2:_decl::t1; + b1_3:_decl::t1; + b1_4:_decl::t1; + b1_5:_decl::t1; + b1_6:_decl::t1; + b1_7:_decl::t1; + c1_0:_decl::t1; + c1_1:_decl::t1; + c1_2:_decl::t1; + c1_3:_decl::t1; + c1_4:_decl::t1; + c1_5:_decl::t1; + c1_6:_decl::t1; + c1_7:_decl::t1; d1:bool) returns ( - e1:A_A__decl::t1_8_5); + e1_0_0:_decl::t1; + e1_0_1:_decl::t1; + e1_0_2:_decl::t1; + e1_0_3:_decl::t1; + e1_0_4:_decl::t1; + e1_0_5:_decl::t1; + e1_0_6:_decl::t1; + e1_0_7:_decl::t1; + e1_1_0:_decl::t1; + e1_1_1:_decl::t1; + e1_1_2:_decl::t1; + e1_1_3:_decl::t1; + e1_1_4:_decl::t1; + e1_1_5:_decl::t1; + e1_1_6:_decl::t1; + e1_1_7:_decl::t1; + e1_2_0:_decl::t1; + e1_2_1:_decl::t1; + e1_2_2:_decl::t1; + e1_2_3:_decl::t1; + e1_2_4:_decl::t1; + e1_2_5:_decl::t1; + e1_2_6:_decl::t1; + e1_2_7:_decl::t1; + e1_3_0:_decl::t1; + e1_3_1:_decl::t1; + e1_3_2:_decl::t1; + e1_3_3:_decl::t1; + e1_3_4:_decl::t1; + e1_3_5:_decl::t1; + e1_3_6:_decl::t1; + e1_3_7:_decl::t1; + e1_4_0:_decl::t1; + e1_4_1:_decl::t1; + e1_4_2:_decl::t1; + e1_4_3:_decl::t1; + e1_4_4:_decl::t1; + e1_4_5:_decl::t1; + e1_4_6:_decl::t1; + e1_4_7:_decl::t1); -- automatically defined aliases: -type A_A__decl::t1_8_5 = A__decl::t1_8^5; -type A_bool_2 = bool^2; type A__decl::t1_8 = _decl::t1^8; ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 should_work/demo/declaration.lus @@ -11937,7 +11996,8 @@ extern function declaration::f1( b1:_declaration::couleur; c1:_declaration::couleur) returns ( - d1:A_bool_2); + d1_0:bool; + d1_1:bool); extern node declaration::n1( a1:_declaration::t1; @@ -11947,12 +12007,72 @@ returns ( d1:bool); extern node declaration::n2( - a1:A__declaration::t1_8; - b1:A__declaration::t1_8; - c1:A__declaration::t1_8; + a1_0:_declaration::t1; + a1_1:_declaration::t1; + a1_2:_declaration::t1; + a1_3:_declaration::t1; + a1_4:_declaration::t1; + a1_5:_declaration::t1; + a1_6:_declaration::t1; + a1_7:_declaration::t1; + b1_0:_declaration::t1; + b1_1:_declaration::t1; + b1_2:_declaration::t1; + b1_3:_declaration::t1; + b1_4:_declaration::t1; + b1_5:_declaration::t1; + b1_6:_declaration::t1; + b1_7:_declaration::t1; + c1_0:_declaration::t1; + c1_1:_declaration::t1; + c1_2:_declaration::t1; + c1_3:_declaration::t1; + c1_4:_declaration::t1; + c1_5:_declaration::t1; + c1_6:_declaration::t1; + c1_7:_declaration::t1; d1:bool) returns ( - e1:A_A__declaration::t1_8_5); + e1_0_0:_declaration::t1; + e1_0_1:_declaration::t1; + e1_0_2:_declaration::t1; + e1_0_3:_declaration::t1; + e1_0_4:_declaration::t1; + e1_0_5:_declaration::t1; + e1_0_6:_declaration::t1; + e1_0_7:_declaration::t1; + e1_1_0:_declaration::t1; + e1_1_1:_declaration::t1; + e1_1_2:_declaration::t1; + e1_1_3:_declaration::t1; + e1_1_4:_declaration::t1; + e1_1_5:_declaration::t1; + e1_1_6:_declaration::t1; + e1_1_7:_declaration::t1; + e1_2_0:_declaration::t1; + e1_2_1:_declaration::t1; + e1_2_2:_declaration::t1; + e1_2_3:_declaration::t1; + e1_2_4:_declaration::t1; + e1_2_5:_declaration::t1; + e1_2_6:_declaration::t1; + e1_2_7:_declaration::t1; + e1_3_0:_declaration::t1; + e1_3_1:_declaration::t1; + e1_3_2:_declaration::t1; + e1_3_3:_declaration::t1; + e1_3_4:_declaration::t1; + e1_3_5:_declaration::t1; + e1_3_6:_declaration::t1; + e1_3_7:_declaration::t1; + e1_4_0:_declaration::t1; + e1_4_1:_declaration::t1; + e1_4_2:_declaration::t1; + e1_4_3:_declaration::t1; + e1_4_4:_declaration::t1; + e1_4_5:_declaration::t1; + e1_4_6:_declaration::t1; + e1_4_7:_declaration::t1); node declaration::n4(a1:bool) returns (b1:bool); var c1:bool; @@ -11974,8 +12094,6 @@ let tel -- end of node declaration::n5 -- automatically defined aliases: -type A_A__declaration::t1_8_5 = A__declaration::t1_8^5; -type A_bool_2 = bool^2; type A__declaration::t1_8 = _declaration::t1^8; ---------------------------------------------------------------------- ====> ../lus2lic -vl 2 should_work/demo/def.lus