Added dependency from a read to a linear read

This got lost along the way when porting memalloc
to the new branch
This commit is contained in:
Cédric Pasteur 2011-09-07 14:14:59 +02:00
parent 53043b403c
commit caa43f163f
2 changed files with 20 additions and 0 deletions

View File

@ -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)

View File

@ -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