| author | |
| committer | |
| log | 463186e8565c717049fabd4ff1c2442053c8ba9a |
| tree | 953c1f5f517efbd1b34fd4392e397a6d627bc416 |
| parent | f84232714791137ab0e3f457b0eed773e476f293 |
The purpose of this is to save time in the edit-compile-test cycle when
working on stage2 code.3 files changed, 8 insertions(+), 0 deletions(-)
build.zig+2| ... | @@ -83,6 +83,7 @@ pub fn build(b: *Builder) !void { | ... | @@ -83,6 +83,7 @@ pub fn build(b: *Builder) !void { |
| 83 | test_step.dependOn(&exe.step); | 83 | test_step.dependOn(&exe.step); |
| 84 | b.default_step.dependOn(&exe.step); | 84 | b.default_step.dependOn(&exe.step); |
| 85 | 85 | ||
| 86 | exe.addBuildOption(bool, "skip_non_native", skip_non_native); | ||
| 86 | exe.addBuildOption(bool, "have_llvm", enable_llvm); | 87 | exe.addBuildOption(bool, "have_llvm", enable_llvm); |
| 87 | if (enable_llvm) { | 88 | if (enable_llvm) { |
| 88 | const config_h_text = if (config_h_path_option) |config_h_path| | 89 | const config_h_text = if (config_h_path_option) |config_h_path| |
| ... | @@ -166,6 +167,7 @@ pub fn build(b: *Builder) !void { | ... | @@ -166,6 +167,7 @@ pub fn build(b: *Builder) !void { |
| 166 | const is_wasmtime_enabled = b.option(bool, "enable-wasmtime", "Use Wasmtime to enable and run WASI libstd tests") orelse false; | 167 | const is_wasmtime_enabled = b.option(bool, "enable-wasmtime", "Use Wasmtime to enable and run WASI libstd tests") orelse false; |
| 167 | const glibc_multi_dir = b.option([]const u8, "enable-foreign-glibc", "Provide directory with glibc installations to run cross compiled tests that link glibc"); | 168 | const glibc_multi_dir = b.option([]const u8, "enable-foreign-glibc", "Provide directory with glibc installations to run cross compiled tests that link glibc"); |
| 168 | 169 | ||
| 170 | test_stage2.addBuildOption(bool, "skip_non_native", skip_non_native); | ||
| 169 | test_stage2.addBuildOption(bool, "is_stage1", false); | 171 | test_stage2.addBuildOption(bool, "is_stage1", false); |
| 170 | test_stage2.addBuildOption(bool, "have_llvm", enable_llvm); | 172 | test_stage2.addBuildOption(bool, "have_llvm", enable_llvm); |
| 171 | test_stage2.addBuildOption(bool, "enable_qemu", is_qemu_enabled); | 173 | test_stage2.addBuildOption(bool, "enable_qemu", is_qemu_enabled); |
src/codegen.zig+5| ... | @@ -16,6 +16,7 @@ const trace = @import("tracy.zig").trace; | ... | @@ -16,6 +16,7 @@ const trace = @import("tracy.zig").trace; |
| 16 | const DW = std.dwarf; | 16 | const DW = std.dwarf; |
| 17 | const leb128 = std.leb; | 17 | const leb128 = std.leb; |
| 18 | const log = std.log.scoped(.codegen); | 18 | const log = std.log.scoped(.codegen); |
| 19 | const build_options = @import("build_options"); | ||
| 19 | 20 | ||
| 20 | /// The codegen-related data that is stored in `ir.Inst.Block` instructions. | 21 | /// The codegen-related data that is stored in `ir.Inst.Block` instructions. |
| 21 | pub const BlockData = struct { | 22 | pub const BlockData = struct { |
| ... | @@ -427,6 +428,10 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { | ... | @@ -427,6 +428,10 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { |
| 427 | code: *std.ArrayList(u8), | 428 | code: *std.ArrayList(u8), |
| 428 | debug_output: DebugInfoOutput, | 429 | debug_output: DebugInfoOutput, |
| 429 | ) GenerateSymbolError!Result { | 430 | ) GenerateSymbolError!Result { |
| 431 | if (build_options.skip_non_native and std.Target.current.cpu.arch != arch) { | ||
| 432 | @panic("Attempted to compile for architecture that was disabled by build configuration"); | ||
| 433 | } | ||
| 434 | |||
| 430 | const module_fn = typed_value.val.cast(Value.Payload.Function).?.func; | 435 | const module_fn = typed_value.val.cast(Value.Payload.Function).?.func; |
| 431 | 436 | ||
| 432 | const fn_type = module_fn.owner_decl.typed_value.most_recent.typed_value.ty; | 437 | const fn_type = module_fn.owner_decl.typed_value.most_recent.typed_value.ty; |
src/config.zig.in+1| ... | @@ -4,3 +4,4 @@ pub const log_scopes: []const []const u8 = &[_][]const u8{}; | ... | @@ -4,3 +4,4 @@ pub const log_scopes: []const []const u8 = &[_][]const u8{}; |
| 4 | pub const zir_dumps: []const []const u8 = &[_][]const u8{}; | 4 | pub const zir_dumps: []const []const u8 = &[_][]const u8{}; |
| 5 | pub const enable_tracy = false; | 5 | pub const enable_tracy = false; |
| 6 | pub const is_stage1 = true; | 6 | pub const is_stage1 = true; |
| 7 | pub const skip_non_native = false; |