print_air: fix printing of instruction indices

This commit is contained in:
Jacob Young
2023-12-03 11:35:59 -05:00
parent e00f1397e3
commit 82ba9b8560

View File

@@ -97,7 +97,7 @@ const Writer = struct {
const tag = w.air.instructions.items(.tag)[@intFromEnum(inst)];
try s.writeByteNTimes(' ', w.indent);
try s.print("%{d}{c}= {s}(", .{
inst,
@intFromEnum(inst),
@as(u8, if (if (w.liveness) |liveness| liveness.isUnused(inst) else false) '!' else ' '),
@tagName(tag),
});
@@ -388,7 +388,7 @@ const Writer = struct {
try s.writeAll("}");
for (liveness_block.deaths) |operand| {
try s.print(" %{d}!", .{operand});
try s.print(" %{d}!", .{@intFromEnum(operand)});
}
}
@@ -715,7 +715,7 @@ const Writer = struct {
try s.writeByteNTimes(' ', w.indent);
for (liveness_condbr.else_deaths, 0..) |operand, i| {
if (i != 0) try s.writeAll(" ");
try s.print("%{d}!", .{operand});
try s.print("%{d}!", .{@intFromEnum(operand)});
}
try s.writeAll("\n");
}
@@ -726,7 +726,7 @@ const Writer = struct {
try s.writeAll("}");
for (liveness_condbr.then_deaths) |operand| {
try s.print(" %{d}!", .{operand});
try s.print(" %{d}!", .{@intFromEnum(operand)});
}
}
@@ -752,7 +752,7 @@ const Writer = struct {
try s.writeByteNTimes(' ', w.indent);
for (liveness_condbr.else_deaths, 0..) |operand, i| {
if (i != 0) try s.writeAll(" ");
try s.print("%{d}!", .{operand});
try s.print("%{d}!", .{@intFromEnum(operand)});
}
try s.writeAll("\n");
}
@@ -763,7 +763,7 @@ const Writer = struct {
try s.writeAll("}");
for (liveness_condbr.then_deaths) |operand| {
try s.print(" %{d}!", .{operand});
try s.print(" %{d}!", .{@intFromEnum(operand)});
}
}
@@ -787,7 +787,7 @@ const Writer = struct {
try s.writeByteNTimes(' ', w.indent);
for (liveness_condbr.then_deaths, 0..) |operand, i| {
if (i != 0) try s.writeAll(" ");
try s.print("%{d}!", .{operand});
try s.print("%{d}!", .{@intFromEnum(operand)});
}
try s.writeAll("\n");
}
@@ -800,7 +800,7 @@ const Writer = struct {
try s.writeByteNTimes(' ', w.indent);
for (liveness_condbr.else_deaths, 0..) |operand, i| {
if (i != 0) try s.writeAll(" ");
try s.print("%{d}!", .{operand});
try s.print("%{d}!", .{@intFromEnum(operand)});
}
try s.writeAll("\n");
}
@@ -852,7 +852,7 @@ const Writer = struct {
try s.writeByteNTimes(' ', w.indent);
for (deaths, 0..) |operand, i| {
if (i != 0) try s.writeAll(" ");
try s.print("%{d}!", .{operand});
try s.print("%{d}!", .{@intFromEnum(operand)});
}
try s.writeAll("\n");
}
@@ -873,7 +873,7 @@ const Writer = struct {
try s.writeByteNTimes(' ', w.indent);
for (deaths, 0..) |operand, i| {
if (i != 0) try s.writeAll(" ");
try s.print("%{d}!", .{operand});
try s.print("%{d}!", .{@intFromEnum(operand)});
}
try s.writeAll("\n");
}
@@ -957,7 +957,7 @@ const Writer = struct {
dies: bool,
) @TypeOf(s).Error!void {
_ = w;
try s.print("%{d}", .{inst});
try s.print("%{d}", .{@intFromEnum(inst)});
if (dies) try s.writeByte('!');
}