authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-09-02 20:49:37+02:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-09-07 22:42:56+02:00
log1d57b347e9aeddc2de33b1b77b331d36e4900425
treec4ffa0e8511a99767813e3174b9690f52d468e15
parentb9c31a8703fdd8297673aa65a1bdefd56cd13b77

x86_64: clean up logging


1 files changed, 12 insertions(+), 8 deletions(-)

src/arch/x86_64/CodeGen.zig+12-8
......@@ -222,6 +222,14 @@ const Branch = struct {
222222 try writer.writeAll("}");
223223 }
224224
225 fn format(branch: Branch, comptime unused_format_string: []const u8, options: std.fmt.FormatOptions, writer: anytype) !void {
226 _ = branch;
227 _ = unused_format_string;
228 _ = options;
229 _ = writer;
230 @compileError("do not format Branch directly; use ty.fmtDebug()");
231 }
232
225233 fn fmtDebug(self: @This()) std.fmt.Formatter(fmt) {
226234 return .{ .data = .{
227235 .insts = self.inst_table.keys(),
......@@ -823,7 +831,7 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
823831fn processDeath(self: *Self, inst: Air.Inst.Index) void {
824832 const air_tags = self.air.instructions.items(.tag);
825833 if (air_tags[inst] == .constant) return; // Constants are immortal.
826 log.debug(" (processing death of %{d})", .{inst});
834 log.debug("%{d} => {}", .{ inst, MCValue.dead });
827835 // When editing this function, note that the logic must synchronize with `reuseOperand`.
828836 const prev_value = self.getResolvedInstValue(inst);
829837 const branch = &self.branch_stack.items[self.branch_stack.items.len - 1];
......@@ -851,10 +859,8 @@ fn finishAirBookkeeping(self: *Self) void {
851859}
852860
853861fn finishAir(self: *Self, inst: Air.Inst.Index, result: MCValue, operands: [Liveness.bpi - 1]Air.Inst.Ref) void {
854 log.debug("finishAir: %{d}, {}, {any}", .{ inst, result, operands });
855862 var tomb_bits = self.liveness.getTombBits(inst);
856863 for (operands) |op| {
857 log.debug(" (processing {})", .{op});
858864 const dies = @truncate(u1, tomb_bits) != 0;
859865 tomb_bits >>= 1;
860866 if (!dies) continue;
......@@ -865,7 +871,7 @@ fn finishAir(self: *Self, inst: Air.Inst.Index, result: MCValue, operands: [Live
865871 }
866872 const is_used = @truncate(u1, tomb_bits) == 0;
867873 if (is_used) {
868 log.debug(" (saving %{d} => {})", .{ inst, result });
874 log.debug("%{d} => {}", .{ inst, result });
869875 const branch = &self.branch_stack.items[self.branch_stack.items.len - 1];
870876 branch.inst_table.putAssumeCapacityNoClobber(inst, result);
871877
......@@ -4678,8 +4684,6 @@ fn airCondBr(self: *Self, inst: Air.Inst.Index) !void {
46784684
46794685 const reloc = try self.genCondBrMir(cond_ty, cond);
46804686
4681 log.debug("airCondBr: %{d}", .{inst});
4682
46834687 // If the condition dies here in this condbr instruction, process
46844688 // that death now instead of later as this has an effect on
46854689 // whether it needs to be spilled in the branches
......@@ -4736,6 +4740,7 @@ fn airCondBr(self: *Self, inst: Air.Inst.Index) !void {
47364740 // that we can use all the code emitting abstractions. This is why at the bottom we
47374741 // assert that parent_branch.free_registers equals the saved_then_branch.free_registers
47384742 // rather than assigning it.
4743 log.debug("airCondBr: %{d}", .{inst});
47394744 log.debug("Upper branches:", .{});
47404745 for (self.branch_stack.items) |bs| {
47414746 log.debug("{}", .{bs.fmtDebug()});
......@@ -5119,8 +5124,6 @@ fn airSwitch(self: *Self, inst: Air.Inst.Index) !void {
51195124 );
51205125 defer self.gpa.free(liveness.deaths);
51215126
5122 log.debug("airSwitch: %{d}", .{inst});
5123
51245127 // If the condition dies here in this switch instruction, process
51255128 // that death now instead of later as this has an effect on
51265129 // whether it needs to be spilled in the branches
......@@ -5207,6 +5210,7 @@ fn airSwitch(self: *Self, inst: Air.Inst.Index) !void {
52075210
52085211 // Consolidate returned MCValues between prongs and else branch like we do
52095212 // in airCondBr.
5213 log.debug("airSwitch: %{d}", .{inst});
52105214 log.debug("Upper branches:", .{});
52115215 for (self.branch_stack.items) |bs| {
52125216 log.debug("{}", .{bs.fmtDebug()});