From caa43f163f2f0f6f49fb1f13a38d88f71adabfde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Pasteur?= Date: Wed, 7 Sep 2011 14:14:59 +0200 Subject: [PATCH] Added dependency from a read to a linear read This got lost along the way when porting memalloc to the new branch --- compiler/minils/mls_utils.ml | 18 ++++++++++++++++++ compiler/utilities/global/dep.ml | 2 ++ 2 files changed, 20 insertions(+) diff --git a/compiler/minils/mls_utils.ml b/compiler/minils/mls_utils.ml index b102fde..9d386cc 100644 --- a/compiler/minils/mls_utils.ml +++ b/compiler/minils/mls_utils.ml @@ -162,6 +162,22 @@ struct let memory_vars ({ eq_lhs = _; eq_rhs = e } as eq) = match e.e_desc with | Efby(_, _) -> def [] eq | _ -> [] + + let linear_read e = + let extvalue funs acc w = match w.w_desc with + | Wvar x -> + let w, acc = Mls_mapfold.extvalue funs acc w in + let acc = + (match w.w_linearity with + | Linearity.Lat _ -> add x acc + | _ -> acc) + in + w, acc + | _ -> Mls_mapfold.extvalue funs acc w + in + let funs = { Mls_mapfold.defaults with extvalue = extvalue } in + let _, acc = Mls_mapfold.exp_it funs [] e in + acc end (* Assumes normal form, all fby are solo rhs *) @@ -182,6 +198,7 @@ module DataFlowDep = Dep.Make (struct type equation = eq let read eq = Vars.read true eq + let linear_read eq = Vars.linear_read eq.eq_rhs let def = Vars.def let antidep = Vars.antidep end) @@ -191,6 +208,7 @@ module AllDep = Dep.Make (struct type equation = eq let read eq = Vars.read false eq + let linear_read eq = Vars.linear_read eq.eq_rhs let def = Vars.def let antidep _ = false end) diff --git a/compiler/utilities/global/dep.ml b/compiler/utilities/global/dep.ml index 786a7c7..0a36cf8 100644 --- a/compiler/utilities/global/dep.ml +++ b/compiler/utilities/global/dep.ml @@ -15,6 +15,7 @@ module type READ = sig type equation val read: equation -> ident list + val linear_read : equation -> ident list val def: ident list -> equation -> ident list val antidep: equation -> bool end @@ -44,6 +45,7 @@ struct let node_env = nametograph_env g (Read.def [] eq) node_env in let n_to_graph = nametograph g (Read.def [] eq) (Read.antidep eq) n_to_graph in + let n_to_graph = nametograph g (Read.linear_read eq) true n_to_graph in init_graph eqs (g :: g_list) n_to_graph node_env in