prettier printing for basic block labels
This commit is contained in:
parent
5a7ae5d5a4
commit
58827f230d
|
@ -116,7 +116,10 @@ let pp_ins ~label ppf = function
|
|||
| CON (l, vt) -> Fmt.pf ppf "con %a, %a" pp_reg l pp_vtable vt
|
||||
| GET (o, s) -> Fmt.pf ppf "mov %a, %a[%a]" pp_reg s pp_reg o pp_reg s
|
||||
| SET (o, s) -> Fmt.pf ppf "mov %a[%a], %a" pp_reg o pp_reg s pp_reg (s + 1)
|
||||
| CBR (v, b1, b2) -> Fmt.pf ppf "cbr %a, %s, %s" pp_operand v (label b1) (label b2)
|
||||
| CBR (v, b1, b2) ->
|
||||
let l1 = label b1 in
|
||||
let l2 = label b2 in
|
||||
Fmt.pf ppf "cbr %a, %s, %s" pp_operand v l1 l2
|
||||
| RET -> Fmt.pf ppf "ret"
|
||||
| JMP l -> Fmt.pf ppf "jmp %s" (label l)
|
||||
|
||||
|
@ -130,7 +133,7 @@ let pp_program ppf pr =
|
|||
| exception Not_found ->
|
||||
let name = Fmt.str "L%d" (List.length !basic_blocks - 1) in
|
||||
basic_blocks := (bb, name) :: !basic_blocks;
|
||||
work_list := bb :: !work_list;
|
||||
work_list := !work_list @ [ bb ];
|
||||
name
|
||||
in
|
||||
let rec loop i =
|
||||
|
|
Loading…
Reference in New Issue