| author | |
| committer | |
| log | f409457925918da254080be9ddcbe1182073d1e2 |
| tree | 03034d24a64d8c45cb2416c78619d22bb3460e3f |
| parent | 494819be91be1a320c269207f9bd55a1bc09c60b |
11 files changed, 104 insertions(+), 112 deletions(-)
src/Air.zig+5-9| ... | ... | @@ -957,18 +957,14 @@ pub const Inst = struct { |
| 957 | 957 | return index.unwrap().target; |
| 958 | 958 | } |
| 959 | 959 | |
| 960 | pub fn format( | |
| 961 | index: Index, | |
| 962 | comptime _: []const u8, | |
| 963 | _: std.fmt.FormatOptions, | |
| 964 | writer: anytype, | |
| 965 | ) @TypeOf(writer).Error!void { | |
| 966 | try writer.writeByte('%'); | |
| 960 | pub fn format(index: Index, w: *std.io.Writer, comptime fmt: []const u8) std.io.Writer.Error!void { | |
| 961 | comptime assert(fmt.len == 0); | |
| 962 | try w.writeByte('%'); | |
| 967 | 963 | switch (index.unwrap()) { |
| 968 | 964 | .ref => {}, |
| 969 | .target => try writer.writeByte('t'), | |
| 965 | .target => try w.writeByte('t'), | |
| 970 | 966 | } |
| 971 | try writer.print("{d}", .{@as(u31, @truncate(@intFromEnum(index)))}); | |
| 967 | try w.print("{d}", .{@as(u31, @truncate(@intFromEnum(index)))}); | |
| 972 | 968 | } |
| 973 | 969 | }; |
| 974 | 970 |
src/Air/Liveness.zig+23-23| ... | ... | @@ -1299,10 +1299,10 @@ fn analyzeOperands( |
| 1299 | 1299 | |
| 1300 | 1300 | // This logic must synchronize with `will_die_immediately` in `AnalyzeBigOperands.init`. |
| 1301 | 1301 | const immediate_death = if (data.live_set.remove(inst)) blk: { |
| 1302 | log.debug("[{}] %{}: removed from live set", .{ pass, @intFromEnum(inst) }); | |
| 1302 | log.debug("[{}] %{d}: removed from live set", .{ pass, @intFromEnum(inst) }); | |
| 1303 | 1303 | break :blk false; |
| 1304 | 1304 | } else blk: { |
| 1305 | log.debug("[{}] %{}: immediate death", .{ pass, @intFromEnum(inst) }); | |
| 1305 | log.debug("[{}] %{d}: immediate death", .{ pass, @intFromEnum(inst) }); | |
| 1306 | 1306 | break :blk true; |
| 1307 | 1307 | }; |
| 1308 | 1308 | |
| ... | ... | @@ -1323,7 +1323,7 @@ fn analyzeOperands( |
| 1323 | 1323 | const mask = @as(Bpi, 1) << @as(OperandInt, @intCast(i)); |
| 1324 | 1324 | |
| 1325 | 1325 | if ((try data.live_set.fetchPut(gpa, operand, {})) == null) { |
| 1326 | log.debug("[{}] %{}: added %{} to live set (operand dies here)", .{ pass, @intFromEnum(inst), operand }); | |
| 1326 | log.debug("[{}] %{f}: added %{d} to live set (operand dies here)", .{ pass, @intFromEnum(inst), operand }); | |
| 1327 | 1327 | tomb_bits |= mask; |
| 1328 | 1328 | } |
| 1329 | 1329 | } |
| ... | ... | @@ -1462,19 +1462,19 @@ fn analyzeInstBlock( |
| 1462 | 1462 | }, |
| 1463 | 1463 | |
| 1464 | 1464 | .main_analysis => { |
| 1465 | log.debug("[{}] %{}: block live set is {}", .{ pass, inst, fmtInstSet(&data.live_set) }); | |
| 1465 | log.debug("[{}] %{f}: block live set is {f}", .{ pass, inst, fmtInstSet(&data.live_set) }); | |
| 1466 | 1466 | // We can move the live set because the body should have a noreturn |
| 1467 | 1467 | // instruction which overrides the set. |
| 1468 | 1468 | try data.block_scopes.put(gpa, inst, .{ |
| 1469 | 1469 | .live_set = data.live_set.move(), |
| 1470 | 1470 | }); |
| 1471 | 1471 | defer { |
| 1472 | log.debug("[{}] %{}: popped block scope", .{ pass, inst }); | |
| 1472 | log.debug("[{}] %{f}: popped block scope", .{ pass, inst }); | |
| 1473 | 1473 | var scope = data.block_scopes.fetchRemove(inst).?.value; |
| 1474 | 1474 | scope.live_set.deinit(gpa); |
| 1475 | 1475 | } |
| 1476 | 1476 | |
| 1477 | log.debug("[{}] %{}: pushed new block scope", .{ pass, inst }); | |
| 1477 | log.debug("[{}] %{f}: pushed new block scope", .{ pass, inst }); | |
| 1478 | 1478 | try analyzeBody(a, pass, data, body); |
| 1479 | 1479 | |
| 1480 | 1480 | // If the block is noreturn, block deaths not only aren't useful, they're impossible to |
| ... | ... | @@ -1501,7 +1501,7 @@ fn analyzeInstBlock( |
| 1501 | 1501 | } |
| 1502 | 1502 | assert(measured_num == num_deaths); // post-live-set should be a subset of pre-live-set |
| 1503 | 1503 | try a.special.put(gpa, inst, extra_index); |
| 1504 | log.debug("[{}] %{}: block deaths are {}", .{ | |
| 1504 | log.debug("[{}] %{f}: block deaths are {f}", .{ | |
| 1505 | 1505 | pass, |
| 1506 | 1506 | inst, |
| 1507 | 1507 | fmtInstList(@ptrCast(a.extra.items[extra_index + 1 ..][0..num_deaths])), |
| ... | ... | @@ -1538,7 +1538,7 @@ fn writeLoopInfo( |
| 1538 | 1538 | const block_inst = key.*; |
| 1539 | 1539 | a.extra.appendAssumeCapacity(@intFromEnum(block_inst)); |
| 1540 | 1540 | } |
| 1541 | log.debug("[{}] %{}: includes breaks to {}", .{ LivenessPass.loop_analysis, inst, fmtInstSet(&data.breaks) }); | |
| 1541 | log.debug("[{}] %{f}: includes breaks to {f}", .{ LivenessPass.loop_analysis, inst, fmtInstSet(&data.breaks) }); | |
| 1542 | 1542 | |
| 1543 | 1543 | // Now we put the live operands from the loop body in too |
| 1544 | 1544 | const num_live = data.live_set.count(); |
| ... | ... | @@ -1550,7 +1550,7 @@ fn writeLoopInfo( |
| 1550 | 1550 | const alive = key.*; |
| 1551 | 1551 | a.extra.appendAssumeCapacity(@intFromEnum(alive)); |
| 1552 | 1552 | } |
| 1553 | log.debug("[{}] %{}: maintain liveness of {}", .{ LivenessPass.loop_analysis, inst, fmtInstSet(&data.live_set) }); | |
| 1553 | log.debug("[{}] %{f}: maintain liveness of {f}", .{ LivenessPass.loop_analysis, inst, fmtInstSet(&data.live_set) }); | |
| 1554 | 1554 | |
| 1555 | 1555 | try a.special.put(gpa, inst, extra_index); |
| 1556 | 1556 | |
| ... | ... | @@ -1591,7 +1591,7 @@ fn resolveLoopLiveSet( |
| 1591 | 1591 | try data.live_set.ensureUnusedCapacity(gpa, @intCast(loop_live.len)); |
| 1592 | 1592 | for (loop_live) |alive| data.live_set.putAssumeCapacity(alive, {}); |
| 1593 | 1593 | |
| 1594 | log.debug("[{}] %{}: block live set is {}", .{ LivenessPass.main_analysis, inst, fmtInstSet(&data.live_set) }); | |
| 1594 | log.debug("[{}] %{f}: block live set is {f}", .{ LivenessPass.main_analysis, inst, fmtInstSet(&data.live_set) }); | |
| 1595 | 1595 | |
| 1596 | 1596 | for (breaks) |block_inst| { |
| 1597 | 1597 | // We might break to this block, so include every operand that the block needs alive |
| ... | ... | @@ -1604,7 +1604,7 @@ fn resolveLoopLiveSet( |
| 1604 | 1604 | } |
| 1605 | 1605 | } |
| 1606 | 1606 | |
| 1607 | log.debug("[{}] %{}: loop live set is {}", .{ LivenessPass.main_analysis, inst, fmtInstSet(&data.live_set) }); | |
| 1607 | log.debug("[{}] %{f}: loop live set is {f}", .{ LivenessPass.main_analysis, inst, fmtInstSet(&data.live_set) }); | |
| 1608 | 1608 | } |
| 1609 | 1609 | |
| 1610 | 1610 | fn analyzeInstLoop( |
| ... | ... | @@ -1642,7 +1642,7 @@ fn analyzeInstLoop( |
| 1642 | 1642 | .live_set = data.live_set.move(), |
| 1643 | 1643 | }); |
| 1644 | 1644 | defer { |
| 1645 | log.debug("[{}] %{}: popped loop block scop", .{ pass, inst }); | |
| 1645 | log.debug("[{}] %{f}: popped loop block scop", .{ pass, inst }); | |
| 1646 | 1646 | var scope = data.block_scopes.fetchRemove(inst).?.value; |
| 1647 | 1647 | scope.live_set.deinit(gpa); |
| 1648 | 1648 | } |
| ... | ... | @@ -1743,13 +1743,13 @@ fn analyzeInstCondBr( |
| 1743 | 1743 | } |
| 1744 | 1744 | } |
| 1745 | 1745 | |
| 1746 | log.debug("[{}] %{}: 'then' branch mirrored deaths are {}", .{ pass, inst, fmtInstList(then_mirrored_deaths.items) }); | |
| 1747 | log.debug("[{}] %{}: 'else' branch mirrored deaths are {}", .{ pass, inst, fmtInstList(else_mirrored_deaths.items) }); | |
| 1746 | log.debug("[{}] %{f}: 'then' branch mirrored deaths are {f}", .{ pass, inst, fmtInstList(then_mirrored_deaths.items) }); | |
| 1747 | log.debug("[{}] %{f}: 'else' branch mirrored deaths are {f}", .{ pass, inst, fmtInstList(else_mirrored_deaths.items) }); | |
| 1748 | 1748 | |
| 1749 | 1749 | data.live_set.deinit(gpa); |
| 1750 | 1750 | data.live_set = then_live.move(); // Really the union of both live sets |
| 1751 | 1751 | |
| 1752 | log.debug("[{}] %{}: new live set is {}", .{ pass, inst, fmtInstSet(&data.live_set) }); | |
| 1752 | log.debug("[{}] %{f}: new live set is {f}", .{ pass, inst, fmtInstSet(&data.live_set) }); | |
| 1753 | 1753 | |
| 1754 | 1754 | // Write the mirrored deaths to `extra` |
| 1755 | 1755 | const then_death_count = @as(u32, @intCast(then_mirrored_deaths.items.len)); |
| ... | ... | @@ -1817,7 +1817,7 @@ fn analyzeInstSwitchBr( |
| 1817 | 1817 | }); |
| 1818 | 1818 | } |
| 1819 | 1819 | defer if (is_dispatch_loop) { |
| 1820 | log.debug("[{}] %{}: popped loop block scop", .{ pass, inst }); | |
| 1820 | log.debug("[{}] %{f}: popped loop block scop", .{ pass, inst }); | |
| 1821 | 1821 | var scope = data.block_scopes.fetchRemove(inst).?.value; |
| 1822 | 1822 | scope.live_set.deinit(gpa); |
| 1823 | 1823 | }; |
| ... | ... | @@ -1875,13 +1875,13 @@ fn analyzeInstSwitchBr( |
| 1875 | 1875 | } |
| 1876 | 1876 | |
| 1877 | 1877 | for (mirrored_deaths, 0..) |mirrored, i| { |
| 1878 | log.debug("[{}] %{}: case {} mirrored deaths are {}", .{ pass, inst, i, fmtInstList(mirrored.items) }); | |
| 1878 | log.debug("[{}] %{f}: case {} mirrored deaths are {f}", .{ pass, inst, i, fmtInstList(mirrored.items) }); | |
| 1879 | 1879 | } |
| 1880 | 1880 | |
| 1881 | 1881 | data.live_set.deinit(gpa); |
| 1882 | 1882 | data.live_set = all_alive.move(); |
| 1883 | 1883 | |
| 1884 | log.debug("[{}] %{}: new live set is {}", .{ pass, inst, fmtInstSet(&data.live_set) }); | |
| 1884 | log.debug("[{}] %{f}: new live set is {f}", .{ pass, inst, fmtInstSet(&data.live_set) }); | |
| 1885 | 1885 | } |
| 1886 | 1886 | |
| 1887 | 1887 | const else_death_count = @as(u32, @intCast(mirrored_deaths[ncases].items.len)); |
| ... | ... | @@ -1980,7 +1980,7 @@ fn AnalyzeBigOperands(comptime pass: LivenessPass) type { |
| 1980 | 1980 | |
| 1981 | 1981 | .main_analysis => { |
| 1982 | 1982 | if ((try big.data.live_set.fetchPut(gpa, operand, {})) == null) { |
| 1983 | log.debug("[{}] %{}: added %{} to live set (operand dies here)", .{ pass, big.inst, operand }); | |
| 1983 | log.debug("[{}] %{f}: added %{f} to live set (operand dies here)", .{ pass, big.inst, operand }); | |
| 1984 | 1984 | big.extra_tombs[extra_byte] |= @as(u32, 1) << extra_bit; |
| 1985 | 1985 | } |
| 1986 | 1986 | }, |
| ... | ... | @@ -2042,9 +2042,9 @@ const FmtInstSet = struct { |
| 2042 | 2042 | return; |
| 2043 | 2043 | } |
| 2044 | 2044 | var it = val.set.keyIterator(); |
| 2045 | try w.print("%{}", .{it.next().?.*}); | |
| 2045 | try w.print("%{f}", .{it.next().?.*}); | |
| 2046 | 2046 | while (it.next()) |key| { |
| 2047 | try w.print(" %{}", .{key.*}); | |
| 2047 | try w.print(" %{f}", .{key.*}); | |
| 2048 | 2048 | } |
| 2049 | 2049 | } |
| 2050 | 2050 | }; |
| ... | ... | @@ -2061,9 +2061,9 @@ const FmtInstList = struct { |
| 2061 | 2061 | try w.writeAll("[no instructions]"); |
| 2062 | 2062 | return; |
| 2063 | 2063 | } |
| 2064 | try w.print("%{}", .{val.list[0]}); | |
| 2064 | try w.print("%{f}", .{val.list[0]}); | |
| 2065 | 2065 | for (val.list[1..]) |inst| { |
| 2066 | try w.print(" %{}", .{inst}); | |
| 2066 | try w.print(" %{f}", .{inst}); | |
| 2067 | 2067 | } |
| 2068 | 2068 | } |
| 2069 | 2069 | }; |
src/IncrementalDebugServer.zig+1-1| ... | ... | @@ -234,7 +234,7 @@ fn handleCommand(zcu: *Zcu, output: *std.ArrayListUnmanaged(u8), cmd_str: []cons |
| 234 | 234 | for (unit_info.deps.items, 0..) |dependee, i| { |
| 235 | 235 | try w.print("[{d}] ", .{i}); |
| 236 | 236 | switch (dependee) { |
| 237 | .src_hash, .namespace, .namespace_name, .zon_file, .embed_file => try w.print("{}", .{zcu.fmtDependee(dependee)}), | |
| 237 | .src_hash, .namespace, .namespace_name, .zon_file, .embed_file => try w.print("{f}", .{zcu.fmtDependee(dependee)}), | |
| 238 | 238 | .nav_val, .nav_ty => |nav| try w.print("{s} {d}", .{ @tagName(dependee), @intFromEnum(nav) }), |
| 239 | 239 | .interned => |ip_index| switch (ip.indexToKey(ip_index)) { |
| 240 | 240 | .struct_type, .union_type, .enum_type => try w.print("type {d}", .{@intFromEnum(ip_index)}), |
src/Sema/LowerZon.zig+16-20| ... | ... | @@ -338,7 +338,7 @@ fn failUnsupportedResultType( |
| 338 | 338 | const gpa = sema.gpa; |
| 339 | 339 | const pt = sema.pt; |
| 340 | 340 | return sema.failWithOwnedErrorMsg(self.block, msg: { |
| 341 | const msg = try sema.errMsg(self.import_loc, "type '{}' is not available in ZON", .{ty.fmt(pt)}); | |
| 341 | const msg = try sema.errMsg(self.import_loc, "type '{f}' is not available in ZON", .{ty.fmt(pt)}); | |
| 342 | 342 | errdefer msg.destroy(gpa); |
| 343 | 343 | if (opt_note) |n| try sema.errNote(self.import_loc, msg, "{s}", .{n}); |
| 344 | 344 | break :msg msg; |
| ... | ... | @@ -360,11 +360,7 @@ fn fail( |
| 360 | 360 | fn lowerExprKnownResTy(self: *LowerZon, node: Zoir.Node.Index, res_ty: Type) CompileError!InternPool.Index { |
| 361 | 361 | const pt = self.sema.pt; |
| 362 | 362 | return self.lowerExprKnownResTyInner(node, res_ty) catch |err| switch (err) { |
| 363 | error.WrongType => return self.fail( | |
| 364 | node, | |
| 365 | "expected type '{}'", | |
| 366 | .{res_ty.fmt(pt)}, | |
| 367 | ), | |
| 363 | error.WrongType => return self.fail(node, "expected type '{f}'", .{res_ty.fmt(pt)}), | |
| 368 | 364 | else => |e| return e, |
| 369 | 365 | }; |
| 370 | 366 | } |
| ... | ... | @@ -428,7 +424,7 @@ fn lowerExprKnownResTyInner( |
| 428 | 424 | .frame, |
| 429 | 425 | .@"anyframe", |
| 430 | 426 | .void, |
| 431 | => return self.fail(node, "type '{}' not available in ZON", .{res_ty.fmt(pt)}), | |
| 427 | => return self.fail(node, "type '{f}' not available in ZON", .{res_ty.fmt(pt)}), | |
| 432 | 428 | } |
| 433 | 429 | } |
| 434 | 430 | |
| ... | ... | @@ -458,7 +454,7 @@ fn lowerInt( |
| 458 | 454 | // If lhs is unsigned and rhs is less than 0, we're out of bounds |
| 459 | 455 | if (lhs_info.signedness == .unsigned and rhs < 0) return self.fail( |
| 460 | 456 | node, |
| 461 | "type '{}' cannot represent integer value '{}'", | |
| 457 | "type '{f}' cannot represent integer value '{d}'", | |
| 462 | 458 | .{ res_ty.fmt(self.sema.pt), rhs }, |
| 463 | 459 | ); |
| 464 | 460 | |
| ... | ... | @@ -478,7 +474,7 @@ fn lowerInt( |
| 478 | 474 | if (rhs < min_int or rhs > max_int) { |
| 479 | 475 | return self.fail( |
| 480 | 476 | node, |
| 481 | "type '{}' cannot represent integer value '{}'", | |
| 477 | "type '{f}' cannot represent integer value '{d}'", | |
| 482 | 478 | .{ res_ty.fmt(self.sema.pt), rhs }, |
| 483 | 479 | ); |
| 484 | 480 | } |
| ... | ... | @@ -496,7 +492,7 @@ fn lowerInt( |
| 496 | 492 | if (!val.fitsInTwosComp(int_info.signedness, int_info.bits)) { |
| 497 | 493 | return self.fail( |
| 498 | 494 | node, |
| 499 | "type '{}' cannot represent integer value '{}'", | |
| 495 | "type '{f}' cannot represent integer value '{f}'", | |
| 500 | 496 | .{ res_ty.fmt(self.sema.pt), val }, |
| 501 | 497 | ); |
| 502 | 498 | } |
| ... | ... | @@ -517,7 +513,7 @@ fn lowerInt( |
| 517 | 513 | switch (big_int.setFloat(val, .trunc)) { |
| 518 | 514 | .inexact => return self.fail( |
| 519 | 515 | node, |
| 520 | "fractional component prevents float value '{}' from coercion to type '{}'", | |
| 516 | "fractional component prevents float value '{}' from coercion to type '{f}'", | |
| 521 | 517 | .{ val, res_ty.fmt(self.sema.pt) }, |
| 522 | 518 | ), |
| 523 | 519 | .exact => {}, |
| ... | ... | @@ -528,8 +524,8 @@ fn lowerInt( |
| 528 | 524 | if (!big_int.toConst().fitsInTwosComp(int_info.signedness, int_info.bits)) { |
| 529 | 525 | return self.fail( |
| 530 | 526 | node, |
| 531 | "type '{}' cannot represent integer value '{}'", | |
| 532 | .{ val, res_ty.fmt(self.sema.pt) }, | |
| 527 | "type '{f}' cannot represent integer value '{}'", | |
| 528 | .{ res_ty.fmt(self.sema.pt), val }, | |
| 533 | 529 | ); |
| 534 | 530 | } |
| 535 | 531 | |
| ... | ... | @@ -550,7 +546,7 @@ fn lowerInt( |
| 550 | 546 | if (val >= out_of_range) { |
| 551 | 547 | return self.fail( |
| 552 | 548 | node, |
| 553 | "type '{}' cannot represent integer value '{}'", | |
| 549 | "type '{f}' cannot represent integer value '{d}'", | |
| 554 | 550 | .{ res_ty.fmt(self.sema.pt), val }, |
| 555 | 551 | ); |
| 556 | 552 | } |
| ... | ... | @@ -584,7 +580,7 @@ fn lowerFloat( |
| 584 | 580 | .pos_inf => b: { |
| 585 | 581 | if (res_ty.toIntern() == .comptime_float_type) return self.fail( |
| 586 | 582 | node, |
| 587 | "expected type '{}'", | |
| 583 | "expected type '{f}'", | |
| 588 | 584 | .{res_ty.fmt(self.sema.pt)}, |
| 589 | 585 | ); |
| 590 | 586 | break :b try self.sema.pt.floatValue(res_ty, std.math.inf(f128)); |
| ... | ... | @@ -592,7 +588,7 @@ fn lowerFloat( |
| 592 | 588 | .neg_inf => b: { |
| 593 | 589 | if (res_ty.toIntern() == .comptime_float_type) return self.fail( |
| 594 | 590 | node, |
| 595 | "expected type '{}'", | |
| 591 | "expected type '{f}'", | |
| 596 | 592 | .{res_ty.fmt(self.sema.pt)}, |
| 597 | 593 | ); |
| 598 | 594 | break :b try self.sema.pt.floatValue(res_ty, -std.math.inf(f128)); |
| ... | ... | @@ -600,7 +596,7 @@ fn lowerFloat( |
| 600 | 596 | .nan => b: { |
| 601 | 597 | if (res_ty.toIntern() == .comptime_float_type) return self.fail( |
| 602 | 598 | node, |
| 603 | "expected type '{}'", | |
| 599 | "expected type '{f}'", | |
| 604 | 600 | .{res_ty.fmt(self.sema.pt)}, |
| 605 | 601 | ); |
| 606 | 602 | break :b try self.sema.pt.floatValue(res_ty, std.math.nan(f128)); |
| ... | ... | @@ -795,7 +791,7 @@ fn lowerStruct(self: *LowerZon, node: Zoir.Node.Index, res_ty: Type) !InternPool |
| 795 | 791 | const field_node = fields.vals.at(@intCast(i)); |
| 796 | 792 | |
| 797 | 793 | const name_index = struct_info.nameIndex(ip, field_name) orelse { |
| 798 | return self.fail(field_node, "unexpected field '{}'", .{field_name.fmt(ip)}); | |
| 794 | return self.fail(field_node, "unexpected field '{f}'", .{field_name.fmt(ip)}); | |
| 799 | 795 | }; |
| 800 | 796 | |
| 801 | 797 | const field_type: Type = .fromInterned(struct_info.field_types.get(ip)[name_index]); |
| ... | ... | @@ -816,7 +812,7 @@ fn lowerStruct(self: *LowerZon, node: Zoir.Node.Index, res_ty: Type) !InternPool |
| 816 | 812 | |
| 817 | 813 | const field_names = struct_info.field_names.get(ip); |
| 818 | 814 | for (field_values, field_names) |*value, name| { |
| 819 | if (value.* == .none) return self.fail(node, "missing field '{}'", .{name.fmt(ip)}); | |
| 815 | if (value.* == .none) return self.fail(node, "missing field '{f}'", .{name.fmt(ip)}); | |
| 820 | 816 | } |
| 821 | 817 | |
| 822 | 818 | return self.sema.pt.intern(.{ .aggregate = .{ |
| ... | ... | @@ -934,7 +930,7 @@ fn lowerUnion(self: *LowerZon, node: Zoir.Node.Index, res_ty: Type) !InternPool. |
| 934 | 930 | .struct_literal => b: { |
| 935 | 931 | const fields: @FieldType(Zoir.Node, "struct_literal") = switch (node.get(self.file.zoir.?)) { |
| 936 | 932 | .struct_literal => |fields| fields, |
| 937 | else => return self.fail(node, "expected type '{}'", .{res_ty.fmt(self.sema.pt)}), | |
| 933 | else => return self.fail(node, "expected type '{f}'", .{res_ty.fmt(self.sema.pt)}), | |
| 938 | 934 | }; |
| 939 | 935 | if (fields.names.len != 1) { |
| 940 | 936 | return error.WrongType; |
src/arch/riscv64/CodeGen.zig+18-18| ... | ... | @@ -499,14 +499,14 @@ const InstTracking = struct { |
| 499 | 499 | else => target.long, |
| 500 | 500 | } else target.long; |
| 501 | 501 | inst_tracking.short = target.short; |
| 502 | tracking_log.debug("%{d} => {} (materialize)", .{ inst, inst_tracking.* }); | |
| 502 | tracking_log.debug("%{d} => {f} (materialize)", .{ inst, inst_tracking.* }); | |
| 503 | 503 | } |
| 504 | 504 | |
| 505 | 505 | fn resurrect(inst_tracking: *InstTracking, inst: Air.Inst.Index, scope_generation: u32) void { |
| 506 | 506 | switch (inst_tracking.short) { |
| 507 | 507 | .dead => |die_generation| if (die_generation >= scope_generation) { |
| 508 | 508 | inst_tracking.reuseFrame(); |
| 509 | tracking_log.debug("%{d} => {} (resurrect)", .{ inst, inst_tracking.* }); | |
| 509 | tracking_log.debug("%{d} => {f} (resurrect)", .{ inst, inst_tracking.* }); | |
| 510 | 510 | }, |
| 511 | 511 | else => {}, |
| 512 | 512 | } |
| ... | ... | @@ -516,7 +516,7 @@ const InstTracking = struct { |
| 516 | 516 | if (inst_tracking.short == .dead) return; |
| 517 | 517 | try function.freeValue(inst_tracking.short); |
| 518 | 518 | inst_tracking.short = .{ .dead = function.scope_generation }; |
| 519 | tracking_log.debug("%{d} => {} (death)", .{ inst, inst_tracking.* }); | |
| 519 | tracking_log.debug("%{d} => {f} (death)", .{ inst, inst_tracking.* }); | |
| 520 | 520 | } |
| 521 | 521 | |
| 522 | 522 | fn reuse( |
| ... | ... | @@ -527,15 +527,15 @@ const InstTracking = struct { |
| 527 | 527 | ) void { |
| 528 | 528 | inst_tracking.short = .{ .dead = function.scope_generation }; |
| 529 | 529 | if (new_inst) |inst| |
| 530 | tracking_log.debug("%{d} => {} (reuse %{d})", .{ inst, inst_tracking.*, old_inst }) | |
| 530 | tracking_log.debug("%{d} => {f} (reuse %{d})", .{ inst, inst_tracking.*, old_inst }) | |
| 531 | 531 | else |
| 532 | tracking_log.debug("tmp => {} (reuse %{d})", .{ inst_tracking.*, old_inst }); | |
| 532 | tracking_log.debug("tmp => {f} (reuse %{d})", .{ inst_tracking.*, old_inst }); | |
| 533 | 533 | } |
| 534 | 534 | |
| 535 | 535 | fn liveOut(inst_tracking: *InstTracking, function: *Func, inst: Air.Inst.Index) void { |
| 536 | 536 | for (inst_tracking.getRegs()) |reg| { |
| 537 | 537 | if (function.register_manager.isRegFree(reg)) { |
| 538 | tracking_log.debug("%{d} => {} (live-out)", .{ inst, inst_tracking.* }); | |
| 538 | tracking_log.debug("%{d} => {f} (live-out)", .{ inst, inst_tracking.* }); | |
| 539 | 539 | continue; |
| 540 | 540 | } |
| 541 | 541 | |
| ... | ... | @@ -562,7 +562,7 @@ const InstTracking = struct { |
| 562 | 562 | // Perform side-effects of freeValue manually. |
| 563 | 563 | function.register_manager.freeReg(reg); |
| 564 | 564 | |
| 565 | tracking_log.debug("%{d} => {} (live-out %{d})", .{ inst, inst_tracking.*, tracked_inst }); | |
| 565 | tracking_log.debug("%{d} => {f} (live-out %{d})", .{ inst, inst_tracking.*, tracked_inst }); | |
| 566 | 566 | } |
| 567 | 567 | } |
| 568 | 568 | |
| ... | ... | @@ -572,7 +572,7 @@ const InstTracking = struct { |
| 572 | 572 | _: std.fmt.FormatOptions, |
| 573 | 573 | writer: anytype, |
| 574 | 574 | ) @TypeOf(writer).Error!void { |
| 575 | if (!std.meta.eql(inst_tracking.long, inst_tracking.short)) try writer.print("|{}| ", .{inst_tracking.long}); | |
| 575 | if (!std.meta.eql(inst_tracking.long, inst_tracking.short)) try writer.print("|{f}| ", .{inst_tracking.long}); | |
| 576 | 576 | try writer.print("{}", .{inst_tracking.short}); |
| 577 | 577 | } |
| 578 | 578 | }; |
| ... | ... | @@ -802,7 +802,7 @@ pub fn generate( |
| 802 | 802 | function.mir_instructions.deinit(gpa); |
| 803 | 803 | } |
| 804 | 804 | |
| 805 | wip_mir_log.debug("{}:", .{fmtNav(func.owner_nav, ip)}); | |
| 805 | wip_mir_log.debug("{f}:", .{fmtNav(func.owner_nav, ip)}); | |
| 806 | 806 | |
| 807 | 807 | try function.frame_allocs.resize(gpa, FrameIndex.named_count); |
| 808 | 808 | function.frame_allocs.set( |
| ... | ... | @@ -973,7 +973,7 @@ fn formatWipMir(data: FormatWipMirData, writer: *std.io.Writer) std.io.Writer.Er |
| 973 | 973 | else => |e| return e, |
| 974 | 974 | }).insts) |lowered_inst| { |
| 975 | 975 | if (!first) try writer.writeAll("\ndebug(wip_mir): "); |
| 976 | try writer.print(" | {}", .{lowered_inst}); | |
| 976 | try writer.print(" | {f}", .{lowered_inst}); | |
| 977 | 977 | first = false; |
| 978 | 978 | } |
| 979 | 979 | } |
| ... | ... | @@ -1156,7 +1156,7 @@ fn gen(func: *Func) !void { |
| 1156 | 1156 | func.ret_mcv.long.address().offset(-func.ret_mcv.short.indirect.off), |
| 1157 | 1157 | ); |
| 1158 | 1158 | func.ret_mcv.long = .{ .load_frame = .{ .index = frame_index } }; |
| 1159 | tracking_log.debug("spill {} to {}", .{ func.ret_mcv.long, frame_index }); | |
| 1159 | tracking_log.debug("spill {f} to {f}", .{ func.ret_mcv.long, frame_index }); | |
| 1160 | 1160 | }, |
| 1161 | 1161 | else => unreachable, |
| 1162 | 1162 | } |
| ... | ... | @@ -1656,14 +1656,14 @@ fn genBody(func: *Func, body: []const Air.Inst.Index) InnerError!void { |
| 1656 | 1656 | |
| 1657 | 1657 | if (std.debug.runtime_safety) { |
| 1658 | 1658 | if (func.air_bookkeeping < old_air_bookkeeping + 1) { |
| 1659 | std.debug.panic("in codegen.zig, handling of AIR instruction %{d} ('{}') did not do proper bookkeeping. Look for a missing call to finishAir.", .{ inst, air_tags[@intFromEnum(inst)] }); | |
| 1659 | std.debug.panic("in codegen.zig, handling of AIR instruction %{d} ('{f}') did not do proper bookkeeping. Look for a missing call to finishAir.", .{ inst, air_tags[@intFromEnum(inst)] }); | |
| 1660 | 1660 | } |
| 1661 | 1661 | |
| 1662 | 1662 | { // check consistency of tracked registers |
| 1663 | 1663 | var it = func.register_manager.free_registers.iterator(.{ .kind = .unset }); |
| 1664 | 1664 | while (it.next()) |index| { |
| 1665 | 1665 | const tracked_inst = func.register_manager.registers[index]; |
| 1666 | tracking_log.debug("tracked inst: {}", .{tracked_inst}); | |
| 1666 | tracking_log.debug("tracked inst: {f}", .{tracked_inst}); | |
| 1667 | 1667 | const tracking = func.getResolvedInstValue(tracked_inst); |
| 1668 | 1668 | for (tracking.getRegs()) |reg| { |
| 1669 | 1669 | if (RegisterManager.indexOfRegIntoTracked(reg).? == index) break; |
| ... | ... | @@ -1697,7 +1697,7 @@ fn freeValue(func: *Func, value: MCValue) !void { |
| 1697 | 1697 | |
| 1698 | 1698 | fn feed(func: *Func, bt: *Air.Liveness.BigTomb, operand: Air.Inst.Ref) !void { |
| 1699 | 1699 | if (bt.feed()) if (operand.toIndex()) |inst| { |
| 1700 | log.debug("feed inst: %{}", .{inst}); | |
| 1700 | log.debug("feed inst: %{f}", .{inst}); | |
| 1701 | 1701 | try func.processDeath(inst); |
| 1702 | 1702 | }; |
| 1703 | 1703 | } |
| ... | ... | @@ -1726,7 +1726,7 @@ fn finishAirResult(func: *Func, inst: Air.Inst.Index, result: MCValue) void { |
| 1726 | 1726 | else => {}, |
| 1727 | 1727 | } |
| 1728 | 1728 | |
| 1729 | tracking_log.debug("%{d} => {} (birth)", .{ inst, result }); | |
| 1729 | tracking_log.debug("%{d} => {f} (birth)", .{ inst, result }); | |
| 1730 | 1730 | func.inst_tracking.putAssumeCapacityNoClobber(inst, InstTracking.init(result)); |
| 1731 | 1731 | // In some cases, an operand may be reused as the result. |
| 1732 | 1732 | // If that operand died and was a register, it was freed by |
| ... | ... | @@ -1827,7 +1827,7 @@ fn computeFrameLayout(func: *Func) !FrameLayout { |
| 1827 | 1827 | total_alloc_size + 64 + args_frame_size + spill_frame_size + call_frame_size, |
| 1828 | 1828 | @intCast(frame_align[@intFromEnum(FrameIndex.base_ptr)].toByteUnits().?), |
| 1829 | 1829 | ); |
| 1830 | log.debug("frame size: {}", .{acc_frame_size}); | |
| 1830 | log.debug("frame size: {f}", .{acc_frame_size}); | |
| 1831 | 1831 | |
| 1832 | 1832 | // store the ra at total_size - 8, so it's the very first thing in the stack |
| 1833 | 1833 | // relative to the fp |
| ... | ... | @@ -1888,7 +1888,7 @@ fn splitType(func: *Func, ty: Type) ![2]Type { |
| 1888 | 1888 | }, |
| 1889 | 1889 | else => unreachable, |
| 1890 | 1890 | }, |
| 1891 | else => return func.fail("TODO: splitType class {}", .{class}), | |
| 1891 | else => return func.fail("TODO: splitType class {f}", .{class}), | |
| 1892 | 1892 | }; |
| 1893 | 1893 | } else if (parts[0].abiSize(zcu) + parts[1].abiSize(zcu) == ty.abiSize(zcu)) return parts; |
| 1894 | 1894 | return func.fail("TODO implement splitType for {f}", .{ty.fmt(func.pt)}); |
| ... | ... | @@ -1992,7 +1992,7 @@ fn allocFrameIndex(func: *Func, alloc: FrameAlloc) !FrameIndex { |
| 1992 | 1992 | } |
| 1993 | 1993 | const frame_index: FrameIndex = @enumFromInt(func.frame_allocs.len); |
| 1994 | 1994 | try func.frame_allocs.append(func.gpa, alloc); |
| 1995 | log.debug("allocated frame {}", .{frame_index}); | |
| 1995 | log.debug("allocated frame {f}", .{frame_index}); | |
| 1996 | 1996 | return frame_index; |
| 1997 | 1997 | } |
| 1998 | 1998 |
src/arch/x86_64/CodeGen.zig+23-23| ... | ... | @@ -550,9 +550,9 @@ pub const MCValue = union(enum) { |
| 550 | 550 | @tagName(pl.reg), |
| 551 | 551 | }), |
| 552 | 552 | .indirect => |pl| try bw.print("[{s} + 0x{x}]", .{ @tagName(pl.reg), pl.off }), |
| 553 | .indirect_load_frame => |pl| try bw.print("[[{} + 0x{x}]]", .{ pl.index, pl.off }), | |
| 554 | .load_frame => |pl| try bw.print("[{} + 0x{x}]", .{ pl.index, pl.off }), | |
| 555 | .lea_frame => |pl| try bw.print("{} + 0x{x}", .{ pl.index, pl.off }), | |
| 553 | .indirect_load_frame => |pl| try bw.print("[[{f} + 0x{x}]]", .{ pl.index, pl.off }), | |
| 554 | .load_frame => |pl| try bw.print("[{f} + 0x{x}]", .{ pl.index, pl.off }), | |
| 555 | .lea_frame => |pl| try bw.print("{f} + 0x{x}", .{ pl.index, pl.off }), | |
| 556 | 556 | .load_nav => |pl| try bw.print("[nav:{d}]", .{@intFromEnum(pl)}), |
| 557 | 557 | .lea_nav => |pl| try bw.print("nav:{d}", .{@intFromEnum(pl)}), |
| 558 | 558 | .load_uav => |pl| try bw.print("[uav:{d}]", .{@intFromEnum(pl.val)}), |
| ... | ... | @@ -561,10 +561,10 @@ pub const MCValue = union(enum) { |
| 561 | 561 | .lea_lazy_sym => |pl| try bw.print("lazy:{s}:{d}", .{ @tagName(pl.kind), @intFromEnum(pl.ty) }), |
| 562 | 562 | .load_extern_func => |pl| try bw.print("[extern:{d}]", .{@intFromEnum(pl)}), |
| 563 | 563 | .lea_extern_func => |pl| try bw.print("extern:{d}", .{@intFromEnum(pl)}), |
| 564 | .elementwise_args => |pl| try bw.print("elementwise:{d}:[{} + 0x{x}]", .{ | |
| 564 | .elementwise_args => |pl| try bw.print("elementwise:{d}:[{f} + 0x{x}]", .{ | |
| 565 | 565 | pl.regs, pl.frame_index, pl.frame_off, |
| 566 | 566 | }), |
| 567 | .reserved_frame => |pl| try bw.print("(dead:{})", .{pl}), | |
| 567 | .reserved_frame => |pl| try bw.print("(dead:{f})", .{pl}), | |
| 568 | 568 | .air_ref => |pl| try bw.print("(air:0x{x})", .{@intFromEnum(pl)}), |
| 569 | 569 | } |
| 570 | 570 | } |
| ... | ... | @@ -1195,7 +1195,7 @@ fn formatWipMir(data: FormatWipMirData, w: *Writer) Writer.Error!void { |
| 1195 | 1195 | }; |
| 1196 | 1196 | try w.print(" {f}", .{mem_op.fmt(.m)}); |
| 1197 | 1197 | }, |
| 1198 | .pseudo_dbg_arg_val, .pseudo_dbg_var_val => try w.print(" {}", .{ | |
| 1198 | .pseudo_dbg_arg_val, .pseudo_dbg_var_val => try w.print(" {f}", .{ | |
| 1199 | 1199 | Value.fromInterned(mir_inst.data.ip_index).fmtValue(data.self.pt), |
| 1200 | 1200 | }), |
| 1201 | 1201 | } |
| ... | ... | @@ -12887,7 +12887,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 12887 | 12887 | .{ ._, ._nc, .j, .@"0b", ._, ._, ._ }, |
| 12888 | 12888 | } }, |
| 12889 | 12889 | } }) catch |err| switch (err) { |
| 12890 | error.SelectFailed => return cg.fail("failed to select {s} {} {} {}", .{ | |
| 12890 | error.SelectFailed => return cg.fail("failed to select {s} {f} {f} {f}", .{ | |
| 12891 | 12891 | @tagName(air_tag), |
| 12892 | 12892 | cg.typeOf(bin_op.lhs).fmt(pt), |
| 12893 | 12893 | ops[0].tracking(cg), |
| ... | ... | @@ -21764,7 +21764,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 21764 | 21764 | .{ ._, ._nc, .j, .@"0b", ._, ._, ._ }, |
| 21765 | 21765 | } }, |
| 21766 | 21766 | } }) catch |err| switch (err) { |
| 21767 | error.SelectFailed => return cg.fail("failed to select {s} {} {} {}", .{ | |
| 21767 | error.SelectFailed => return cg.fail("failed to select {s} {f} {f} {f}", .{ | |
| 21768 | 21768 | @tagName(air_tag), |
| 21769 | 21769 | cg.typeOf(bin_op.lhs).fmt(pt), |
| 21770 | 21770 | ops[0].tracking(cg), |
| ... | ... | @@ -32482,7 +32482,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 32482 | 32482 | .{ .@"0:", ._, .mov, .memad(.dst0q, .add_size, -8), .tmp3q, ._, ._ }, |
| 32483 | 32483 | } }, |
| 32484 | 32484 | } }) catch |err| switch (err) { |
| 32485 | error.SelectFailed => return cg.fail("failed to select {s} {} {} {}", .{ | |
| 32485 | error.SelectFailed => return cg.fail("failed to select {s} {f} {f} {f}", .{ | |
| 32486 | 32486 | @tagName(air_tag), |
| 32487 | 32487 | cg.typeOf(bin_op.lhs).fmt(pt), |
| 32488 | 32488 | ops[0].tracking(cg), |
| ... | ... | @@ -59310,7 +59310,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 59310 | 59310 | .{ ._, ._, .@"or", .tmp4q, .tmp5q, ._, ._ }, |
| 59311 | 59311 | } }, |
| 59312 | 59312 | } }) catch |err| switch (err) { |
| 59313 | error.SelectFailed => return cg.fail("failed to select {s} {} {} {}", .{ | |
| 59313 | error.SelectFailed => return cg.fail("failed to select {s} {f} {f} {f}", .{ | |
| 59314 | 59314 | @tagName(air_tag), |
| 59315 | 59315 | ty_pl.ty.toType().fmt(pt), |
| 59316 | 59316 | ops[0].tracking(cg), |
| ... | ... | @@ -60809,7 +60809,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 60809 | 60809 | .{ ._, ._, .@"or", .dst0d, .tmp0d, ._, ._ }, |
| 60810 | 60810 | } }, |
| 60811 | 60811 | } }) catch |err| switch (err) { |
| 60812 | error.SelectFailed => return cg.fail("failed to select {s} {} {}", .{ | |
| 60812 | error.SelectFailed => return cg.fail("failed to select {s} {f} {f}", .{ | |
| 60813 | 60813 | @tagName(air_tag), |
| 60814 | 60814 | cg.typeOf(bin_op.rhs).fmt(pt), |
| 60815 | 60815 | ops[1].tracking(cg), |
| ... | ... | @@ -64066,7 +64066,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 64066 | 64066 | .{ .@"0:", ._, .mov, .memad(.dst0q, .add_size, -8), .tmp1q, ._, ._ }, |
| 64067 | 64067 | } }, |
| 64068 | 64068 | } }) catch |err| switch (err) { |
| 64069 | error.SelectFailed => return cg.fail("failed to select {s} {} {} {}", .{ | |
| 64069 | error.SelectFailed => return cg.fail("failed to select {s} {f} {f} {f}", .{ | |
| 64070 | 64070 | @tagName(air_tag), |
| 64071 | 64071 | lhs_ty.fmt(pt), |
| 64072 | 64072 | ops[0].tracking(cg), |
| ... | ... | @@ -79428,7 +79428,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 79428 | 79428 | .@"struct", .@"union" => { |
| 79429 | 79429 | assert(ty.containerLayout(zcu) == .@"packed"); |
| 79430 | 79430 | for (&ops) |*op| op.wrapInt(cg) catch |err| switch (err) { |
| 79431 | error.SelectFailed => return cg.fail("failed to select {s} wrap {} {}", .{ | |
| 79431 | error.SelectFailed => return cg.fail("failed to select {s} wrap {f} {f}", .{ | |
| 79432 | 79432 | @tagName(air_tag), |
| 79433 | 79433 | ty.fmt(pt), |
| 79434 | 79434 | op.tracking(cg), |
| ... | ... | @@ -86521,7 +86521,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 86521 | 86521 | } }, |
| 86522 | 86522 | }), |
| 86523 | 86523 | }) catch |err| switch (err) { |
| 86524 | error.SelectFailed => return cg.fail("failed to select {s} {s} {} {} {}", .{ | |
| 86524 | error.SelectFailed => return cg.fail("failed to select {s} {s} {f} {f} {f}", .{ | |
| 86525 | 86525 | @tagName(air_tag), |
| 86526 | 86526 | @tagName(vector_cmp.compareOperator()), |
| 86527 | 86527 | cg.typeOf(vector_cmp.lhs).fmt(pt), |
| ... | ... | @@ -157186,7 +157186,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 157186 | 157186 | } }, |
| 157187 | 157187 | } }, |
| 157188 | 157188 | }) catch |err| switch (err) { |
| 157189 | error.SelectFailed => return cg.fail("failed to select {s}.{s} {} {}", .{ | |
| 157189 | error.SelectFailed => return cg.fail("failed to select {s}.{s} {f} {f}", .{ | |
| 157190 | 157190 | @tagName(air_tag), |
| 157191 | 157191 | @tagName(reduce.operation), |
| 157192 | 157192 | cg.typeOf(reduce.operand).fmt(pt), |
| ... | ... | @@ -157197,7 +157197,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 157197 | 157197 | switch (reduce.operation) { |
| 157198 | 157198 | .And, .Or, .Xor, .Min, .Max => {}, |
| 157199 | 157199 | .Add, .Mul => if (cg.intInfo(res_ty)) |_| res[0].wrapInt(cg) catch |err| switch (err) { |
| 157200 | error.SelectFailed => return cg.fail("failed to select {s}.{s} wrap {} {}", .{ | |
| 157200 | error.SelectFailed => return cg.fail("failed to select {s}.{s} wrap {f} {f}", .{ | |
| 157201 | 157201 | @tagName(air_tag), |
| 157202 | 157202 | @tagName(reduce.operation), |
| 157203 | 157203 | res_ty.fmt(pt), |
| ... | ... | @@ -164480,7 +164480,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 164480 | 164480 | } }, |
| 164481 | 164481 | } }, |
| 164482 | 164482 | }) catch |err| switch (err) { |
| 164483 | error.SelectFailed => return cg.fail("failed to select {s}.{s} {} {}", .{ | |
| 164483 | error.SelectFailed => return cg.fail("failed to select {s}.{s} {f} {f}", .{ | |
| 164484 | 164484 | @tagName(air_tag), |
| 164485 | 164485 | @tagName(reduce.operation), |
| 164486 | 164486 | cg.typeOf(reduce.operand).fmt(pt), |
| ... | ... | @@ -166277,7 +166277,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 166277 | 166277 | .{ ._, ._nz, .j, .@"0b", ._, ._, ._ }, |
| 166278 | 166278 | } }, |
| 166279 | 166279 | } }) catch |err| switch (err) { |
| 166280 | error.SelectFailed => return cg.fail("failed to select {s} {} {}", .{ | |
| 166280 | error.SelectFailed => return cg.fail("failed to select {s} {f} {f}", .{ | |
| 166281 | 166281 | @tagName(air_tag), |
| 166282 | 166282 | ty_op.ty.toType().fmt(pt), |
| 166283 | 166283 | ops[0].tracking(cg), |
| ... | ... | @@ -166293,7 +166293,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 166293 | 166293 | const bin_op = air_datas[@intFromEnum(inst)].bin_op; |
| 166294 | 166294 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }) ++ .{undefined}; |
| 166295 | 166295 | ops[2] = ops[0].getByteLen(cg) catch |err| switch (err) { |
| 166296 | error.SelectFailed => return cg.fail("failed to select {s} {} {} {} {}", .{ | |
| 166296 | error.SelectFailed => return cg.fail("failed to select {s} {f} {f} {f} {f}", .{ | |
| 166297 | 166297 | @tagName(air_tag), |
| 166298 | 166298 | cg.typeOf(bin_op.lhs).fmt(pt), |
| 166299 | 166299 | cg.typeOf(bin_op.rhs).fmt(pt), |
| ... | ... | @@ -166333,7 +166333,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 166333 | 166333 | } }, |
| 166334 | 166334 | }}, |
| 166335 | 166335 | }) catch |err| switch (err) { |
| 166336 | error.SelectFailed => return cg.fail("failed to select {s} {} {} {} {} {}", .{ | |
| 166336 | error.SelectFailed => return cg.fail("failed to select {s} {f} {f} {f} {f} {f}", .{ | |
| 166337 | 166337 | @tagName(air_tag), |
| 166338 | 166338 | cg.typeOf(bin_op.lhs).fmt(pt), |
| 166339 | 166339 | cg.typeOf(bin_op.rhs).fmt(pt), |
| ... | ... | @@ -181502,7 +181502,7 @@ fn genSetReg( |
| 181502 | 181502 | assert(!ty.optionalReprIsPayload(zcu)); |
| 181503 | 181503 | break :first_ty opt_child; |
| 181504 | 181504 | }, |
| 181505 | else => std.debug.panic("{s}: {}\n", .{ @src().fn_name, ty.fmt(pt) }), | |
| 181505 | else => std.debug.panic("{s}: {f}\n", .{ @src().fn_name, ty.fmt(pt) }), | |
| 181506 | 181506 | }); |
| 181507 | 181507 | const first_size: u31 = @intCast(first_ty.abiSize(zcu)); |
| 181508 | 181508 | const frame_size = std.math.ceilPowerOfTwoAssert(u32, abi_size); |
| ... | ... | @@ -186930,7 +186930,7 @@ const Temp = struct { |
| 186930 | 186930 | assert(src_regs.len == std.math.divCeil(u16, int_info.bits, 64) catch unreachable); |
| 186931 | 186931 | break :part_ty .u64; |
| 186932 | 186932 | } else part_ty: switch (ip.indexToKey(src_ty.toIntern())) { |
| 186933 | else => std.debug.panic("{s}: {}\n", .{ @src().fn_name, src_ty.fmt(cg.pt) }), | |
| 186933 | else => std.debug.panic("{s}: {f}\n", .{ @src().fn_name, src_ty.fmt(cg.pt) }), | |
| 186934 | 186934 | .ptr_type => |ptr_info| { |
| 186935 | 186935 | assert(ptr_info.flags.size == .slice); |
| 186936 | 186936 | assert(src_regs.len == 2); |
| ... | ... | @@ -186941,7 +186941,7 @@ const Temp = struct { |
| 186941 | 186941 | break :part_ty try cg.pt.intType(.unsigned, @as(u16, 8) * @min(src_abi_size, 8)); |
| 186942 | 186942 | }, |
| 186943 | 186943 | .opt_type => |opt_child| switch (ip.indexToKey(opt_child)) { |
| 186944 | else => std.debug.panic("{s}: {}\n", .{ @src().fn_name, src_ty.fmt(cg.pt) }), | |
| 186944 | else => std.debug.panic("{s}: {f}\n", .{ @src().fn_name, src_ty.fmt(cg.pt) }), | |
| 186945 | 186945 | .ptr_type => |ptr_info| { |
| 186946 | 186946 | assert(ptr_info.flags.size == .slice); |
| 186947 | 186947 | assert(src_regs.len == 2); |
src/arch/x86_64/encoder.zig+1-1| ... | ... | @@ -259,7 +259,7 @@ pub const Instruction = struct { |
| 259 | 259 | switch (sib.base) { |
| 260 | 260 | .none => any = false, |
| 261 | 261 | .reg => |reg| try w.print("{s}", .{@tagName(reg)}), |
| 262 | .frame => |frame_index| try w.print("{}", .{frame_index}), | |
| 262 | .frame => |frame_index| try w.print("{f}", .{frame_index}), | |
| 263 | 263 | .table => try w.print("Table", .{}), |
| 264 | 264 | .rip_inst => |inst_index| try w.print("RipInst({d})", .{inst_index}), |
| 265 | 265 | .nav => |nav| try w.print("Nav({d})", .{@intFromEnum(nav)}), |
src/link/Coff.zig+1-1| ... | ... | @@ -2625,7 +2625,7 @@ fn logImportTables(coff: *const Coff) void { |
| 2625 | 2625 | log.debug("import tables:", .{}); |
| 2626 | 2626 | for (coff.import_tables.keys(), 0..) |off, i| { |
| 2627 | 2627 | const itable = coff.import_tables.values()[i]; |
| 2628 | log.debug("{}", .{itable.fmtDebug(.{ | |
| 2628 | log.debug("{f}", .{itable.fmtDebug(.{ | |
| 2629 | 2629 | .coff = coff, |
| 2630 | 2630 | .index = i, |
| 2631 | 2631 | .name_off = off, |
src/link/MachO/relocatable.zig+1-1| ... | ... | @@ -202,7 +202,7 @@ pub fn flushStaticLib(macho_file: *MachO, comp: *Compilation, module_obj_path: ? |
| 202 | 202 | }; |
| 203 | 203 | |
| 204 | 204 | if (build_options.enable_logging) { |
| 205 | state_log.debug("ar_symtab\n{}\n", .{ar_symtab.fmt(macho_file)}); | |
| 205 | state_log.debug("ar_symtab\n{f}\n", .{ar_symtab.fmt(macho_file)}); | |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | var buffer = std.ArrayList(u8).init(gpa); |
src/link/Wasm/Object.zig+7-7| ... | ... | @@ -856,7 +856,7 @@ pub fn parse( |
| 856 | 856 | start_function = @enumFromInt(functions_start + index); |
| 857 | 857 | }, |
| 858 | 858 | .element => { |
| 859 | log.warn("unimplemented: element section in {} {?s}", .{ path, archive_member_name }); | |
| 859 | log.warn("unimplemented: element section in {f} {?s}", .{ path, archive_member_name }); | |
| 860 | 860 | pos = section_end; |
| 861 | 861 | }, |
| 862 | 862 | .code => { |
| ... | ... | @@ -984,10 +984,10 @@ pub fn parse( |
| 984 | 984 | if (gop.value_ptr.type != fn_ty_index) { |
| 985 | 985 | var err = try diags.addErrorWithNotes(2); |
| 986 | 986 | try err.addMsg("symbol '{s}' mismatching function signatures", .{name.slice(wasm)}); |
| 987 | gop.value_ptr.source_location.addNote(&err, "imported as {} here", .{ | |
| 987 | gop.value_ptr.source_location.addNote(&err, "imported as {f} here", .{ | |
| 988 | 988 | gop.value_ptr.type.fmt(wasm), |
| 989 | 989 | }); |
| 990 | source_location.addNote(&err, "imported as {} here", .{fn_ty_index.fmt(wasm)}); | |
| 990 | source_location.addNote(&err, "imported as {f} here", .{fn_ty_index.fmt(wasm)}); | |
| 991 | 991 | continue; |
| 992 | 992 | } |
| 993 | 993 | if (gop.value_ptr.module_name != ptr.module_name.toOptional()) { |
| ... | ... | @@ -1155,11 +1155,11 @@ pub fn parse( |
| 1155 | 1155 | if (gop.value_ptr.type != ptr.type_index) { |
| 1156 | 1156 | var err = try diags.addErrorWithNotes(2); |
| 1157 | 1157 | try err.addMsg("function signature mismatch: {s}", .{name.slice(wasm)}); |
| 1158 | gop.value_ptr.source_location.addNote(&err, "exported as {} here", .{ | |
| 1158 | gop.value_ptr.source_location.addNote(&err, "exported as {f} here", .{ | |
| 1159 | 1159 | ptr.type_index.fmt(wasm), |
| 1160 | 1160 | }); |
| 1161 | 1161 | const word = if (gop.value_ptr.resolution == .unresolved) "imported" else "exported"; |
| 1162 | source_location.addNote(&err, "{s} as {} here", .{ word, gop.value_ptr.type.fmt(wasm) }); | |
| 1162 | source_location.addNote(&err, "{s} as {f} here", .{ word, gop.value_ptr.type.fmt(wasm) }); | |
| 1163 | 1163 | continue; |
| 1164 | 1164 | } |
| 1165 | 1165 | if (gop.value_ptr.resolution == .unresolved or gop.value_ptr.flags.binding == .weak) { |
| ... | ... | @@ -1176,8 +1176,8 @@ pub fn parse( |
| 1176 | 1176 | } |
| 1177 | 1177 | var err = try diags.addErrorWithNotes(2); |
| 1178 | 1178 | try err.addMsg("symbol collision: {s}", .{name.slice(wasm)}); |
| 1179 | gop.value_ptr.source_location.addNote(&err, "exported as {} here", .{ptr.type_index.fmt(wasm)}); | |
| 1180 | source_location.addNote(&err, "exported as {} here", .{gop.value_ptr.type.fmt(wasm)}); | |
| 1179 | gop.value_ptr.source_location.addNote(&err, "exported as {f} here", .{ptr.type_index.fmt(wasm)}); | |
| 1180 | source_location.addNote(&err, "exported as {f} here", .{gop.value_ptr.type.fmt(wasm)}); | |
| 1181 | 1181 | continue; |
| 1182 | 1182 | } else { |
| 1183 | 1183 | gop.value_ptr.* = .{ |
src/register_manager.zig+8-8| ... | ... | @@ -149,7 +149,7 @@ pub fn RegisterManager( |
| 149 | 149 | /// Only the owner of the `RegisterLock` can unlock the |
| 150 | 150 | /// register later. |
| 151 | 151 | pub fn lockRegIndex(self: *Self, tracked_index: TrackedIndex) ?RegisterLock { |
| 152 | log.debug("locking {}", .{regAtTrackedIndex(tracked_index)}); | |
| 152 | log.debug("locking {f}", .{regAtTrackedIndex(tracked_index)}); | |
| 153 | 153 | if (self.isRegIndexLocked(tracked_index)) { |
| 154 | 154 | log.debug(" register already locked", .{}); |
| 155 | 155 | return null; |
| ... | ... | @@ -164,7 +164,7 @@ pub fn RegisterManager( |
| 164 | 164 | /// Like `lockReg` but asserts the register was unused always |
| 165 | 165 | /// returning a valid lock. |
| 166 | 166 | pub fn lockRegIndexAssumeUnused(self: *Self, tracked_index: TrackedIndex) RegisterLock { |
| 167 | log.debug("locking asserting free {}", .{regAtTrackedIndex(tracked_index)}); | |
| 167 | log.debug("locking asserting free {f}", .{regAtTrackedIndex(tracked_index)}); | |
| 168 | 168 | assert(!self.isRegIndexLocked(tracked_index)); |
| 169 | 169 | self.locked_registers.set(tracked_index); |
| 170 | 170 | return RegisterLock{ .tracked_index = tracked_index }; |
| ... | ... | @@ -202,7 +202,7 @@ pub fn RegisterManager( |
| 202 | 202 | /// Requires `RegisterLock` to unlock a register. |
| 203 | 203 | /// Call `lockReg` to obtain the lock first. |
| 204 | 204 | pub fn unlockReg(self: *Self, lock: RegisterLock) void { |
| 205 | log.debug("unlocking {}", .{regAtTrackedIndex(lock.tracked_index)}); | |
| 205 | log.debug("unlocking {f}", .{regAtTrackedIndex(lock.tracked_index)}); | |
| 206 | 206 | self.locked_registers.unset(lock.tracked_index); |
| 207 | 207 | } |
| 208 | 208 | |
| ... | ... | @@ -238,7 +238,7 @@ pub fn RegisterManager( |
| 238 | 238 | if (i < count) return null; |
| 239 | 239 | |
| 240 | 240 | for (regs, insts) |reg, inst| { |
| 241 | log.debug("tryAllocReg {} for inst {?}", .{ reg, inst }); | |
| 241 | log.debug("tryAllocReg {f} for inst {f}", .{ reg, inst }); | |
| 242 | 242 | self.markRegAllocated(reg); |
| 243 | 243 | |
| 244 | 244 | if (inst) |tracked_inst| { |
| ... | ... | @@ -317,7 +317,7 @@ pub fn RegisterManager( |
| 317 | 317 | tracked_index: TrackedIndex, |
| 318 | 318 | inst: ?Air.Inst.Index, |
| 319 | 319 | ) AllocationError!void { |
| 320 | log.debug("getReg {} for inst {?}", .{ regAtTrackedIndex(tracked_index), inst }); | |
| 320 | log.debug("getReg {f} for inst {f}", .{ regAtTrackedIndex(tracked_index), inst }); | |
| 321 | 321 | if (!self.isRegIndexFree(tracked_index)) { |
| 322 | 322 | // Move the instruction that was previously there to a |
| 323 | 323 | // stack allocation. |
| ... | ... | @@ -330,7 +330,7 @@ pub fn RegisterManager( |
| 330 | 330 | self.getRegIndexAssumeFree(tracked_index, inst); |
| 331 | 331 | } |
| 332 | 332 | pub fn getReg(self: *Self, reg: Register, inst: ?Air.Inst.Index) AllocationError!void { |
| 333 | log.debug("getting reg: {}", .{reg}); | |
| 333 | log.debug("getting reg: {f}", .{reg}); | |
| 334 | 334 | return self.getRegIndex(indexOfRegIntoTracked(reg) orelse return, inst); |
| 335 | 335 | } |
| 336 | 336 | pub fn getKnownReg( |
| ... | ... | @@ -349,7 +349,7 @@ pub fn RegisterManager( |
| 349 | 349 | tracked_index: TrackedIndex, |
| 350 | 350 | inst: ?Air.Inst.Index, |
| 351 | 351 | ) void { |
| 352 | log.debug("getRegAssumeFree {} for inst {?}", .{ regAtTrackedIndex(tracked_index), inst }); | |
| 352 | log.debug("getRegAssumeFree {f} for inst {f}", .{ regAtTrackedIndex(tracked_index), inst }); | |
| 353 | 353 | self.markRegIndexAllocated(tracked_index); |
| 354 | 354 | |
| 355 | 355 | assert(self.isRegIndexFree(tracked_index)); |
| ... | ... | @@ -364,7 +364,7 @@ pub fn RegisterManager( |
| 364 | 364 | |
| 365 | 365 | /// Marks the specified register as free |
| 366 | 366 | pub fn freeRegIndex(self: *Self, tracked_index: TrackedIndex) void { |
| 367 | log.debug("freeing register {}", .{regAtTrackedIndex(tracked_index)}); | |
| 367 | log.debug("freeing register {f}", .{regAtTrackedIndex(tracked_index)}); | |
| 368 | 368 | self.registers[tracked_index] = undefined; |
| 369 | 369 | self.markRegIndexFree(tracked_index); |
| 370 | 370 | } |