mirror of
https://github.com/ziglang/zig.git
synced 2026-02-15 05:48:31 +00:00
remove 'builtin.stage2_arch', Sema is smart enough now
This commit is contained in:
parent
ae16c1d083
commit
0879cbeed2
@ -1,7 +1,7 @@
|
||||
const std = @import("../std.zig");
|
||||
const builtin = @import("builtin");
|
||||
|
||||
pub const syscall_bits = switch (builtin.stage2_arch) {
|
||||
pub const syscall_bits = switch (builtin.cpu.arch) {
|
||||
.x86_64 => @import("plan9/x86_64.zig"),
|
||||
else => @compileError("more plan9 syscall implementations (needs more inline asm in stage2"),
|
||||
};
|
||||
|
||||
@ -131,7 +131,7 @@ fn wWinMainCRTStartup2() callconv(.C) noreturn {
|
||||
|
||||
fn exit2(code: usize) noreturn {
|
||||
switch (native_os) {
|
||||
.linux => switch (builtin.stage2_arch) {
|
||||
.linux => switch (builtin.cpu.arch) {
|
||||
.x86_64 => {
|
||||
asm volatile ("syscall"
|
||||
:
|
||||
@ -175,7 +175,7 @@ fn exit2(code: usize) noreturn {
|
||||
else => @compileError("TODO"),
|
||||
},
|
||||
// exits(0)
|
||||
.plan9 => switch (builtin.stage2_arch) {
|
||||
.plan9 => switch (builtin.cpu.arch) {
|
||||
.x86_64 => {
|
||||
asm volatile (
|
||||
\\push $0
|
||||
|
||||
@ -4763,8 +4763,6 @@ pub fn generateBuiltinZigSource(comp: *Compilation, allocator: Allocator) Alloca
|
||||
\\/// feature detection (i.e. with `@hasDecl` or `@hasField`) over version checks.
|
||||
\\pub const zig_version = std.SemanticVersion.parse("{s}") catch unreachable;
|
||||
\\pub const zig_backend = std.builtin.CompilerBackend.{};
|
||||
\\/// Temporary until self-hosted supports the `cpu.arch` value.
|
||||
\\pub const stage2_arch: std.Target.Cpu.Arch = .{};
|
||||
\\
|
||||
\\pub const output_mode = std.builtin.OutputMode.{};
|
||||
\\pub const link_mode = std.builtin.LinkMode.{};
|
||||
@ -4779,7 +4777,6 @@ pub fn generateBuiltinZigSource(comp: *Compilation, allocator: Allocator) Alloca
|
||||
, .{
|
||||
build_options.version,
|
||||
std.zig.fmtId(@tagName(zig_backend)),
|
||||
std.zig.fmtId(@tagName(target.cpu.arch)),
|
||||
std.zig.fmtId(@tagName(comp.bin_file.options.output_mode)),
|
||||
std.zig.fmtId(@tagName(comp.bin_file.options.link_mode)),
|
||||
comp.bin_file.options.is_test,
|
||||
|
||||
@ -10076,7 +10076,6 @@ Buf *codegen_generate_builtin_source(CodeGen *g) {
|
||||
buf_appendf(contents, "pub const single_threaded = %s;\n", bool_to_str(g->is_single_threaded));
|
||||
buf_appendf(contents, "pub const abi = std.Target.Abi.%s;\n", cur_abi);
|
||||
buf_appendf(contents, "pub const cpu = std.Target.Cpu.baseline(.%s);\n", cur_arch);
|
||||
buf_appendf(contents, "pub const stage2_arch: std.Target.Cpu.Arch = .%s;\n", cur_arch);
|
||||
buf_appendf(contents, "pub const os = std.Target.Os.Tag.defaultVersionRange(.%s, .%s);\n", cur_os, cur_arch);
|
||||
buf_appendf(contents,
|
||||
"pub const target = std.Target{\n"
|
||||
|
||||
@ -159,7 +159,7 @@ test {
|
||||
_ = @import("behavior/while.zig");
|
||||
_ = @import("behavior/widening.zig");
|
||||
|
||||
if (builtin.stage2_arch == .wasm32) {
|
||||
if (builtin.cpu.arch == .wasm32) {
|
||||
_ = @import("behavior/wasm.zig");
|
||||
}
|
||||
|
||||
|
||||
@ -963,7 +963,7 @@ test "tuple assigned to variable" {
|
||||
|
||||
test "comptime struct field" {
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.stage2_arch == .arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.cpu.arch == .arm) return error.SkipZigTest; // TODO
|
||||
|
||||
const T = struct {
|
||||
a: i32,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user