Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dwarf: implement more decls #21323

Merged
merged 10 commits into from
Sep 10, 2024
2 changes: 1 addition & 1 deletion ci/x86_64-linux-debug.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ stage3-debug/bin/zig build \

stage3-debug/bin/zig build test docs \
--maxrss 21000000000 \
-Dlldb=$HOME/deps/lldb-zig/Debug-befcd57a8/bin/lldb \
-Dlldb=$HOME/deps/lldb-zig/Debug-4a44163df/bin/lldb \
-fqemu \
-fwasmtime \
-Dstatic-llvm \
Expand Down
2 changes: 1 addition & 1 deletion ci/x86_64-linux-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ stage3-release/bin/zig build \

stage3-release/bin/zig build test docs \
--maxrss 21000000000 \
-Dlldb=$HOME/deps/lldb-zig/Release-befcd57a8/bin/lldb \
-Dlldb=$HOME/deps/lldb-zig/Release-4a44163df/bin/lldb \
-fqemu \
-fwasmtime \
-Dstatic-llvm \
Expand Down
8 changes: 5 additions & 3 deletions lib/std/hash_map.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1767,9 +1767,11 @@ pub fn HashMapUnmanaged(
}

comptime {
if (!builtin.strip_debug_info) {
_ = &dbHelper;
}
if (!builtin.strip_debug_info) _ = switch (builtin.zig_backend) {
.stage2_llvm => &dbHelper,
.stage2_x86_64 => KV,
else => {},
};
}
};
}
Expand Down
2 changes: 1 addition & 1 deletion lib/std/multi_array_list.zig
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ pub fn MultiArrayList(comptime T: type) type {
}

comptime {
if (!builtin.strip_debug_info) {
if (builtin.zig_backend == .stage2_llvm and !builtin.strip_debug_info) {
_ = &dbHelper;
_ = &Slice.dbHelper;
}
Expand Down
2 changes: 1 addition & 1 deletion src/InternPool.zig
Original file line number Diff line number Diff line change
Expand Up @@ -4723,7 +4723,7 @@ pub const Index = enum(u32) {
}

comptime {
if (!builtin.strip_debug_info) {
if (builtin.zig_backend == .stage2_llvm and !builtin.strip_debug_info) {
_ = &dbHelper;
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/arch/aarch64/CodeGen.zig
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ const Alignment = InternPool.Alignment;

const CodeGenError = codegen.CodeGenError;
const Result = codegen.Result;
const DebugInfoOutput = codegen.DebugInfoOutput;

const bits = @import("bits.zig");
const abi = @import("abi.zig");
Expand All @@ -48,7 +47,7 @@ pt: Zcu.PerThread,
air: Air,
liveness: Liveness,
bin_file: *link.File,
debug_output: DebugInfoOutput,
debug_output: link.File.DebugInfoOutput,
target: *const std.Target,
func_index: InternPool.Index,
owner_nav: InternPool.Nav.Index,
Expand Down Expand Up @@ -327,7 +326,7 @@ pub fn generate(
air: Air,
liveness: Liveness,
code: *std.ArrayList(u8),
debug_output: DebugInfoOutput,
debug_output: link.File.DebugInfoOutput,
) CodeGenError!Result {
const zcu = pt.zcu;
const gpa = zcu.gpa;
Expand Down
3 changes: 1 addition & 2 deletions src/arch/aarch64/Emit.zig
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@ const assert = std.debug.assert;
const Instruction = bits.Instruction;
const Register = bits.Register;
const log = std.log.scoped(.aarch64_emit);
const DebugInfoOutput = @import("../../codegen.zig").DebugInfoOutput;

mir: Mir,
bin_file: *link.File,
debug_output: DebugInfoOutput,
debug_output: link.File.DebugInfoOutput,
target: *const std.Target,
err_msg: ?*ErrorMsg = null,
src_loc: Zcu.LazySrcLoc,
Expand Down
5 changes: 2 additions & 3 deletions src/arch/arm/CodeGen.zig
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ const Alignment = InternPool.Alignment;

const Result = codegen.Result;
const CodeGenError = codegen.CodeGenError;
const DebugInfoOutput = codegen.DebugInfoOutput;

const bits = @import("bits.zig");
const abi = @import("abi.zig");
Expand All @@ -49,7 +48,7 @@ pt: Zcu.PerThread,
air: Air,
liveness: Liveness,
bin_file: *link.File,
debug_output: DebugInfoOutput,
debug_output: link.File.DebugInfoOutput,
target: *const std.Target,
func_index: InternPool.Index,
err_msg: ?*ErrorMsg,
Expand Down Expand Up @@ -335,7 +334,7 @@ pub fn generate(
air: Air,
liveness: Liveness,
code: *std.ArrayList(u8),
debug_output: DebugInfoOutput,
debug_output: link.File.DebugInfoOutput,
) CodeGenError!Result {
const zcu = pt.zcu;
const gpa = zcu.gpa;
Expand Down
3 changes: 1 addition & 2 deletions src/arch/arm/Emit.zig
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ const assert = std.debug.assert;
const Instruction = bits.Instruction;
const Register = bits.Register;
const log = std.log.scoped(.aarch32_emit);
const DebugInfoOutput = @import("../../codegen.zig").DebugInfoOutput;
const CodeGen = @import("CodeGen.zig");

mir: Mir,
bin_file: *link.File,
debug_output: DebugInfoOutput,
debug_output: link.File.DebugInfoOutput,
target: *const std.Target,
err_msg: ?*ErrorMsg = null,
src_loc: Zcu.LazySrcLoc,
Expand Down
7 changes: 3 additions & 4 deletions src/arch/riscv64/CodeGen.zig
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ const Alignment = InternPool.Alignment;

const CodeGenError = codegen.CodeGenError;
const Result = codegen.Result;
const DebugInfoOutput = codegen.DebugInfoOutput;

const bits = @import("bits.zig");
const abi = @import("abi.zig");
Expand Down Expand Up @@ -61,7 +60,7 @@ gpa: Allocator,

mod: *Package.Module,
target: *const std.Target,
debug_output: DebugInfoOutput,
debug_output: link.File.DebugInfoOutput,
err_msg: ?*ErrorMsg,
args: []MCValue,
ret_mcv: InstTracking,
Expand Down Expand Up @@ -760,7 +759,7 @@ pub fn generate(
air: Air,
liveness: Liveness,
code: *std.ArrayList(u8),
debug_output: DebugInfoOutput,
debug_output: link.File.DebugInfoOutput,
) CodeGenError!Result {
const zcu = pt.zcu;
const comp = zcu.comp;
Expand Down Expand Up @@ -928,7 +927,7 @@ pub fn generateLazy(
src_loc: Zcu.LazySrcLoc,
lazy_sym: link.File.LazySymbol,
code: *std.ArrayList(u8),
debug_output: DebugInfoOutput,
debug_output: link.File.DebugInfoOutput,
) CodeGenError!Result {
const comp = bin_file.comp;
const gpa = comp.gpa;
Expand Down
3 changes: 1 addition & 2 deletions src/arch/riscv64/Emit.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

bin_file: *link.File,
lower: Lower,
debug_output: DebugInfoOutput,
debug_output: link.File.DebugInfoOutput,
code: *std.ArrayList(u8),

prev_di_line: u32,
Expand Down Expand Up @@ -216,7 +216,6 @@ const log = std.log.scoped(.emit);
const mem = std.mem;
const std = @import("std");

const DebugInfoOutput = @import("../../codegen.zig").DebugInfoOutput;
const Emit = @This();
const Lower = @import("Lower.zig");
const Mir = @import("Mir.zig");
Expand Down
5 changes: 2 additions & 3 deletions src/arch/sparc64/CodeGen.zig
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const Liveness = @import("../../Liveness.zig");
const Type = @import("../../Type.zig");
const CodeGenError = codegen.CodeGenError;
const Result = @import("../../codegen.zig").Result;
const DebugInfoOutput = @import("../../codegen.zig").DebugInfoOutput;
const Endian = std.builtin.Endian;
const Alignment = InternPool.Alignment;

Expand Down Expand Up @@ -57,7 +56,7 @@ bin_file: *link.File,
target: *const std.Target,
func_index: InternPool.Index,
code: *std.ArrayList(u8),
debug_output: DebugInfoOutput,
debug_output: link.File.DebugInfoOutput,
err_msg: ?*ErrorMsg,
args: []MCValue,
ret_mcv: MCValue,
Expand Down Expand Up @@ -268,7 +267,7 @@ pub fn generate(
air: Air,
liveness: Liveness,
code: *std.ArrayList(u8),
debug_output: DebugInfoOutput,
debug_output: link.File.DebugInfoOutput,
) CodeGenError!Result {
const zcu = pt.zcu;
const gpa = zcu.gpa;
Expand Down
3 changes: 1 addition & 2 deletions src/arch/sparc64/Emit.zig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const Zcu = @import("../../Zcu.zig");
const ErrorMsg = Zcu.ErrorMsg;
const Liveness = @import("../../Liveness.zig");
const log = std.log.scoped(.sparcv9_emit);
const DebugInfoOutput = @import("../../codegen.zig").DebugInfoOutput;

const Emit = @This();
const Mir = @import("Mir.zig");
Expand All @@ -19,7 +18,7 @@ const Register = bits.Register;

mir: Mir,
bin_file: *link.File,
debug_output: DebugInfoOutput,
debug_output: link.File.DebugInfoOutput,
target: *const std.Target,
err_msg: ?*ErrorMsg = null,
src_loc: Zcu.LazySrcLoc,
Expand Down
4 changes: 2 additions & 2 deletions src/arch/wasm/CodeGen.zig
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ block_depth: u32 = 0,
air: Air,
liveness: Liveness,
gpa: mem.Allocator,
debug_output: codegen.DebugInfoOutput,
debug_output: link.File.DebugInfoOutput,
func_index: InternPool.Index,
/// Contains a list of current branches.
/// When we return from a branch, the branch will be popped from this list,
Expand Down Expand Up @@ -1211,7 +1211,7 @@ pub fn generate(
air: Air,
liveness: Liveness,
code: *std.ArrayList(u8),
debug_output: codegen.DebugInfoOutput,
debug_output: link.File.DebugInfoOutput,
) codegen.CodeGenError!codegen.Result {
const zcu = pt.zcu;
const gpa = zcu.gpa;
Expand Down
2 changes: 1 addition & 1 deletion src/arch/wasm/Emit.zig
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ owner_nav: InternPool.Nav.Index,

// Debug information
/// Holds the debug information for this emission
dbg_output: codegen.DebugInfoOutput,
dbg_output: link.File.DebugInfoOutput,
/// Previous debug info line
prev_di_line: u32,
/// Previous debug info column
Expand Down
7 changes: 3 additions & 4 deletions src/arch/x86_64/CodeGen.zig
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const Air = @import("../../Air.zig");
const Allocator = mem.Allocator;
const CodeGenError = codegen.CodeGenError;
const Compilation = @import("../../Compilation.zig");
const DebugInfoOutput = codegen.DebugInfoOutput;
const ErrorMsg = Zcu.ErrorMsg;
const Result = codegen.Result;
const Emit = @import("Emit.zig");
Expand Down Expand Up @@ -53,7 +52,7 @@ pt: Zcu.PerThread,
air: Air,
liveness: Liveness,
bin_file: *link.File,
debug_output: DebugInfoOutput,
debug_output: link.File.DebugInfoOutput,
target: *const std.Target,
owner: Owner,
inline_func: InternPool.Index,
Expand Down Expand Up @@ -819,7 +818,7 @@ pub fn generate(
air: Air,
liveness: Liveness,
code: *std.ArrayList(u8),
debug_output: DebugInfoOutput,
debug_output: link.File.DebugInfoOutput,
) CodeGenError!Result {
const zcu = pt.zcu;
const comp = zcu.comp;
Expand Down Expand Up @@ -1000,7 +999,7 @@ pub fn generateLazy(
src_loc: Zcu.LazySrcLoc,
lazy_sym: link.File.LazySymbol,
code: *std.ArrayList(u8),
debug_output: DebugInfoOutput,
debug_output: link.File.DebugInfoOutput,
) CodeGenError!Result {
const comp = bin_file.comp;
const gpa = comp.gpa;
Expand Down
3 changes: 1 addition & 2 deletions src/arch/x86_64/Emit.zig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
air: Air,
lower: Lower,
atom_index: u32,
debug_output: DebugInfoOutput,
debug_output: link.File.DebugInfoOutput,
code: *std.ArrayList(u8),

prev_di_line: u32,
Expand Down Expand Up @@ -546,7 +546,6 @@ const log = std.log.scoped(.emit);
const std = @import("std");

const Air = @import("../../Air.zig");
const DebugInfoOutput = @import("../../codegen.zig").DebugInfoOutput;
const Emit = @This();
const Lower = @import("Lower.zig");
const Mir = @import("Mir.zig");
Loading