Skip to content

Commit 396eb73

Browse files
authored
Merge pull request #12228 from nektro/stage2-arch
remove 'builtin.stage2_arch', Sema is smart enough now
2 parents ae16c1d + ec7f713 commit 396eb73

9 files changed

+5
-92
lines changed

lib/std/os/plan9.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const std = @import("../std.zig");
22
const builtin = @import("builtin");
33

4-
pub const syscall_bits = switch (builtin.stage2_arch) {
4+
pub const syscall_bits = switch (builtin.cpu.arch) {
55
.x86_64 => @import("plan9/x86_64.zig"),
66
else => @compileError("more plan9 syscall implementations (needs more inline asm in stage2"),
77
};

lib/std/start.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ fn wWinMainCRTStartup2() callconv(.C) noreturn {
131131

132132
fn exit2(code: usize) noreturn {
133133
switch (native_os) {
134-
.linux => switch (builtin.stage2_arch) {
134+
.linux => switch (builtin.cpu.arch) {
135135
.x86_64 => {
136136
asm volatile ("syscall"
137137
:
@@ -175,7 +175,7 @@ fn exit2(code: usize) noreturn {
175175
else => @compileError("TODO"),
176176
},
177177
// exits(0)
178-
.plan9 => switch (builtin.stage2_arch) {
178+
.plan9 => switch (builtin.cpu.arch) {
179179
.x86_64 => {
180180
asm volatile (
181181
\\push $0

src/Compilation.zig

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4763,8 +4763,6 @@ pub fn generateBuiltinZigSource(comp: *Compilation, allocator: Allocator) Alloca
47634763
\\/// feature detection (i.e. with `@hasDecl` or `@hasField`) over version checks.
47644764
\\pub const zig_version = std.SemanticVersion.parse("{s}") catch unreachable;
47654765
\\pub const zig_backend = std.builtin.CompilerBackend.{};
4766-
\\/// Temporary until self-hosted supports the `cpu.arch` value.
4767-
\\pub const stage2_arch: std.Target.Cpu.Arch = .{};
47684766
\\
47694767
\\pub const output_mode = std.builtin.OutputMode.{};
47704768
\\pub const link_mode = std.builtin.LinkMode.{};
@@ -4779,7 +4777,6 @@ pub fn generateBuiltinZigSource(comp: *Compilation, allocator: Allocator) Alloca
47794777
, .{
47804778
build_options.version,
47814779
std.zig.fmtId(@tagName(zig_backend)),
4782-
std.zig.fmtId(@tagName(target.cpu.arch)),
47834780
std.zig.fmtId(@tagName(comp.bin_file.options.output_mode)),
47844781
std.zig.fmtId(@tagName(comp.bin_file.options.link_mode)),
47854782
comp.bin_file.options.is_test,

src/stage1/codegen.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10076,7 +10076,6 @@ Buf *codegen_generate_builtin_source(CodeGen *g) {
1007610076
buf_appendf(contents, "pub const single_threaded = %s;\n", bool_to_str(g->is_single_threaded));
1007710077
buf_appendf(contents, "pub const abi = std.Target.Abi.%s;\n", cur_abi);
1007810078
buf_appendf(contents, "pub const cpu = std.Target.Cpu.baseline(.%s);\n", cur_arch);
10079-
buf_appendf(contents, "pub const stage2_arch: std.Target.Cpu.Arch = .%s;\n", cur_arch);
1008010079
buf_appendf(contents, "pub const os = std.Target.Os.Tag.defaultVersionRange(.%s, .%s);\n", cur_os, cur_arch);
1008110080
buf_appendf(contents,
1008210081
"pub const target = std.Target{\n"

test/behavior.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ test {
159159
_ = @import("behavior/while.zig");
160160
_ = @import("behavior/widening.zig");
161161

162-
if (builtin.stage2_arch == .wasm32) {
162+
if (builtin.cpu.arch == .wasm32) {
163163
_ = @import("behavior/wasm.zig");
164164
}
165165

test/behavior/struct.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -963,7 +963,7 @@ test "tuple assigned to variable" {
963963

964964
test "comptime struct field" {
965965
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
966-
if (builtin.stage2_arch == .arm) return error.SkipZigTest; // TODO
966+
if (builtin.cpu.arch == .arm) return error.SkipZigTest; // TODO
967967

968968
const T = struct {
969969
a: i32,

test/cases/compile_errors/reify_type_for_tagged_union_with_extra_union_field.zig

Lines changed: 0 additions & 35 deletions
This file was deleted.

test/cases/riscv64-linux/hello_world_with_updates.0.zig

Lines changed: 0 additions & 21 deletions
This file was deleted.

test/cases/riscv64-linux/hello_world_with_updates.1.zig

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)