Project

General

Profile

« Previous | Next » 

Revision 95fb046e

Added by Pierre-Loïc Garoche about 6 years ago

Scheduling of node equations is now attached to machine type

View differences:

src/machine_code.ml
291 291

  
292 292
let translate_decl nd sch =
293 293
  (*Log.report ~level:1 (fun fmt -> Printers.pp_node fmt nd);*)
294

  
295
  let sorted_eqs = sort_equations_from_schedule nd sch in
294
  let schedule = sch.Scheduling_type.schedule in
295
  let sorted_eqs = sort_equations_from_schedule nd schedule in
296 296
  let constant_eqs = constant_equations nd in
297 297

  
298 298
  (* In case of non functional backend (eg. C), additional local variables have
......
366 366
    };
367 367
    mspec = nd.node_spec;
368 368
    mannot = nd.node_annot;
369
    msch = Some sch;
369 370
  }
370 371

  
371 372
(** takes the global declarations and the scheduling associated to each node *)
......
374 375
  List.map
375 376
    (fun decl ->
376 377
     let node = node_of_top decl in
377
      let sch = (Utils.IMap.find node.node_id node_schs).Scheduling.schedule in
378
      let sch = Utils.IMap.find node.node_id node_schs in
378 379
      translate_decl node sch
379 380
    ) nodes
380 381

  
src/machine_code.mli
1
val translate_prog: Lustre_types.program_t -> Scheduling.schedule_report Utils.IMap.t  -> Machine_code_types.machine_t list
1
val translate_prog: Lustre_types.program_t -> Scheduling_type.schedule_report Utils.IMap.t  -> Machine_code_types.machine_t list
src/machine_code_common.ml
168 168
    };
169 169
    mspec = None;
170 170
    mannot = [];
171
    msch = None
171 172
  }
172 173

  
173 174
let empty_desc =
......
206 207
    };
207 208
    mspec = None;
208 209
    mannot = [];
210
    msch = None
209 211
  }
210 212

  
211 213
let new_instance =
src/machine_code_types.ml
53 53
  mstep: step_t;
54 54
  mspec: node_annot option;
55 55
  mannot: expr_annot list;
56
  msch: Scheduling_type.schedule_report option; (* Equations scheduling *)
56 57
}
src/optimize_machine.ml
268 268

  
269 269
let machines_unfold consts node_schs machines =
270 270
  List.fold_right (fun m (machines, removed) ->
271
    let fanin = (IMap.find m.mname.node_id node_schs).Scheduling.fanin_table in
271
    let fanin = (IMap.find m.mname.node_id node_schs).Scheduling_type.fanin_table in
272 272
    let elim_consts, _ = instrs_unfold fanin IMap.empty (List.map instr_of_const consts) in
273 273
    let (m, removed_m) =  machine_unfold fanin elim_consts m in
274 274
    (m::machines, IMap.add m.mname.node_id removed_m removed)
src/scheduling.ml
14 14
open Corelang
15 15
open Graph
16 16
open Causality
17

  
18
type schedule_report =
19
{
20
  (* the scheduled node *)
21
  node : node_desc;
22
  (* a schedule computed wrt the dependency graph *)
23
  schedule : ident list list;
24
  (* the set of unused variables (no output or mem depends on them) *)
25
  unused_vars : ISet.t;
26
  (* the table mapping each local var to its in-degree *)
27
  fanin_table : (ident, int) Hashtbl.t;
28
  (* the dependency graph *)
29
  dep_graph   : IdentDepGraph.t;
30
  (* the table mapping each assignment to a reusable variable *)
31
  (*reuse_table : (ident, var_decl) Hashtbl.t*)
32
}
17
open Scheduling_type
33 18

  
34 19
(* Topological sort with a priority for variables belonging in the same equation lhs.
35 20
   For variables still unrelated, standard compare is used to choose the minimal element.

Also available in: Unified diff