From 7d9e31a83b918b2dd2ce527884dfd4210a60ac82 Mon Sep 17 00:00:00 2001 From: Adrien Guatto Date: Wed, 6 Jul 2011 09:50:51 +0200 Subject: [PATCH] Tomato checking in check.sh --- compiler/main/mls2obc.ml | 6 +++++- compiler/minils/transformations/tomato.ml | 11 +++++++---- test/check | 9 +++++++++ 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/compiler/main/mls2obc.ml b/compiler/main/mls2obc.ml index 2cf3d78..64993c3 100644 --- a/compiler/main/mls2obc.ml +++ b/compiler/main/mls2obc.ml @@ -40,7 +40,11 @@ let var_from_name map x = begin try Env.find x map with - _ -> assert false + _ -> + Format.eprintf + "Internal compiler error: unknown identifier %a@." + Global_printer.print_ident x; + assert false end let ext_value_exp_from_name map x = diff --git a/compiler/minils/transformations/tomato.ml b/compiler/minils/transformations/tomato.ml index 6fc2f8b..d43f81b 100644 --- a/compiler/minils/transformations/tomato.ml +++ b/compiler/minils/transformations/tomato.ml @@ -400,6 +400,7 @@ and reconstruct_extvalues mapping w_list children = let consume w (children, result_w_list) = let w, children = reconstruct_extvalue w children in + let w = { w with w_ck = reconstruct_clock mapping w.w_ck } in children, w :: result_w_list in @@ -528,13 +529,14 @@ let rec fix_output_var_dec mapping vd (seen, equs, vd_list) = let Info (x, _, _, _) = Env.find vd.v_ident mapping in if IdentSet.mem x seen then - let new_id = gen_var "out" in - let new_vd = { vd with v_ident = new_id; } in + let new_id = vd.v_ident in + let new_clock = reconstruct_clock mapping vd.v_clock in + let new_vd = { vd with v_ident = new_id; v_clock = new_clock } in let new_eq = - let w = mk_extvalue ~ty:vd.v_type ~clock:vd.v_clock (Wvar x) in + let w = mk_extvalue ~ty:vd.v_type ~clock:new_clock (Wvar x) in mk_equation (Evarpat new_id) - (mk_exp vd.v_clock vd.v_type ~ct:(Ck vd.v_clock) ~ck:vd.v_clock (Eextvalue w)) + (mk_exp new_clock vd.v_type ~ct:(Ck new_clock) ~ck:new_clock (Eextvalue w)) in (seen, new_eq :: equs, new_vd :: vd_list) else @@ -566,6 +568,7 @@ let node nd = (* Reconstruct equation list from grouped equivalence classes *) let eq_list = reconstruct (tenv, cenv) mapping in + (* Fix renamed var_decs, and add intermediate equations for fused outputs *) let local = fix_local_var_decs mapping nd.n_local in let eq_list, output = fix_output_var_decs mapping (eq_list, nd.n_output) in diff --git a/test/check b/test/check index 2112888..5871266 100755 --- a/test/check +++ b/test/check @@ -21,6 +21,7 @@ CC="gcc -std=c99 -I../../../lib/c" # par defaut : pas de test de generation de code +tomato=0 java=0 c=0 @@ -207,6 +208,11 @@ activate_c () { coption="$coption -target c" } +activate_tomato () { + tomato=1 + coption="$coption -tomato" +} + activate_all () { activate_java activate_c @@ -232,6 +238,9 @@ while [ $# -gt 0 ]; do "-mls" ) activate_minils shift;; + "-tomato" ) + activate_tomato + shift;; "-h" ) echo "usage : $0 " echo "options : "