| ... | @@ -2548,12 +2548,16 @@ fn genBody(f: *Function, body: []const Air.Inst.Index) error{ AnalysisFail, OutO | ... | @@ -2548,12 +2548,16 @@ fn genBody(f: *Function, body: []const Air.Inst.Index) error{ AnalysisFail, OutO |
| 2548 | const writer = f.object.writer(); | 2548 | const writer = f.object.writer(); |
| 2549 | if (body.len == 0) { | 2549 | if (body.len == 0) { |
| 2550 | try writer.writeAll("{}"); | 2550 | try writer.writeAll("{}"); |
| 2551 | return; | 2551 | } else { |
| | 2552 | try writer.writeAll("{\n"); |
| | 2553 | f.object.indent_writer.pushIndent(); |
| | 2554 | try genBodyInner(f, body); |
| | 2555 | f.object.indent_writer.popIndent(); |
| | 2556 | try writer.writeByte('}'); |
| 2552 | } | 2557 | } |
| | 2558 | } |
| 2553 | | 2559 | |
| 2554 | try writer.writeAll("{\n"); | 2560 | fn genBodyInner(f: *Function, body: []const Air.Inst.Index) error{ AnalysisFail, OutOfMemory }!void { |
| 2555 | f.object.indent_writer.pushIndent(); | | |
| 2556 | | | |
| 2557 | const air_tags = f.air.instructions.items(.tag); | 2561 | const air_tags = f.air.instructions.items(.tag); |
| 2558 | | 2562 | |
| 2559 | for (body) |inst| { | 2563 | for (body) |inst| { |
| ... | @@ -2799,9 +2803,6 @@ fn genBody(f: *Function, body: []const Air.Inst.Index) error{ AnalysisFail, OutO | ... | @@ -2799,9 +2803,6 @@ fn genBody(f: *Function, body: []const Air.Inst.Index) error{ AnalysisFail, OutO |
| 2799 | else => try f.value_map.putNoClobber(Air.indexToRef(inst), result_value), | 2803 | else => try f.value_map.putNoClobber(Air.indexToRef(inst), result_value), |
| 2800 | } | 2804 | } |
| 2801 | } | 2805 | } |
| 2802 | | | |
| 2803 | f.object.indent_writer.popIndent(); | | |
| 2804 | try writer.writeByte('}'); | | |
| 2805 | } | 2806 | } |
| 2806 | | 2807 | |
| 2807 | fn airSliceField(f: *Function, inst: Air.Inst.Index, is_ptr: bool, field_name: []const u8) !CValue { | 2808 | fn airSliceField(f: *Function, inst: Air.Inst.Index, is_ptr: bool, field_name: []const u8) !CValue { |
| ... | @@ -3775,7 +3776,7 @@ fn airBlock(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -3775,7 +3776,7 @@ fn airBlock(f: *Function, inst: Air.Inst.Index) !CValue { |
| 3775 | .result = result, | 3776 | .result = result, |
| 3776 | }); | 3777 | }); |
| 3777 | | 3778 | |
| 3778 | try genBody(f, body); | 3779 | try genBodyInner(f, body); |
| 3779 | try f.object.indent_writer.insertNewline(); | 3780 | try f.object.indent_writer.insertNewline(); |
| 3780 | // label must be followed by an expression, add an empty one. | 3781 | // label must be followed by an expression, add an empty one. |
| 3781 | try writer.print("zig_block_{d}:;\n", .{block_id}); | 3782 | try writer.print("zig_block_{d}:;\n", .{block_id}); |