Ported schedule

This commit is contained in:
Cédric Pasteur 2010-06-18 12:02:39 +02:00
parent 50a0768a24
commit f6d4a0f5d1
2 changed files with 14 additions and 18 deletions

View file

@ -208,6 +208,7 @@ struct
let rec read is_left acc e = let rec read is_left acc e =
let acc = let acc =
match e.e_desc with match e.e_desc with
| Evar n -> add n acc
| Emerge(x, c_e_list) -> | Emerge(x, c_e_list) ->
let acc = add x acc in let acc = add x acc in
List.fold_left (fun acc (_, e) -> read is_left acc e) acc c_e_list List.fold_left (fun acc (_, e) -> read is_left acc e) acc c_e_list
@ -292,15 +293,13 @@ struct
| _ -> [] | _ -> []
end end
(*
(* data-flow dependences. pre-dependences are discarded *) (* data-flow dependences. pre-dependences are discarded *)
module DataFlowDep = Make module DataFlowDep = Make
(struct (struct
type equation = eq type equation = eq
let read eq = Vars.read true eq let read eq = Vars.read true eq
let def = Vars.def let def = Vars.def
let linear_read eq = Vars.linear_use [] eq.eq_rhs
let mem_reset = Vars.mem_reset
let antidep = Vars.antidep let antidep = Vars.antidep
end) end)
@ -309,10 +308,7 @@ module AllDep = Make
(struct (struct
type equation = eq type equation = eq
let read eq = Vars.read false eq let read eq = Vars.read false eq
let linear_read eq = Vars.linear_use [] eq.eq_rhs
let mem_reset = Vars.mem_reset
let def = Vars.def let def = Vars.def
let antidep eq = false let antidep eq = false
end) end)
*)

View file

@ -51,27 +51,27 @@ let schedule eq_list =
try try
insert node node_list insert node node_list
with with
Not_found -> node :: node_list Not_found -> node :: node_list
and insert node = function and insert node = function
| [] -> raise Not_found | [] -> raise Not_found
| node1 :: node_list -> | node1 :: node_list ->
if linked node node1 then raise Not_found if linked node node1 then raise Not_found
else else
try try
node1 :: (insert node node_list) node1 :: (insert node node_list)
with with
| Not_found -> | Not_found ->
if join (containt node) (containt node1) if join (containt node) (containt node1)
then node :: node1 :: node_list then node :: node1 :: node_list
else raise Not_found in else raise Not_found in
let node_list, _ = DataFlowDep.build eq_list in let node_list, _ = DataFlowDep.build eq_list in
let node_list = recook (topological node_list) in let node_list = recook (topological node_list) in
let node_list = List.rev node_list in let node_list = List.rev node_list in
let node_list = recook node_list in let node_list = recook node_list in
let node_list = List.rev node_list in let node_list = List.rev node_list in
List.map containt node_list List.map containt node_list
let schedule_contract ({ c_eq = eqs } as c) = let schedule_contract ({ c_eq = eqs } as c) =
let eqs = schedule eqs in let eqs = schedule eqs in