From 557d00f501e4958ebc1fd98c911be7a29ebed7b9 Mon Sep 17 00:00:00 2001 From: Adrien Guatto Date: Fri, 2 Mar 2012 15:43:58 +0100 Subject: [PATCH] Inlining: do not forget when, merge or last. --- compiler/heptagon/transformations/inline.ml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/compiler/heptagon/transformations/inline.ml b/compiler/heptagon/transformations/inline.ml index 994ee7d..263b736 100644 --- a/compiler/heptagon/transformations/inline.ml +++ b/compiler/heptagon/transformations/inline.ml @@ -27,11 +27,19 @@ let mk_unique_node nd = let subst = List.map mk_bind (nd.n_block.b_local @ nd.n_input @ nd.n_output) in - let subst_var_dec _ () vd = - (List.assoc vd.v_ident subst, ()) in - let subst_edesc _ () ed = match ed with - | Evar vn -> (Evar (List.assoc vn subst).v_ident, ()) - | _ -> raise Errors.Fallback in + let subst_var_dec _ () vd = (List.assoc vd.v_ident subst, ()) in + + let subst_edesc funs () ed = + let ed, () = Hept_mapfold.edesc funs () ed in + let find vn = (List.assoc vn subst).v_ident in + (match ed with + | Evar vn -> Evar (find vn) + | Elast vn -> Elast (find vn) + | Ewhen (e, cn, vn) -> Ewhen (e, cn, find vn) + | Emerge (vn, e_l) -> Emerge (find vn, e_l) + | _ -> ed), () + in + let subst_eqdesc funs () eqd = let (eqd, ()) = Hept_mapfold.eqdesc funs () eqd in match eqd with