Skip to content
Snippets Groups Projects
Commit 3021ae78 authored by Erwan Jahier's avatar Erwan Jahier
Browse files

Simplify a little bit the code in split.ml

parent 096e4e36
No related branches found
No related tags found
No related merge requests found
(** Time-stamp: <modified the 20/08/2008 (at 09:48) by Erwan Jahier> *) (** Time-stamp: <modified the 20/08/2008 (at 11:37) by Erwan Jahier> *)
open Lxm open Lxm
...@@ -52,14 +52,25 @@ and (split_val_exp : bool -> val_exp_eff -> val_exp_eff * split_acc) = ...@@ -52,14 +52,25 @@ and (split_val_exp : bool -> val_exp_eff -> val_exp_eff * split_acc) =
| CallByPosEff(by_pos_op_eff, OperEff vel) -> | CallByPosEff(by_pos_op_eff, OperEff vel) ->
(* recursively split the arguments *) (* recursively split the arguments *)
let (vel,(eql,vl)) = let lxm = by_pos_op_eff.src in
let (rhs, vel, (eql,vl)) =
match by_pos_op_eff.it with match by_pos_op_eff.it with
| WITH_eff(ve) | WITH_eff(ve) ->
| HAT_eff (_,ve) ->
let ve, (eql, vl) = split_val_exp false ve in let ve, (eql, vl) = split_val_exp false ve in
[ve], (eql, vl) let by_pos_op_eff = Lxm.flagit (WITH_eff(ve)) lxm in
let rhs = CallByPosEff(by_pos_op_eff, OperEff []) in
rhs, [ve], (eql, vl)
| HAT_eff (i,ve) ->
let ve, (eql, vl) = split_val_exp false ve in
let by_pos_op_eff = Lxm.flagit (HAT_eff(i, ve)) lxm in
let rhs = CallByPosEff(by_pos_op_eff, OperEff []) in
rhs, [ve], (eql, vl)
| _ -> | _ ->
split_val_exp_list false vel let vel, (eql, vl) = split_val_exp_list false vel in
let rhs = CallByPosEff(by_pos_op_eff, OperEff vel) in
rhs, vel, (eql, vl)
in in
if top_level then if top_level then
CallByPosEff(by_pos_op_eff, OperEff vel), (eql, vl) CallByPosEff(by_pos_op_eff, OperEff vel), (eql, vl)
...@@ -69,7 +80,6 @@ and (split_val_exp : bool -> val_exp_eff -> val_exp_eff * split_acc) = ...@@ -69,7 +80,6 @@ and (split_val_exp : bool -> val_exp_eff -> val_exp_eff * split_acc) =
let typ_l = EvalType.val_exp_eff ve in let typ_l = EvalType.val_exp_eff ve in
let nv_l = List.map2 new_var typ_l clk_l in let nv_l = List.map2 new_var typ_l clk_l in
let lxm = by_pos_op_eff.src in
let nve = match nv_l with let nve = match nv_l with
| [nv] -> CallByPosEff( | [nv] -> CallByPosEff(
Lxm.flagit (IDENT_eff (Ident.to_idref nv.var_name_eff)) lxm, Lxm.flagit (IDENT_eff (Ident.to_idref nv.var_name_eff)) lxm,
...@@ -90,17 +100,7 @@ and (split_val_exp : bool -> val_exp_eff -> val_exp_eff * split_acc) = ...@@ -90,17 +100,7 @@ and (split_val_exp : bool -> val_exp_eff -> val_exp_eff * split_acc) =
) )
in in
let lpl = List.map (fun nv -> LeftVarEff(nv, lxm)) nv_l in let lpl = List.map (fun nv -> LeftVarEff(nv, lxm)) nv_l in
let rhs =
match by_pos_op_eff.it with
| WITH_eff ve ->
let by_pos_op_eff = Lxm.flagit (WITH_eff (List.hd vel)) lxm in
CallByPosEff(by_pos_op_eff, OperEff [])
| HAT_eff(i,ve) ->
let by_pos_op_eff = Lxm.flagit (HAT_eff(i, List.hd vel)) lxm in
CallByPosEff(by_pos_op_eff, OperEff [])
| _ ->
CallByPosEff(by_pos_op_eff, OperEff vel)
in
let eq = Lxm.flagit (lpl, rhs) lxm in let eq = Lxm.flagit (lpl, rhs) lxm in
nve, (eql@[eq], vl@nv_l) nve, (eql@[eq], vl@nv_l)
......
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