| ... | ... | @@ -389,6 +389,10 @@ const Writer = struct { |
| 389 | 389 | const ty_pl = w.air.instructions.items(.data)[inst].ty_pl; |
| 390 | 390 | const extra = w.air.extraData(Air.Block, ty_pl.payload); |
| 391 | 391 | const body = w.air.extra[extra.end..][0..extra.data.body_len]; |
| 392 | const liveness_block = if (w.liveness) |liveness| |
| 393 | liveness.getBlock(inst) |
| 394 | else |
| 395 | Liveness.BlockSlices{ .deaths = &.{} }; |
| 392 | 396 | |
| 393 | 397 | try w.writeType(s, w.air.getRefType(ty_pl.ty)); |
| 394 | 398 | if (w.skip_body) return s.writeAll(", ..."); |
| ... | ... | @@ -399,6 +403,10 @@ const Writer = struct { |
| 399 | 403 | w.indent = old_indent; |
| 400 | 404 | try s.writeByteNTimes(' ', w.indent); |
| 401 | 405 | try s.writeAll("}"); |
| 406 | |
| 407 | for (liveness_block.deaths) |operand| { |
| 408 | try s.print(" %{d}!", .{operand}); |
| 409 | } |
| 402 | 410 | } |
| 403 | 411 | |
| 404 | 412 | fn writeLoop(w: *Writer, s: anytype, inst: Air.Inst.Index) @TypeOf(s).Error!void { |
| ... | ... | @@ -737,22 +745,44 @@ const Writer = struct { |
| 737 | 745 | const pl_op = w.air.instructions.items(.data)[inst].pl_op; |
| 738 | 746 | const extra = w.air.extraData(Air.Try, pl_op.payload); |
| 739 | 747 | const body = w.air.extra[extra.end..][0..extra.data.body_len]; |
| 748 | const liveness_condbr = if (w.liveness) |liveness| |
| 749 | liveness.getCondBr(inst) |
| 750 | else |
| 751 | Liveness.CondBrSlices{ .then_deaths = &.{}, .else_deaths = &.{} }; |
| 740 | 752 | |
| 741 | 753 | try w.writeOperand(s, inst, 0, pl_op.operand); |
| 742 | 754 | if (w.skip_body) return s.writeAll(", ..."); |
| 743 | 755 | try s.writeAll(", {\n"); |
| 744 | 756 | const old_indent = w.indent; |
| 745 | 757 | w.indent += 2; |
| 758 | |
| 759 | if (liveness_condbr.else_deaths.len != 0) { |
| 760 | try s.writeByteNTimes(' ', w.indent); |
| 761 | for (liveness_condbr.else_deaths, 0..) |operand, i| { |
| 762 | if (i != 0) try s.writeAll(" "); |
| 763 | try s.print("%{d}!", .{operand}); |
| 764 | } |
| 765 | try s.writeAll("\n"); |
| 766 | } |
| 746 | 767 | try w.writeBody(s, body); |
| 768 | |
| 747 | 769 | w.indent = old_indent; |
| 748 | 770 | try s.writeByteNTimes(' ', w.indent); |
| 749 | 771 | try s.writeAll("}"); |
| 772 | |
| 773 | for (liveness_condbr.then_deaths) |operand| { |
| 774 | try s.print(" %{d}!", .{operand}); |
| 775 | } |
| 750 | 776 | } |
| 751 | 777 | |
| 752 | 778 | fn writeTryPtr(w: *Writer, s: anytype, inst: Air.Inst.Index) @TypeOf(s).Error!void { |
| 753 | 779 | const ty_pl = w.air.instructions.items(.data)[inst].ty_pl; |
| 754 | 780 | const extra = w.air.extraData(Air.TryPtr, ty_pl.payload); |
| 755 | 781 | const body = w.air.extra[extra.end..][0..extra.data.body_len]; |
| 782 | const liveness_condbr = if (w.liveness) |liveness| |
| 783 | liveness.getCondBr(inst) |
| 784 | else |
| 785 | Liveness.CondBrSlices{ .then_deaths = &.{}, .else_deaths = &.{} }; |
| 756 | 786 | |
| 757 | 787 | try w.writeOperand(s, inst, 0, extra.data.ptr); |
| 758 | 788 | |
| ... | ... | @@ -762,10 +792,24 @@ const Writer = struct { |
| 762 | 792 | try s.writeAll(", {\n"); |
| 763 | 793 | const old_indent = w.indent; |
| 764 | 794 | w.indent += 2; |
| 795 | |
| 796 | if (liveness_condbr.else_deaths.len != 0) { |
| 797 | try s.writeByteNTimes(' ', w.indent); |
| 798 | for (liveness_condbr.else_deaths, 0..) |operand, i| { |
| 799 | if (i != 0) try s.writeAll(" "); |
| 800 | try s.print("%{d}!", .{operand}); |
| 801 | } |
| 802 | try s.writeAll("\n"); |
| 803 | } |
| 765 | 804 | try w.writeBody(s, body); |
| 805 | |
| 766 | 806 | w.indent = old_indent; |
| 767 | 807 | try s.writeByteNTimes(' ', w.indent); |
| 768 | 808 | try s.writeAll("}"); |
| 809 | |
| 810 | for (liveness_condbr.then_deaths) |operand| { |
| 811 | try s.print(" %{d}!", .{operand}); |
| 812 | } |
| 769 | 813 | } |
| 770 | 814 | |
| 771 | 815 | fn writeCondBr(w: *Writer, s: anytype, inst: Air.Inst.Index) @TypeOf(s).Error!void { |