Skip to content

Commit

Permalink
Print availability sets on Linear terms when -davail specified (ocaml…
Browse files Browse the repository at this point in the history
  • Loading branch information
mshinwell authored and tonowak committed Aug 11, 2023
1 parent 1910e49 commit ac84c78
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions backend/printlinear.ml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,36 @@ let instr' ?(print_reg = Printmach.reg) ppf i =
let regsetaddr = Printmach.regsetaddr' ~print_reg in
let test = Printmach.test' ~print_reg in
let operation = Printmach.operation' ~print_reg in
if !Flambda_backend_flags.davail then begin
let module RAS = Reg_availability_set in
let ras_is_nonempty (set : RAS.t) =
match set with
| Ok set -> not (Reg_with_debug_info.Set.is_empty set)
| Unreachable -> true
in
if (match i.available_before with
| None -> false
| Some available_before -> ras_is_nonempty available_before)
|| (match i.available_across with
| None -> false
| Some available_across -> ras_is_nonempty available_across)
then (
if Option.equal RAS.equal i.available_before i.available_across
then
fprintf ppf "@[<1>AB=AA={%a}@]@,"
(Misc.Stdlib.Option.print (RAS.print ~print_reg:reg))
i.available_before
else (
fprintf ppf "@[<1>AB={%a}"
(Misc.Stdlib.Option.print (RAS.print ~print_reg:reg))
i.available_before;
fprintf ppf ",AA={%a}"
(Misc.Stdlib.Option.print (RAS.print ~print_reg:reg))
i.available_across;
fprintf ppf "@]@,"
)
)
end;
begin match i.desc with
| Lend -> ()
| Lprologue ->
Expand Down

0 comments on commit ac84c78

Please sign in to comment.