aboutsummaryrefslogtreecommitdiff
path: root/src/print_zir.zig
diff options
context:
space:
mode:
authorVeikka Tuominen <git@vexu.eu>2022-11-16 15:46:43 +0200
committerVeikka Tuominen <git@vexu.eu>2022-11-20 20:25:11 +0200
commite5a3eb9777ff165d936b0811f3825eabb8bcd6a4 (patch)
tree15b67ec852dc6b41d1b54a1039bcdd6581aa0449 /src/print_zir.zig
parent44f8714dfb69fac2e8c7a6a35ad9f2abe7c4513a (diff)
downloadzig-e5a3eb9777ff165d936b0811f3825eabb8bcd6a4.tar.gz
zig-e5a3eb9777ff165d936b0811f3825eabb8bcd6a4.zip
Type: make `hasRuntimeBitsAdvanced` take `AbiAlignmentAdvancedStrat`
I wasn't able to create a reduced test case for this but the reasoning can be seen in `abiAlignmentAdvancedUnion` where if `strat` was lazy `hasRuntimeBitsAdvanced` would be given `null` instead of `sema` which would cause eager evaluation when it is not valid or desired.
Diffstat (limited to 'src/print_zir.zig')
-rw-r--r--src/print_zir.zig18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/print_zir.zig b/src/print_zir.zig
index f1b1068920..d434abd439 100644
--- a/src/print_zir.zig
+++ b/src/print_zir.zig
@@ -262,9 +262,10 @@ const Writer = struct {
=> try self.writeBreak(stream, inst),
.array_init,
.array_init_ref,
+ => try self.writeArrayInit(stream, inst),
.array_init_anon,
.array_init_anon_ref,
- => try self.writeArrayInit(stream, inst),
+ => try self.writeArrayInitAnon(stream, inst),
.slice_start => try self.writeSliceStart(stream, inst),
.slice_end => try self.writeSliceEnd(stream, inst),
@@ -2316,6 +2317,21 @@ const Writer = struct {
try self.writeSrc(stream, inst_data.src());
}
+ fn writeArrayInitAnon(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
+ const inst_data = self.code.instructions.items(.data)[inst].pl_node;
+
+ const extra = self.code.extraData(Zir.Inst.MultiOp, inst_data.payload_index);
+ const args = self.code.refSlice(extra.end, extra.data.operands_len);
+
+ try stream.writeAll("{");
+ for (args) |arg, i| {
+ if (i != 0) try stream.writeAll(", ");
+ try self.writeInstRef(stream, arg);
+ }
+ try stream.writeAll("}) ");
+ try self.writeSrc(stream, inst_data.src());
+ }
+
fn writeArrayInitSent(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void {
const inst_data = self.code.instructions.items(.data)[inst].pl_node;