Revision a7062da6
Added by LĂ©lio Brun over 3 years ago
src/checks/algebraicLoop.ml | ||
---|---|---|
77 | 77 |
resolution*) |
78 | 78 |
|
79 | 79 |
let pp_resolution fmt resolution = |
80 |
fprintf_list ~sep:"@ "
|
|
81 |
(fun fmt (eq, _) -> |
|
82 |
Format.fprintf fmt "inlining: %a" Printers.pp_node_eq eq)
|
|
83 |
fmt resolution
|
|
80 |
Format.(pp_print_list
|
|
81 |
(fun fmt (eq, _) ->
|
|
82 |
fprintf fmt "inlining: %a" Printers.pp_node_eq eq)
|
|
83 |
fmt resolution)
|
|
84 | 84 |
|
85 | 85 |
let al_is_solved (_, als) = List.for_all (fun (_, _, status) -> status) als |
86 | 86 |
|
... | ... | |
132 | 132 |
assert false) |
133 | 133 |
|
134 | 134 |
let pp_calls nd fmt calls = |
135 |
Format.fprintf fmt "@[<v 0>%a@]" |
|
136 |
(fprintf_list ~sep:"@ " (fun fmt (funid, expr, _) ->
|
|
137 |
Format.fprintf fmt "%s: %i (inlined:%b)" funid expr.expr_tag
|
|
138 |
(is_expr_inlined nd expr))) |
|
139 |
calls
|
|
135 |
Format.(fprintf fmt "@[<v 0>%a@]"
|
|
136 |
(pp_print_list (fun fmt (funid, expr, _) ->
|
|
137 |
fprintf fmt "%s: %i (inlined:%b)" funid expr.expr_tag
|
|
138 |
(is_expr_inlined nd expr)))
|
|
139 |
calls)
|
|
140 | 140 |
|
141 | 141 |
(* Inline the provided expression *) |
142 | 142 |
let inline_expr node expr = |
... | ... | |
354 | 354 |
let open Format in |
355 | 355 |
fprintf fmt "@[<v 0>"; |
356 | 356 |
fprintf fmt "variables in the alg. loop: @[<hov 0>%a@]@ " |
357 |
(fprintf_list ~sep:",@ " pp_print_string)
|
|
357 |
(pp_comma_list pp_print_string)
|
|
358 | 358 |
partition; |
359 | 359 |
fprintf fmt "@ involved node calls: @[<v 0>%a@]@ " |
360 |
(fprintf_list ~sep:",@ " (fun fmt ((funid, expr, _), status) ->
|
|
360 |
(pp_comma_list (fun fmt ((funid, expr, _), status) ->
|
|
361 | 361 |
fprintf fmt "%s" funid; |
362 | 362 |
if status && is_expr_inlined nd expr then |
363 | 363 |
fprintf fmt " (inlining it solves the alg. loop)")) |
... | ... | |
372 | 372 |
|
373 | 373 |
let pp_report fmt report = |
374 | 374 |
let open Format in |
375 |
fprintf_list ~sep:"@."
|
|
375 |
pp_print_list ~pp_open_box:pp_open_vbox0
|
|
376 | 376 |
(fun _ (nd, als) -> |
377 | 377 |
let top = Corelang.node_from_name nd.node_id in |
378 | 378 |
let pp = |
... | ... | |
385 | 385 |
in |
386 | 386 |
pp top.top_decl_loc (fun fmt -> |
387 | 387 |
fprintf fmt "algebraic loop in node %s: {@[<v 0>%a@]}" nd.node_id |
388 |
(fprintf_list ~sep:"@ " (pp_al nd)) |
|
389 |
als)) |
|
388 |
(pp_print_list (pp_al nd)) als)) |
|
390 | 389 |
fmt report; |
391 | 390 |
fprintf fmt "@." |
392 | 391 |
|
... | ... | |
406 | 405 |
(* TODO create a report *) |
407 | 406 |
(* Printing the report on stderr *) |
408 | 407 |
Format.eprintf "%a" pp_report report; |
409 |
raise (Error.Error (Location.dummy_loc, Error.AlgebraicLoop)))
|
|
408 |
raise (Error.Error (Location.dummy, Error.AlgebraicLoop))) |
|
410 | 409 |
in |
411 | 410 |
(* Printing the report on stderr *) |
412 | 411 |
Format.eprintf "%a" pp_report report; |
Also available in: Unified diff
another step towards refactoring