aboutsummaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
authorVeikka Tuominen <git@vexu.eu>2022-12-31 11:47:56 +0200
committerGitHub <noreply@github.com>2022-12-31 11:47:56 +0200
commitaf197d495478f7a5c33a6550d5525e86d797dc89 (patch)
treef7ef9ac5dd3131eca188e3e4bbcba4dc16fdd802 /src/arch
parentd86685ac9612c08e33f1d94f7f617d9c0da1b7bd (diff)
parentbd711dfd255447883d25f422031592e3824ca296 (diff)
downloadzig-af197d495478f7a5c33a6550d5525e86d797dc89.tar.gz
zig-af197d495478f7a5c33a6550d5525e86d797dc89.zip
Merge pull request #14130 from Vexu/debug-info
Debug info fixes
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/aarch64/CodeGen.zig3
-rw-r--r--src/arch/arm/CodeGen.zig5
-rw-r--r--src/arch/riscv64/CodeGen.zig9
-rw-r--r--src/arch/sparc64/CodeGen.zig9
-rw-r--r--src/arch/wasm/CodeGen.zig4
-rw-r--r--src/arch/x86_64/CodeGen.zig3
6 files changed, 19 insertions, 14 deletions
diff --git a/src/arch/aarch64/CodeGen.zig b/src/arch/aarch64/CodeGen.zig
index 60cf4d889f..3aee86c687 100644
--- a/src/arch/aarch64/CodeGen.zig
+++ b/src/arch/aarch64/CodeGen.zig
@@ -4158,7 +4158,8 @@ fn airArg(self: *Self, inst: Air.Inst.Index) !void {
const ty = self.air.typeOfIndex(inst);
const result = self.args[arg_index];
- const name = self.mod_fn.getParamName(self.bin_file.options.module.?, arg_index);
+ const src_index = self.air.instructions.items(.data)[inst].arg.src_index;
+ const name = self.mod_fn.getParamName(self.bin_file.options.module.?, src_index);
const mcv = switch (result) {
// Copy registers to the stack
diff --git a/src/arch/arm/CodeGen.zig b/src/arch/arm/CodeGen.zig
index 6c0d100575..73c97fb7e5 100644
--- a/src/arch/arm/CodeGen.zig
+++ b/src/arch/arm/CodeGen.zig
@@ -4037,8 +4037,9 @@ fn genInlineMemsetCode(
fn genArgDbgInfo(self: Self, inst: Air.Inst.Index, arg_index: u32) error{OutOfMemory}!void {
const mcv = self.args[arg_index];
- const ty = self.air.instructions.items(.data)[inst].ty;
- const name = self.mod_fn.getParamName(self.bin_file.options.module.?, arg_index);
+ const arg = self.air.instructions.items(.data)[inst].arg;
+ const ty = self.air.getRefType(arg.ty);
+ const name = self.mod_fn.getParamName(self.bin_file.options.module.?, arg.src_index);
switch (self.debug_output) {
.dwarf => |dw| {
diff --git a/src/arch/riscv64/CodeGen.zig b/src/arch/riscv64/CodeGen.zig
index dc03ead977..2c63f171ad 100644
--- a/src/arch/riscv64/CodeGen.zig
+++ b/src/arch/riscv64/CodeGen.zig
@@ -1608,9 +1608,10 @@ fn airFieldParentPtr(self: *Self, inst: Air.Inst.Index) !void {
return self.fail("TODO implement codegen airFieldParentPtr", .{});
}
-fn genArgDbgInfo(self: Self, inst: Air.Inst.Index, mcv: MCValue, arg_index: u32) !void {
- const ty = self.air.instructions.items(.data)[inst].ty;
- const name = self.mod_fn.getParamName(self.bin_file.options.module.?, arg_index);
+fn genArgDbgInfo(self: Self, inst: Air.Inst.Index, mcv: MCValue) !void {
+ const arg = self.air.instructions.items(.data)[inst].arg;
+ const ty = self.air.getRefType(arg.ty);
+ const name = self.mod_fn.getParamName(self.bin_file.options.module.?, arg.src_index);
switch (self.debug_output) {
.dwarf => |dw| switch (mcv) {
@@ -1640,7 +1641,7 @@ fn airArg(self: *Self, inst: Air.Inst.Index) !void {
// TODO support stack-only arguments
// TODO Copy registers to the stack
const mcv = result;
- try self.genArgDbgInfo(inst, mcv, @intCast(u32, arg_index));
+ try self.genArgDbgInfo(inst, mcv);
if (self.liveness.isUnused(inst))
return self.finishAirBookkeeping();
diff --git a/src/arch/sparc64/CodeGen.zig b/src/arch/sparc64/CodeGen.zig
index e0a8d75444..943d21c47b 100644
--- a/src/arch/sparc64/CodeGen.zig
+++ b/src/arch/sparc64/CodeGen.zig
@@ -1016,7 +1016,7 @@ fn airArg(self: *Self, inst: Air.Inst.Index) !void {
}
};
- try self.genArgDbgInfo(inst, mcv, @intCast(u32, arg_index));
+ try self.genArgDbgInfo(inst, mcv);
if (self.liveness.isUnused(inst))
return self.finishAirBookkeeping();
@@ -3407,9 +3407,10 @@ fn finishAir(self: *Self, inst: Air.Inst.Index, result: MCValue, operands: [Live
self.finishAirBookkeeping();
}
-fn genArgDbgInfo(self: Self, inst: Air.Inst.Index, mcv: MCValue, arg_index: u32) !void {
- const ty = self.air.instructions.items(.data)[inst].ty;
- const name = self.mod_fn.getParamName(self.bin_file.options.module.?, arg_index);
+fn genArgDbgInfo(self: Self, inst: Air.Inst.Index, mcv: MCValue) !void {
+ const arg = self.air.instructions.items(.data)[inst].arg;
+ const ty = self.air.getRefType(arg.ty);
+ const name = self.mod_fn.getParamName(self.bin_file.options.module.?, arg.src_index);
switch (self.debug_output) {
.dwarf => |dw| switch (mcv) {
diff --git a/src/arch/wasm/CodeGen.zig b/src/arch/wasm/CodeGen.zig
index 21d7926978..c27639e14a 100644
--- a/src/arch/wasm/CodeGen.zig
+++ b/src/arch/wasm/CodeGen.zig
@@ -2474,8 +2474,8 @@ fn airArg(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
switch (func.debug_output) {
.dwarf => |dwarf| {
- // TODO: Get the original arg index rather than wasm arg index
- const name = func.mod_fn.getParamName(func.bin_file.base.options.module.?, arg_index);
+ const src_index = func.air.instructions.items(.data)[inst].arg.src_index;
+ const name = func.mod_fn.getParamName(func.bin_file.base.options.module.?, src_index);
try dwarf.genArgDbgInfo(name, arg_ty, .wasm, func.mod_fn.owner_decl, .{
.wasm_local = arg.local.value,
});
diff --git a/src/arch/x86_64/CodeGen.zig b/src/arch/x86_64/CodeGen.zig
index 026611f24e..2ad31bf7ba 100644
--- a/src/arch/x86_64/CodeGen.zig
+++ b/src/arch/x86_64/CodeGen.zig
@@ -3799,7 +3799,8 @@ fn airArg(self: *Self, inst: Air.Inst.Index) !void {
const ty = self.air.typeOfIndex(inst);
const mcv = self.args[arg_index];
- const name = self.mod_fn.getParamName(self.bin_file.options.module.?, arg_index);
+ const src_index = self.air.instructions.items(.data)[inst].arg.src_index;
+ const name = self.mod_fn.getParamName(self.bin_file.options.module.?, src_index);
if (self.liveness.isUnused(inst))
return self.finishAirBookkeeping();