Skip to content

Commit 884893c

Browse files
jacobly0mlugg
authored andcommitted
x86_64: fix dbg_var_ptr types in debug info
1 parent 3a51d17 commit 884893c

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

src/arch/x86_64/CodeGen.zig

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85046,13 +85046,15 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
8504685046
.data = .{ .ip_index = old_inline_func },
8504785047
});
8504885048
},
85049-
.dbg_var_ptr,
85050-
.dbg_var_val,
85051-
.dbg_arg_inline,
85052-
=> |air_tag| if (use_old) try cg.airDbgVar(inst) else if (!cg.mod.strip) {
85049+
.dbg_var_ptr, .dbg_var_val, .dbg_arg_inline => |air_tag| if (use_old) try cg.airDbgVar(inst) else if (!cg.mod.strip) {
8505385050
const pl_op = air_datas[@intFromEnum(inst)].pl_op;
8505485051
const air_name: Air.NullTerminatedString = @enumFromInt(pl_op.payload);
85055-
const ty = cg.typeOf(pl_op.operand);
85052+
const op_ty = cg.typeOf(pl_op.operand);
85053+
const local_ty = switch (air_tag) {
85054+
else => unreachable,
85055+
.dbg_var_ptr => op_ty.childType(zcu),
85056+
.dbg_var_val, .dbg_arg_inline => op_ty,
85057+
};
8505685058
var ops = try cg.tempsFromOperands(inst, .{pl_op.operand});
8505785059
var mcv = ops[0].tracking(cg).short;
8505885060
switch (mcv) {
@@ -85076,10 +85078,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
8507685078
},
8507785079
else => try cg.addString(air_name.toSlice(cg.air)),
8507885080
},
85079-
.type = ty.toIntern(),
85081+
.type = local_ty.toIntern(),
8508085082
});
8508185083

85082-
try cg.genLocalDebugInfo(air_tag, ty, ops[0].tracking(cg).short);
85084+
try cg.genLocalDebugInfo(air_tag, local_ty, ops[0].tracking(cg).short);
8508385085
try ops[0].die(cg);
8508485086
},
8508585087
.is_null => if (use_old) try cg.airIsNull(inst) else {
@@ -174364,7 +174366,12 @@ fn airDbgVar(cg: *CodeGen, inst: Air.Inst.Index) !void {
174364174366
const air_tag = cg.air.instructions.items(.tag)[@intFromEnum(inst)];
174365174367
const pl_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].pl_op;
174366174368
const air_name: Air.NullTerminatedString = @enumFromInt(pl_op.payload);
174367-
const ty = cg.typeOf(pl_op.operand);
174369+
const op_ty = cg.typeOf(pl_op.operand);
174370+
const local_ty = switch (air_tag) {
174371+
else => unreachable,
174372+
.dbg_var_ptr => op_ty.childType(cg.pt.zcu),
174373+
.dbg_var_val, .dbg_arg_inline => op_ty,
174374+
};
174368174375

174369174376
try cg.mir_locals.append(cg.gpa, .{
174370174377
.name = switch (air_name) {
@@ -174374,10 +174381,10 @@ fn airDbgVar(cg: *CodeGen, inst: Air.Inst.Index) !void {
174374174381
},
174375174382
else => try cg.addString(air_name.toSlice(cg.air)),
174376174383
},
174377-
.type = ty.toIntern(),
174384+
.type = local_ty.toIntern(),
174378174385
});
174379174386

174380-
try cg.genLocalDebugInfo(air_tag, ty, try cg.resolveInst(pl_op.operand));
174387+
try cg.genLocalDebugInfo(air_tag, local_ty, try cg.resolveInst(pl_op.operand));
174381174388
return cg.finishAir(inst, .unreach, .{ pl_op.operand, .none, .none });
174382174389
}
174383174390

src/arch/x86_64/bits.zig

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -686,8 +686,6 @@ test "Register id - different classes" {
686686
try expect(Register.xmm0.id() == Register.ymm0.id());
687687
try expect(Register.xmm0.id() != Register.mm0.id());
688688
try expect(Register.mm0.id() != Register.st0.id());
689-
690-
try expect(Register.es.id() == 0b110000);
691689
}
692690

693691
test "Register enc - different classes" {

0 commit comments

Comments
 (0)