Ported schedule
This commit is contained in:
parent
50a0768a24
commit
f6d4a0f5d1
2 changed files with 14 additions and 18 deletions
|
@ -208,6 +208,7 @@ struct
|
|||
let rec read is_left acc e =
|
||||
let acc =
|
||||
match e.e_desc with
|
||||
| Evar n -> add n acc
|
||||
| Emerge(x, c_e_list) ->
|
||||
let acc = add x acc in
|
||||
List.fold_left (fun acc (_, e) -> read is_left acc e) acc c_e_list
|
||||
|
@ -292,15 +293,13 @@ struct
|
|||
| _ -> []
|
||||
end
|
||||
|
||||
(*
|
||||
|
||||
(* data-flow dependences. pre-dependences are discarded *)
|
||||
module DataFlowDep = Make
|
||||
(struct
|
||||
type equation = eq
|
||||
let read eq = Vars.read true eq
|
||||
let def = Vars.def
|
||||
let linear_read eq = Vars.linear_use [] eq.eq_rhs
|
||||
let mem_reset = Vars.mem_reset
|
||||
let antidep = Vars.antidep
|
||||
end)
|
||||
|
||||
|
@ -309,10 +308,7 @@ module AllDep = Make
|
|||
(struct
|
||||
type equation = 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 antidep eq = false
|
||||
end)
|
||||
*)
|
||||
|
||||
|
|
|
@ -46,32 +46,32 @@ let schedule eq_list =
|
|||
let rec recook = function
|
||||
| [] -> []
|
||||
| node :: node_list -> node >> (recook node_list)
|
||||
|
||||
|
||||
and (>>) node node_list =
|
||||
try
|
||||
insert node node_list
|
||||
with
|
||||
Not_found -> node :: node_list
|
||||
Not_found -> node :: node_list
|
||||
|
||||
and insert node = function
|
||||
| [] -> raise Not_found
|
||||
| node1 :: node_list ->
|
||||
if linked node node1 then raise Not_found
|
||||
else
|
||||
try
|
||||
node1 :: (insert node node_list)
|
||||
with
|
||||
| Not_found ->
|
||||
if join (containt node) (containt node1)
|
||||
then node :: node1 :: node_list
|
||||
else raise Not_found in
|
||||
if linked node node1 then raise Not_found
|
||||
else
|
||||
try
|
||||
node1 :: (insert node node_list)
|
||||
with
|
||||
| Not_found ->
|
||||
if join (containt node) (containt node1)
|
||||
then node :: node1 :: node_list
|
||||
else raise Not_found in
|
||||
|
||||
let node_list, _ = DataFlowDep.build eq_list in
|
||||
let node_list = recook (topological node_list) in
|
||||
let node_list = List.rev node_list in
|
||||
let node_list = recook 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 eqs = schedule eqs in
|
||||
|
|
Loading…
Reference in a new issue