35bce1d5e8
Scheduler_simple module: simplest possible scheduler, with only topological sort and without any "smart" algo/heuristic.
48 lines
2.5 KiB
OCaml
48 lines
2.5 KiB
OCaml
(***********************************************************************)
|
|
(* *)
|
|
(* Heptagon *)
|
|
(* *)
|
|
(* Gwenael Delaval, LIG/INRIA, UJF *)
|
|
(* Leonard Gerard, Parkas, ENS *)
|
|
(* Adrien Guatto, Parkas, ENS *)
|
|
(* Cedric Pasteur, Parkas, ENS *)
|
|
(* Marc Pouzet, Parkas, ENS *)
|
|
(* *)
|
|
(* Copyright 2012 ENS, INRIA, UJF *)
|
|
(* *)
|
|
(* This file is part of the Heptagon compiler. *)
|
|
(* *)
|
|
(* Heptagon is free software: you can redistribute it and/or modify it *)
|
|
(* under the terms of the GNU General Public License as published by *)
|
|
(* the Free Software Foundation, either version 3 of the License, or *)
|
|
(* (at your option) any later version. *)
|
|
(* *)
|
|
(* Heptagon is distributed in the hope that it will be useful, *)
|
|
(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)
|
|
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)
|
|
(* GNU General Public License for more details. *)
|
|
(* *)
|
|
(* You should have received a copy of the GNU General Public License *)
|
|
(* along with Heptagon. If not, see <http://www.gnu.org/licenses/> *)
|
|
(* *)
|
|
(***********************************************************************)
|
|
(* scheduling of equations *)
|
|
|
|
|
|
open Mls_utils
|
|
open Sgraph
|
|
|
|
(* clever scheduling *)
|
|
let schedule eq_list =
|
|
let node_list, _ = DataFlowDep.build eq_list in
|
|
let node_list = topological node_list in
|
|
List.rev (List.rev_map containt node_list)
|
|
|
|
let eqs funs () eq_list =
|
|
let eqs, () = Mls_mapfold.eqs funs () eq_list in
|
|
schedule eqs, ()
|
|
|
|
let program p =
|
|
let funs = { Mls_mapfold.defaults with Mls_mapfold.eqs = eqs } in
|
|
let p, () = Mls_mapfold.program_it funs () p in
|
|
p
|