Project

General

Profile

« Previous | Next » 

Revision eb837d74

Added by Xavier Thirioux over 5 years ago

slight improvement of causality error messages

View differences:

src/causality.ml
20 20
open Graph
21 21
open Format
22 22

  
23
exception Cycle of ident list
23
type error =
24
  | DataCycle of ident list
25
  | NodeCycle of ident list
26

  
27
exception Error of error
24 28

  
25
module IdentDepGraph = Graph.Imperative.Digraph.ConcreteBidirectional (IdentModule)
26 29

  
30
module IdentDepGraph = Graph.Imperative.Digraph.ConcreteBidirectional (IdentModule)
31
(*module DotGraph = Graphviz.Dot (IdentDepGraph)*)
32
module Bfs = Traverse.Bfs (IdentDepGraph)
33
  
27 34
(* Dependency of mem variables on mem variables is cut off 
28 35
   by duplication of some mem vars into local node vars.
29 36
   Thus, cylic dependency errors may only arise between no-mem vars.
......
311 318
    ) prog g in
312 319
  g   
313 320

  
321
  (* keep subgraph of [gr] consisting of nodes accessible from node [v] *)
322
  let slice_graph gr v =
323
    begin
324
      let gr' = new_graph () in
325
      IdentDepGraph.add_vertex gr' v;
326
      Bfs.iter_component (fun v -> IdentDepGraph.iter_succ (fun s -> IdentDepGraph.add_vertex gr' s; IdentDepGraph.add_edge gr' v s) gr v) gr v;
327
      gr'
328
    end
329
  
314 330
  let rec filter_static_inputs inputs args =
315 331
   match inputs, args with
316 332
   | []   , [] -> []
......
368 384
    let scc_l = Cycles.scc_list g in
369 385
    List.iter (fun partition ->
370 386
      if wrong_partition g partition then
371
	raise (Cycle partition)
387
	raise (Error (DataCycle partition))
372 388
      else ()
373 389
    ) scc_l
374 390

  
......
515 531
    Format.fprintf fmt "}@."
516 532
  end
517 533

  
518
let pp_error fmt trace =
519
  fprintf fmt "@.Causality error, cyclic data dependencies: %a@."
520
    (fprintf_list ~sep:", " pp_print_string) trace
534
let pp_error fmt err =
535
  match err with
536
  | DataCycle trace ->
537
     fprintf fmt "@.Causality error, cyclic data dependencies: %a@."
538
       (fprintf_list ~sep:", " pp_print_string) trace
539
  | NodeCycle trace ->
540
     fprintf fmt "@.Causality error, cyclic node calls: %a@."
541
       (fprintf_list ~sep:", " pp_print_string) trace
521 542

  
522 543
(* Merges elements of graph [g2] into graph [g1] *)
523 544
let merge_with g1 g2 =
src/main_lustre_compiler.ml
470 470
  | Parse.Error _
471 471
  | Types.Error (_,_) | Clocks.Error (_,_)
472 472
  | Corelang.Error _ (*| Task_set.Error _*)
473
  | Causality.Cycle _ -> exit 1
473
  | Causality.Error _ -> exit 1
474 474
  | Sys_error msg -> (eprintf "Failure: %s@." msg)
475 475
  | exc -> (Utils.track_exception (); raise exc)
476 476

  
src/optimize_machine.ml
429 429
  | MLocalAssign (i, v) -> instr_cons (MLocalAssign (fvar i, value_replace_var fvar v)) cont
430 430
  | MStateAssign (i, v) -> instr_cons (MStateAssign (i, value_replace_var fvar v)) cont
431 431
  | MReset i            -> instr_cons instr cont
432
  | MNoReset i          -> instr_cons instr cont
432 433
  | MStep (il, i, vl)   -> instr_cons (MStep (List.map fvar il, i, List.map (value_replace_var fvar) vl)) cont
433 434
  | MBranch (g, hl)     -> instr_cons (MBranch (value_replace_var fvar g, List.map (fun (h, il) -> (h, instrs_replace_var fvar il [])) hl)) cont
434 435

  
src/scheduling.ml
151 151
    let fanin = Liveness.compute_fanin n gg in
152 152
    { node = n'; schedule = sort; unused_vars = unused; fanin_table = fanin; dep_graph = gg; }
153 153

  
154
  with (Causality.Cycle vl) as exc ->
155
    let vl = filter_original n vl in
156
    pp_error Format.err_formatter vl;
157
    raise exc
154
  with (Causality.Error err) as exc ->
155
    match err with
156
    | DataCycle vl ->
157
       let vl = filter_original n vl in
158
       Causality.pp_error Format.err_formatter err;
159
       raise exc
160
    | _ -> raise exc
158 161

  
159 162
let compute_node_reuse_table report =
160 163
  let disjoint = Disjunction.clock_disjoint_map (get_node_vars report.node) in
src/sortProg.ml
42 42
	  )
43 43
	  g []
44 44
      )
45
  with (Causality.Cycle v) as exc ->
46
    Causality.pp_error Format.err_formatter v;
45
  with (Causality.Error err) as exc ->
46
    Causality.pp_error Format.err_formatter err;
47 47
    raise exc
48 48
  in
49 49
  Log.report ~level:3 

Also available in: Unified diff