From 8df04e144483ff48e506522da8269af25d0bca85 Mon Sep 17 00:00:00 2001 From: Matthew Lugg Date: Sat, 2 May 2026 11:04:28 +0100 Subject: [PATCH 1/4] std: actually rename `std.builtin` to `std.lang` This is now the canonical name, and `std.builtin` is a deprecated alias. --- CMakeLists.txt | 3 ++- lib/std/{builtin.zig => lang.zig} | 2 +- lib/std/{builtin => lang}/assembly.zig | 0 lib/std/std.zig | 5 ++++- 4 files changed, 7 insertions(+), 3 deletions(-) rename lib/std/{builtin.zig => lang.zig} (99%) rename lib/std/{builtin => lang}/assembly.zig (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index d87f39401aa1d84ffc07cf24de35724e24fecee7..f40634b7e20ab9b8f8ea1fc9cda5ac5978a93e30 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -239,7 +239,8 @@ set(ZIG_STAGE2_SOURCES lib/std/atomic.zig lib/std/base64.zig lib/std/buf_map.zig - lib/std/builtin.zig + lib/std/lang.zig + lib/std/lang/assembly.zig lib/std/c.zig lib/std/coff.zig lib/std/crypto.zig diff --git a/lib/std/builtin.zig b/lib/std/lang.zig similarity index 99% rename from lib/std/builtin.zig rename to lib/std/lang.zig index 97846ed035c64d280a94c67d9b03c720e1204e61..e06c4ba313287bbd534309df6021127a8475b6aa 100644 --- a/lib/std/builtin.zig +++ b/lib/std/lang.zig @@ -4,7 +4,7 @@ const builtin = @import("builtin"); const std = @import("std.zig"); const root = @import("root"); -pub const assembly = @import("builtin/assembly.zig"); +pub const assembly = @import("lang/assembly.zig"); /// This data structure is used by the Zig language code generation and /// therefore must be kept in sync with the compiler implementation. diff --git a/lib/std/builtin/assembly.zig b/lib/std/lang/assembly.zig similarity index 100% rename from lib/std/builtin/assembly.zig rename to lib/std/lang/assembly.zig diff --git a/lib/std/std.zig b/lib/std/std.zig index a700a15b077f74d02e25e73969b0f47ccf7c781a..3f2fb1d62d0fb91d048c251c5c9ca569cccd4263 100644 --- a/lib/std/std.zig +++ b/lib/std/std.zig @@ -65,8 +65,11 @@ pub const array_hash_map = @import("array_hash_map.zig"); pub const atomic = @import("atomic.zig"); pub const base64 = @import("base64.zig"); pub const bit_set = @import("bit_set.zig"); +/// Deprecated; use `lang`. +/// +/// To be removed after Zig 0.17.0. pub const builtin = lang; -pub const lang = @import("builtin.zig"); +pub const lang = @import("lang.zig"); pub const c = @import("c.zig"); pub const coff = @import("coff.zig"); pub const compress = @import("compress.zig"); -- 2.54.0 From e133f793ee42cae28d68eaab442bf243489993d6 Mon Sep 17 00:00:00 2001 From: Matthew Lugg Date: Sat, 2 May 2026 10:44:59 +0100 Subject: [PATCH 2/4] compiler: depend on 'std.lang' instead of 'std.builtin' --- build.zig | 2 +- lib/std/zig.zig | 4 +- lib/std/zig/AstGen.zig | 58 ++-- lib/std/zig/Zir.zig | 10 +- src/Air.zig | 2 +- src/Air/Legalize.zig | 2 +- src/Builtin.zig | 16 +- src/InternPool.zig | 6 +- src/Sema.zig | 272 +++++++++--------- src/Sema/type_resolution.zig | 4 +- src/Value.zig | 10 +- src/Zcu.zig | 34 +-- src/Zcu/PerThread.zig | 6 +- src/codegen/aarch64/Select.zig | 2 +- src/codegen/llvm.zig | 4 +- src/codegen/llvm/FuncGen.zig | 2 +- src/codegen/spirv/CodeGen.zig | 2 +- src/codegen/wasm/CodeGen.zig | 2 +- src/print_zir.zig | 6 +- .../invalid_member_of_builtin_enum.zig | 6 +- .../issue_15572_break_on_inline_while.zig | 2 +- ...runtime_index_into_comptime_type_slice.zig | 2 +- .../wrong_type_for_reify_type.zig | 6 +- ..._given_to_atomic_order_args_in_cmpxchg.zig | 2 +- .../wrong_types_given_to_export.zig | 2 +- 25 files changed, 232 insertions(+), 232 deletions(-) diff --git a/build.zig b/build.zig index 8ebedc5b5e124d965f1d0ae889ecdde579ac529a..30a82d84f3ee47d4fdd881222c2d8274b8bedaa2 100644 --- a/build.zig +++ b/build.zig @@ -191,7 +191,7 @@ pub fn build(b: *std.Build) !void { const valgrind = b.option(bool, "valgrind", "Enable valgrind integration"); const pie = b.option(bool, "pie", "Produce a Position Independent Executable"); const io_mode = b.option(IoMode, "io-mode", "How the compiler performs IO") orelse .threaded; - const value_interpret_mode = b.option(ValueInterpretMode, "value-interpret-mode", "How the compiler translates between 'std.builtin' types and its internal datastructures") orelse .direct; + const value_interpret_mode = b.option(ValueInterpretMode, "value-interpret-mode", "How the compiler translates between 'std.lang' types and its internal datastructures") orelse .direct; const value_tracing = b.option(bool, "value-tracing", "Enable extra state tracking to help troubleshoot bugs in the compiler (using the std.debug.Trace API)") orelse false; const mem_leak_frames: u32 = b.option(u32, "mem-leak-frames", "How many stack frames to print when a memory leak occurs. Tests get 2x this amount.") orelse blk: { diff --git a/lib/std/zig.zig b/lib/std/zig.zig index bf9a6ed94db578ffbf27eb8ec4ce8898597e82ad..75ef9c9b63195335b78c5cfa04d4d75742532905 100644 --- a/lib/std/zig.zig +++ b/lib/std/zig.zig @@ -876,7 +876,7 @@ pub const SimpleComptimeReason = enum(u32) { casted_to_comptime_enum, casted_to_comptime_int, casted_to_comptime_float, - std_builtin_decl, + std_lang_decl, pub fn message(r: SimpleComptimeReason) []const u8 { return switch (r) { @@ -959,7 +959,7 @@ pub const SimpleComptimeReason = enum(u32) { .casted_to_comptime_enum => "value casted to enum with 'comptime_int' tag type must be comptime-known", .casted_to_comptime_int => "value casted to 'comptime_int' must be comptime-known", .casted_to_comptime_float => "value casted to 'comptime_float' must be comptime-known", - .std_builtin_decl => "'std.builtin' declaration values must be comptime-known", + .std_lang_decl => "'std.lang' declaration values must be comptime-known", // zig fmt: on }; } diff --git a/lib/std/zig/AstGen.zig b/lib/std/zig/AstGen.zig index 307bedd15615ea571b9fbaceb58c9e2dd8e0733e..58711d5471b7b3a1f75c3bcd7017150b74ac1dac 100644 --- a/lib/std/zig/AstGen.zig +++ b/lib/std/zig/AstGen.zig @@ -1398,12 +1398,12 @@ fn fnProtoExprInner( try comptimeExpr( &block_scope, scope, - .{ .rl = .{ .coerced_ty = try block_scope.addBuiltinValue(callconv_expr, .calling_convention) } }, + .{ .rl = .{ .coerced_ty = try block_scope.addStdLangValue(callconv_expr, .calling_convention) } }, callconv_expr, .@"callconv", ) else if (implicit_ccc) - try block_scope.addBuiltinValue(node, .calling_convention_c) + try block_scope.addStdLangValue(node, .calling_convention_c) else .none; @@ -3782,7 +3782,7 @@ fn ptrType( gz.astgen.source_line = source_line; gz.astgen.source_column = source_column; - const addrspace_ty = try gz.addBuiltinValue(addrspace_node, .address_space); + const addrspace_ty = try gz.addStdLangValue(addrspace_node, .address_space); addrspace_ref = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = addrspace_ty } }, addrspace_node, .@"addrspace"); trailing_count += 1; } @@ -4077,7 +4077,7 @@ fn fnDecl( if (fn_proto.ast.addrspace_expr.unwrap()) |addrspace_expr| { astgen.restoreSourceCursor(saved_cursor); - const addrspace_ty = try addrspace_gz.addBuiltinValue(addrspace_expr, .address_space); + const addrspace_ty = try addrspace_gz.addStdLangValue(addrspace_expr, .address_space); const inst = try expr(&addrspace_gz, &addrspace_gz.base, .{ .rl = .{ .coerced_ty = addrspace_ty } }, addrspace_expr); _ = try addrspace_gz.addBreakWithSrcNode(.break_inline, decl_inst, inst, decl_node); } @@ -4285,7 +4285,7 @@ fn fnDeclInner( const inst = try expr( &cc_gz, scope, - .{ .rl = .{ .coerced_ty = try cc_gz.addBuiltinValue(callconv_expr, .calling_convention) } }, + .{ .rl = .{ .coerced_ty = try cc_gz.addStdLangValue(callconv_expr, .calling_convention) } }, callconv_expr, ); if (cc_gz.instructionsSlice().len == 0) { @@ -4295,7 +4295,7 @@ fn fnDeclInner( _ = try cc_gz.addBreak(.break_inline, @enumFromInt(0), inst); break :blk inst; } else if (has_inline_keyword) { - const inst = try cc_gz.addBuiltinValue(decl_node, .calling_convention_inline); + const inst = try cc_gz.addStdLangValue(decl_node, .calling_convention_inline); _ = try cc_gz.addBreak(.break_inline, @enumFromInt(0), inst); break :blk inst; } else { @@ -4493,7 +4493,7 @@ fn globalVarDecl( defer addrspace_gz.unstack(); if (var_decl.ast.addrspace_node.unwrap()) |addrspace_node| { - const addrspace_ty = try addrspace_gz.addBuiltinValue(addrspace_node, .address_space); + const addrspace_ty = try addrspace_gz.addStdLangValue(addrspace_node, .address_space); const addrspace_inst = try expr(&addrspace_gz, &addrspace_gz.base, .{ .rl = .{ .coerced_ty = addrspace_ty } }, addrspace_node); _ = try addrspace_gz.addBreakWithSrcNode(.break_inline, decl_inst, addrspace_inst, node); } @@ -8650,7 +8650,7 @@ fn asmExpr( const clobbers: Zir.Inst.Ref = if (full.ast.clobbers.unwrap()) |clobbers_node| try comptimeExpr(gz, scope, .{ .rl = .{ - .coerced_ty = try gz.addBuiltinValue(clobbers_node, .clobbers), + .coerced_ty = try gz.addStdLangValue(clobbers_node, .clobbers), } }, clobbers_node, .clobber) else .none; @@ -8992,7 +8992,7 @@ fn builtinCall( if (!allow_branch_hint) { return astgen.failNode(node, "'@branchHint' must appear as the first statement in a function or conditional branch", .{}); } - const hint_ty = try gz.addBuiltinValue(node, .branch_hint); + const hint_ty = try gz.addStdLangValue(node, .branch_hint); const hint_val = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = hint_ty } }, params[0], .operand_branchHint); _ = try gz.addExtendedPayload(.branch_hint, Zir.Inst.UnNode{ .node = gz.nodeIndexToRelative(node), @@ -9090,7 +9090,7 @@ fn builtinCall( .@"export" => { const exported = try expr(gz, scope, .{ .rl = .none }, params[0]); - const export_options_ty = try gz.addBuiltinValue(node, .export_options); + const export_options_ty = try gz.addStdLangValue(node, .export_options); const options = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = export_options_ty } }, params[1], .export_options); _ = try gz.addPlNode(.@"export", node, Zir.Inst.Export{ .exported = exported, @@ -9100,7 +9100,7 @@ fn builtinCall( }, .@"extern" => { const type_inst = try typeExpr(gz, scope, params[0]); - const extern_options_ty = try gz.addBuiltinValue(node, .extern_options); + const extern_options_ty = try gz.addStdLangValue(node, .extern_options); const options = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = extern_options_ty } }, params[1], .extern_options); const result = try gz.addExtendedPayload(.builtin_extern, Zir.Inst.BinNode{ .node = gz.nodeIndexToRelative(node), @@ -9110,7 +9110,7 @@ fn builtinCall( return rvalue(gz, ri, result, node); }, .set_float_mode => { - const float_mode_ty = try gz.addBuiltinValue(node, .float_mode); + const float_mode_ty = try gz.addStdLangValue(node, .float_mode); const order = try expr(gz, scope, .{ .rl = .{ .coerced_ty = float_mode_ty } }, params[0]); _ = try gz.addExtendedPayload(.set_float_mode, Zir.Inst.UnNode{ .node = gz.nodeIndexToRelative(node), @@ -9196,7 +9196,7 @@ fn builtinCall( .EnumLiteral => return rvalue(gz, ri, .enum_literal_type, node), .Int => { - const signedness_ty = try gz.addBuiltinValue(node, .signedness); + const signedness_ty = try gz.addStdLangValue(node, .signedness); const result = try gz.addPlNode(.reify_int, node, Zir.Inst.Bin{ .lhs = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = signedness_ty } }, params[0], .int_signedness), .rhs = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = .u16_type } }, params[1], .int_bit_width), @@ -9211,8 +9211,8 @@ fn builtinCall( return rvalue(gz, ri, result, node); }, .Pointer => { - const ptr_size_ty = try gz.addBuiltinValue(node, .pointer_size); - const ptr_attrs_ty = try gz.addBuiltinValue(node, .pointer_attributes); + const ptr_size_ty = try gz.addStdLangValue(node, .pointer_size); + const ptr_attrs_ty = try gz.addStdLangValue(node, .pointer_attributes); const size = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = ptr_size_ty } }, params[0], .pointer_size); const attrs = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = ptr_attrs_ty } }, params[1], .pointer_attrs); const elem_ty = try typeExpr(gz, scope, params[2]); @@ -9231,7 +9231,7 @@ fn builtinCall( return rvalue(gz, ri, result, node); }, .Fn => { - const fn_attrs_ty = try gz.addBuiltinValue(node, .fn_attributes); + const fn_attrs_ty = try gz.addStdLangValue(node, .fn_attributes); const param_types = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = .slice_const_type_type } }, params[0], .fn_param_types); const param_attrs_ty = try gz.addExtendedPayloadSmall( .reify_slice_arg_ty, @@ -9251,7 +9251,7 @@ fn builtinCall( return rvalue(gz, ri, result, node); }, .Struct => { - const container_layout_ty = try gz.addBuiltinValue(node, .container_layout); + const container_layout_ty = try gz.addStdLangValue(node, .container_layout); const layout = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = container_layout_ty } }, params[0], .struct_layout); const backing_ty = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = .optional_type_type } }, params[1], .type); const field_names = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = .slice_const_slice_const_u8_type } }, params[2], .struct_field_names); @@ -9279,7 +9279,7 @@ fn builtinCall( return rvalue(gz, ri, result, node); }, .Union => { - const container_layout_ty = try gz.addBuiltinValue(node, .container_layout); + const container_layout_ty = try gz.addStdLangValue(node, .container_layout); const layout = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = container_layout_ty } }, params[0], .union_layout); const arg_ty = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = .optional_type_type } }, params[1], .type); const field_names = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = .slice_const_slice_const_u8_type } }, params[2], .union_field_names); @@ -9307,7 +9307,7 @@ fn builtinCall( return rvalue(gz, ri, result, node); }, .Enum => { - const enum_mode_ty = try gz.addBuiltinValue(node, .enum_mode); + const enum_mode_ty = try gz.addStdLangValue(node, .enum_mode); const tag_ty = try typeExpr(gz, scope, params[0]); const mode = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = enum_mode_ty } }, params[1], .type); const field_names = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = .slice_const_slice_const_u8_type } }, params[2], .enum_field_names); @@ -9425,7 +9425,7 @@ fn builtinCall( return rvalue(gz, ri, result, node); }, .reduce => { - const reduce_op_ty = try gz.addBuiltinValue(node, .reduce_op); + const reduce_op_ty = try gz.addStdLangValue(node, .reduce_op); const op = try expr(gz, scope, .{ .rl = .{ .coerced_ty = reduce_op_ty } }, params[0]); const scalar = try expr(gz, scope, .{ .rl = .none }, params[1]); const result = try gz.addPlNode(.reduce, node, Zir.Inst.Bin{ @@ -9441,7 +9441,7 @@ fn builtinCall( .shl_with_overflow => return overflowArithmetic(gz, scope, ri, node, params, .shl_with_overflow), .atomic_load => { - const atomic_order_type = try gz.addBuiltinValue(node, .atomic_order); + const atomic_order_type = try gz.addStdLangValue(node, .atomic_order); const result = try gz.addPlNode(.atomic_load, node, Zir.Inst.AtomicLoad{ // zig fmt: off .elem_type = try typeExpr(gz, scope, params[0]), @@ -9452,8 +9452,8 @@ fn builtinCall( return rvalue(gz, ri, result, node); }, .atomic_rmw => { - const atomic_order_type = try gz.addBuiltinValue(node, .atomic_order); - const atomic_rmw_op_type = try gz.addBuiltinValue(node, .atomic_rmw_op); + const atomic_order_type = try gz.addStdLangValue(node, .atomic_order); + const atomic_rmw_op_type = try gz.addStdLangValue(node, .atomic_rmw_op); const int_type = try typeExpr(gz, scope, params[0]); const result = try gz.addPlNode(.atomic_rmw, node, Zir.Inst.AtomicRmw{ // zig fmt: off @@ -9466,7 +9466,7 @@ fn builtinCall( return rvalue(gz, ri, result, node); }, .atomic_store => { - const atomic_order_type = try gz.addBuiltinValue(node, .atomic_order); + const atomic_order_type = try gz.addStdLangValue(node, .atomic_order); const int_type = try typeExpr(gz, scope, params[0]); _ = try gz.addPlNode(.atomic_store, node, Zir.Inst.AtomicStore{ // zig fmt: off @@ -9490,7 +9490,7 @@ fn builtinCall( return rvalue(gz, ri, result, node); }, .call => { - const call_modifier_ty = try gz.addBuiltinValue(node, .call_modifier); + const call_modifier_ty = try gz.addStdLangValue(node, .call_modifier); const modifier = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = call_modifier_ty } }, params[0], .call_modifier); const callee = try expr(gz, scope, .{ .rl = .none }, params[1]); const args = try expr(gz, scope, .{ .rl = .none }, params[2]); @@ -9567,7 +9567,7 @@ fn builtinCall( return rvalue(gz, ri, result, node); }, .prefetch => { - const prefetch_options_ty = try gz.addBuiltinValue(node, .prefetch_options); + const prefetch_options_ty = try gz.addStdLangValue(node, .prefetch_options); const ptr = try expr(gz, scope, .{ .rl = .none }, params[0]); const options = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = prefetch_options_ty } }, params[1], .prefetch_options); _ = try gz.addExtendedPayload(.prefetch, Zir.Inst.BinNode{ @@ -9800,7 +9800,7 @@ fn cmpxchg( small: u16, ) InnerError!Zir.Inst.Ref { const int_type = try typeExpr(gz, scope, params[0]); - const atomic_order_type = try gz.addBuiltinValue(node, .atomic_order); + const atomic_order_type = try gz.addStdLangValue(node, .atomic_order); const result = try gz.addExtendedPayloadSmall(.cmpxchg, small, Zir.Inst.Cmpxchg{ // zig fmt: off .node = gz.nodeIndexToRelative(node), @@ -11801,8 +11801,8 @@ const GenZir = struct { return new_index; } - fn addBuiltinValue(gz: *GenZir, src_node: Ast.Node.Index, val: Zir.Inst.BuiltinValue) !Zir.Inst.Ref { - return addExtendedNodeSmall(gz, .builtin_value, src_node, @intFromEnum(val)); + fn addStdLangValue(gz: *GenZir, src_node: Ast.Node.Index, val: Zir.Inst.StdLangValue) !Zir.Inst.Ref { + return addExtendedNodeSmall(gz, .std_lang_value, src_node, @intFromEnum(val)); } fn addExtendedPayload(gz: *GenZir, opcode: Zir.Inst.Extended, extra: anytype) !Zir.Inst.Ref { diff --git a/lib/std/zig/Zir.zig b/lib/std/zig/Zir.zig index 5e5fd924bdbde9fab07d89b076c9f1ff96b34116..f8af9688ae7857a4050b29ace18a89ba171e1f45 100644 --- a/lib/std/zig/Zir.zig +++ b/lib/std/zig/Zir.zig @@ -2119,10 +2119,10 @@ pub const Inst = struct { /// Guaranteed to not have the `ptr_cast` flag. /// Uses the `pl_node` union field with payload `FieldParentPtr`. field_parent_ptr, - /// Get a type or value from `std.builtin`. + /// Get a type or value from `std.lang`. /// `operand` is `src_node: Ast.Node.Offset`. - /// `small` is an `Inst.BuiltinValue`. - builtin_value, + /// `small` is an `Inst.StdLangValue`. + std_lang_value, /// Provide a `@branchHint` for the current block. /// `operand` is payload index to `UnNode`. /// `small` is unused. @@ -3564,7 +3564,7 @@ pub const Inst = struct { } }; - pub const BuiltinValue = enum(u16) { + pub const StdLangValue = enum(u16) { // Types atomic_order, atomic_rmw_op, @@ -4368,7 +4368,7 @@ fn findTrackableInner( .restore_err_ret_index, .closure_get, .field_parent_ptr, - .builtin_value, + .std_lang_value, .branch_hint, .inplace_arith_result_ty, .tuple_decl, diff --git a/src/Air.zig b/src/Air.zig index ec53a6175edf19245ff22da060a77d78f1b39b8b..78086f567f5f5556d6541edf9ddd63d83dd2d193 100644 --- a/src/Air.zig +++ b/src/Air.zig @@ -1481,7 +1481,7 @@ pub const Asm = struct { /// Length of the assembly source in bytes. source_len: u32, inputs_len: u32, - /// A comptime `std.builtin.assembly.Clobbers` value for the target architecture. + /// A comptime `std.lang.assembly.Clobbers` value for the target architecture. clobbers: InternPool.Index, flags: Flags, diff --git a/src/Air/Legalize.zig b/src/Air/Legalize.zig index 65c943742972138acc61c1c9b3062ef8119720e9..e449835ce856ac7061f07abe33329fc4963f4fcf 100644 --- a/src/Air/Legalize.zig +++ b/src/Air/Legalize.zig @@ -2644,7 +2644,7 @@ const Block = struct { }); return; } - const panic_fn_val = zcu.builtin_decl_values.get(panic_id.toBuiltin()); + const panic_fn_val = zcu.std_lang_decl_values.get(panic_id.toStdLangDecl()); _ = b.add(l, .{ .tag = .call, .data = .{ .pl_op = .{ diff --git a/src/Builtin.zig b/src/Builtin.zig index 92a0e40ae3fe71696e29d01b569381e5dd292fa6..f8cf9a38508c60587590f7d4375293771fa6e7af 100644 --- a/src/Builtin.zig +++ b/src/Builtin.zig @@ -57,11 +57,11 @@ pub fn append(opts: @This(), buffer: *std.array_list.Managed(u8)) Allocator.Erro \\/// feature detection (i.e. with `@hasDecl` or `@hasField`) over version checks. \\pub const zig_version = std.SemanticVersion.parse(zig_version_string) catch unreachable; \\pub const zig_version_string = "{s}"; - \\pub const zig_backend = std.builtin.CompilerBackend.{f}; + \\pub const zig_backend = std.lang.CompilerBackend.{f}; \\ - \\pub const output_mode: std.builtin.OutputMode = .{f}; - \\pub const link_mode: std.builtin.LinkMode = .{f}; - \\pub const unwind_tables: std.builtin.UnwindTables = .{f}; + \\pub const output_mode: std.lang.OutputMode = .{f}; + \\pub const link_mode: std.lang.LinkMode = .{f}; + \\pub const unwind_tables: std.lang.UnwindTables = .{f}; \\pub const is_test = {}; \\pub const single_threaded = {}; \\pub const abi: std.Target.Abi = .{f}; @@ -239,7 +239,7 @@ pub fn append(opts: @This(), buffer: *std.array_list.Managed(u8)) Allocator.Erro try buffer.print( \\pub const object_format: std.Target.ObjectFormat = .{f}; - \\pub const mode: std.builtin.OptimizeMode = .{f}; + \\pub const mode: std.lang.OptimizeMode = .{f}; \\pub const link_libc = {}; \\pub const link_libcpp = {}; \\pub const have_error_return_tracing = {}; @@ -249,7 +249,7 @@ pub fn append(opts: @This(), buffer: *std.array_list.Managed(u8)) Allocator.Erro \\pub const position_independent_code = {}; \\pub const position_independent_executable = {}; \\pub const strip_debug_info = {}; - \\pub const code_model: std.builtin.CodeModel = .{f}; + \\pub const code_model: std.lang.CodeModel = .{f}; \\pub const omit_frame_pointer = {}; \\ , .{ @@ -270,14 +270,14 @@ pub fn append(opts: @This(), buffer: *std.array_list.Managed(u8)) Allocator.Erro if (target.os.tag == .wasi) { try buffer.print( - \\pub const wasi_exec_model: std.builtin.WasiExecModel = .{f}; + \\pub const wasi_exec_model: std.lang.WasiExecModel = .{f}; \\ , .{std.zig.fmtIdPU(@tagName(opts.wasi_exec_model))}); } if (opts.is_test) { try buffer.appendSlice( - \\pub var test_functions: []const std.builtin.TestFn = &.{}; // overwritten later + \\pub var test_functions: []const std.lang.TestFn = &.{}; // overwritten later \\ ); } diff --git a/src/InternPool.zig b/src/InternPool.zig index 7471fa78f674dcde3d4b080b2e7b42c696151749..29be84b0036d595fc34ba4f1a1b150eb29d106d0 100644 --- a/src/InternPool.zig +++ b/src/InternPool.zig @@ -486,12 +486,12 @@ pub const AnalUnit = packed struct(u64) { pub const MemoizedStateStage = enum(u32) { /// Everything other than panics and `VaList`. main, - /// Everything within `std.builtin.Panic`. + /// Everything within `std.lang.Panic`. /// Since the panic handler is user-provided, this must be able to reference the other memoized state. panic, - /// Specifically `std.builtin.VaList`. See `Zcu.BuiltinDecl.stage`. + /// Specifically `std.lang.VaList`. See `Zcu.StdLangDecl.stage`. va_list, - /// Everything within `std.builtin.assembly`. See `Zcu.BuiltinDecl.stage`. + /// Everything within `std.lang.assembly`. See `Zcu.StdLangDecl.stage`. assembly, }; diff --git a/src/Sema.zig b/src/Sema.zig index c3abfcd422e84002153603b71c3ad7e927fc73cb..217216162009f0bbdeca2f56a7d4299be30d88f3 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -1473,7 +1473,7 @@ fn analyzeBodyInner( }, .value_placeholder => unreachable, // never appears in a body .field_parent_ptr => try sema.zirFieldParentPtr(block, extended), - .builtin_value => try sema.zirBuiltinValue(block, extended), + .std_lang_value => try sema.zirStdLangValue(block, extended), .inplace_arith_result_ty => try sema.zirInplaceArithResultTy(extended), .dbg_empty_stmt => { try sema.zirDbgEmptyStmt(block, inst); @@ -2225,7 +2225,7 @@ pub fn setupErrorReturnTrace(sema: *Sema, block: *Block, last_arg_index: usize) const addrs_ptr = try err_trace_block.addTy(.alloc, try pt.singleMutPtrType(addr_arr_ty)); // var st: StackTrace = undefined; - const stack_trace_ty = try sema.getBuiltinType(block.nodeOffset(.zero), .StackTrace); + const stack_trace_ty = try sema.getStdLangType(block.nodeOffset(.zero), .StackTrace); const st_ptr = try err_trace_block.addTy(.alloc, try pt.singleMutPtrType(stack_trace_ty)); // st.instruction_addresses = &addrs; @@ -2805,10 +2805,10 @@ fn analyzeValueAsCallconv( src: LazySrcLoc, val: Value, ) !std.builtin.CallingConvention { - return interpretBuiltinType(sema, block, src, val, std.builtin.CallingConvention); + return interpretStdLangType(sema, block, src, val, std.builtin.CallingConvention); } -fn interpretBuiltinType( +fn interpretStdLangType( sema: *Sema, block: *Block, src: LazySrcLoc, @@ -2818,7 +2818,7 @@ fn interpretBuiltinType( return val.interpret(T, sema.pt) catch |err| switch (err) { error.OutOfMemory => |e| return e, error.UndefinedValue => return sema.failWithUseOfUndef(block, src, null), - error.TypeMismatch => @panic("std.builtin is corrupt"), + error.TypeMismatch => @panic("std.lang is corrupt"), }; } @@ -5074,7 +5074,7 @@ fn zirPanic(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void } try sema.ensureMemoizedStateResolved(src, .panic); - const panic_fn_index = zcu.builtin_decl_values.get(.@"panic.call"); + const panic_fn_index = zcu.std_lang_decl_values.get(.@"panic.call"); const opt_usize_ty = try pt.optionalType(.usize_type); const null_ret_addr = Air.internedToRef((try pt.intern(.{ .opt = .{ .ty = opt_usize_ty.toIntern(), @@ -5692,7 +5692,7 @@ fn zirDisableIntrinsics(sema: *Sema) CompileError!void { fn zirSetFloatMode(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) CompileError!void { const extra = sema.code.extraData(Zir.Inst.UnNode, extended.operand).data; const src = block.builtinCallArgSrc(extra.node, 0); - block.float_mode = try sema.resolveBuiltinEnum(block, src, extra.operand, .FloatMode, .{ .simple = .operand_setFloatMode }); + block.float_mode = try sema.resolveStdLangEnum(block, src, extra.operand, .FloatMode, .{ .simple = .operand_setFloatMode }); } fn zirSetRuntimeSafety(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { @@ -6008,10 +6008,10 @@ pub fn analyzeSaveErrRetIndex(sema: *Sema, block: *Block) SemaError!Air.Inst.Ref if (!block.ownerModule().error_tracing) return .none; - const stack_trace_ty = try sema.getBuiltinType(block.nodeOffset(.zero), .StackTrace); + const stack_trace_ty = try sema.getStdLangType(block.nodeOffset(.zero), .StackTrace); const field_name = try zcu.intern_pool.getOrPutString(gpa, io, pt.tid, "index", .no_embedded_nulls); const field_index = sema.structFieldIndex(block, stack_trace_ty, field_name, LazySrcLoc.unneeded) catch |err| switch (err) { - error.AnalysisFail => @panic("std.builtin.StackTrace is corrupt"), + error.AnalysisFail => @panic("std.lang.StackTrace is corrupt"), error.ComptimeReturn, error.ComptimeBreak => unreachable, error.OutOfMemory, error.Canceled => |e| return e, }; @@ -6051,7 +6051,7 @@ fn popErrorReturnTrace( // AstGen determined this result does not go to an error-handling expr (try/catch/return etc.), or // the result is comptime-known to be a non-error. Either way, pop unconditionally. - const stack_trace_ty = try sema.getBuiltinType(src, .StackTrace); + const stack_trace_ty = try sema.getStdLangType(src, .StackTrace); const ptr_stack_trace_ty = try pt.singleMutPtrType(stack_trace_ty); const err_return_trace = try block.addTy(.err_return_trace, ptr_stack_trace_ty); const field_name = try zcu.intern_pool.getOrPutString(gpa, io, pt.tid, "index", .no_embedded_nulls); @@ -6076,7 +6076,7 @@ fn popErrorReturnTrace( defer then_block.instructions.deinit(gpa); // If non-error, then pop the error return trace by restoring the index. - const stack_trace_ty = try sema.getBuiltinType(src, .StackTrace); + const stack_trace_ty = try sema.getStdLangType(src, .StackTrace); const ptr_stack_trace_ty = try pt.singleMutPtrType(stack_trace_ty); const err_return_trace = try then_block.addTy(.err_return_trace, ptr_stack_trace_ty); const field_name = try zcu.intern_pool.getOrPutString(gpa, io, pt.tid, "index", .no_embedded_nulls); @@ -6215,7 +6215,7 @@ fn zirCall( // If any input is an error-type, we might need to pop any trace it generated. Otherwise, we only // need to clean-up our own trace if we were passed to a non-error-handling expression. if (input_is_error or (pop_error_return_trace and return_ty.isError(zcu))) { - const stack_trace_ty = try sema.getBuiltinType(call_src, .StackTrace); + const stack_trace_ty = try sema.getStdLangType(call_src, .StackTrace); const field_name = try zcu.intern_pool.getOrPutString(gpa, io, pt.tid, "index", .no_embedded_nulls); const field_index = try sema.structFieldIndex(block, stack_trace_ty, field_name, call_src); @@ -8377,10 +8377,10 @@ fn zirFunc( if (fn_is_exported) { break :cc target.cCallingConvention() orelse { // This target has no default C calling convention. We sometimes trigger a similar - // error by trying to evaluate `std.builtin.CallingConvention.c`, so for consistency, + // error by trying to evaluate `std.lang.CallingConvention.c`, so for consistency, // let's eval that now and just get the transitive error. (It's guaranteed to error // because it does the exact `cCallingConvention` call we just did.) - const cc_type = try sema.getBuiltinType(src, .CallingConvention); + const cc_type = try sema.getStdLangType(src, .CallingConvention); _ = try sema.namespaceLookupVal( block, LazySrcLoc.unneeded, @@ -8388,7 +8388,7 @@ fn zirFunc( try ip.getOrPutString(gpa, io, pt.tid, "c", .no_embedded_nulls), ); // The above should have errored. - @panic("std.builtin is corrupt"); + @panic("std.lang is corrupt"); }; } else { break :cc .auto; @@ -12711,7 +12711,7 @@ fn maybeErrorUnwrap( const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; const msg_inst = sema.resolveInst(inst_data.operand); - const panic_fn = try getBuiltin(sema, operand_src, .@"panic.call"); + const panic_fn = try getStdLangValue(sema, operand_src, .@"panic.call"); const args: [2]Air.Inst.Ref = .{ msg_inst, .null_value }; try sema.callBuiltin(block, operand_src, Air.internedToRef(panic_fn), .auto, &args, .@"safety check"); return true; @@ -15319,7 +15319,7 @@ fn zirAsm( } const clobbers_src = block.src(.{ .asm_clobbers = src.offset.node_offset.x }); - const clobbers_ty = try sema.getBuiltinType(src, .@"assembly.Clobbers"); + const clobbers_ty = try sema.getStdLangType(src, .@"assembly.Clobbers"); const clobbers = if (extra.data.clobbers == .none) empty: { break :empty try sema.structInitEmpty(block, clobbers_ty, src, src); } else clobbers: { @@ -15930,7 +15930,7 @@ fn zirBuiltinSrc( } }); }; - const src_loc_ty = try sema.getBuiltinType(block.nodeOffset(.zero), .SourceLocation); + const src_loc_ty = try sema.getStdLangType(block.nodeOffset(.zero), .SourceLocation); const fields = .{ // module: [:0]const u8, module_name_val, @@ -15957,7 +15957,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; const src = block.nodeOffset(inst_data.src_node); const ty = try sema.resolveType(block, src, inst_data.operand); - const type_info_ty = try sema.getBuiltinType(src, .Type); + const type_info_ty = try sema.getStdLangType(src, .Type); const type_info_tag_ty = type_info_ty.unionTagType(zcu).?; try sema.ensureLayoutResolved(ty, src, .type_info); @@ -15979,15 +15979,15 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai => |type_info_tag| return .fromValue(try pt.unionValue( type_info_ty, Value.uninterpret(type_info_tag, type_info_tag_ty, pt) catch |err| switch (err) { - error.TypeMismatch => @panic("std.builtin is corrupt"), + error.TypeMismatch => @panic("std.lang is corrupt"), error.OutOfMemory => |e| return e, }, .void, )), .@"fn" => { - const fn_info_ty = try sema.getBuiltinType(src, .@"Type.Fn"); - const param_info_ty = try sema.getBuiltinType(src, .@"Type.Fn.Param"); + const fn_info_ty = try sema.getStdLangType(src, .@"Type.Fn"); + const param_info_ty = try sema.getStdLangType(src, .@"Type.Fn.Param"); const func_ty_info = zcu.typeToFunc(ty).?; const param_vals = try sema.arena.alloc(InternPool.Index, func_ty_info.param_types.len); @@ -16068,9 +16068,9 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai .val = if (ret_ty_is_generic) .none else func_ty_info.return_type, } }); - const callconv_ty = try sema.getBuiltinType(src, .CallingConvention); + const callconv_ty = try sema.getStdLangType(src, .CallingConvention); const callconv_val = Value.uninterpret(func_ty_info.cc, callconv_ty, pt) catch |err| switch (err) { - error.TypeMismatch => @panic("std.builtin is corrupt"), + error.TypeMismatch => @panic("std.lang is corrupt"), error.OutOfMemory => |e| return e, }; @@ -16093,8 +16093,8 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai }))); }, .int => { - const int_info_ty = try sema.getBuiltinType(src, .@"Type.Int"); - const signedness_ty = try sema.getBuiltinType(src, .Signedness); + const int_info_ty = try sema.getStdLangType(src, .@"Type.Int"); + const signedness_ty = try sema.getStdLangType(src, .Signedness); const info = ty.intInfo(zcu); const field_values = .{ // signedness: Signedness, @@ -16109,7 +16109,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai }))); }, .float => { - const float_info_ty = try sema.getBuiltinType(src, .@"Type.Float"); + const float_info_ty = try sema.getStdLangType(src, .@"Type.Float"); const field_vals = .{ // bits: u16, @@ -16135,9 +16135,9 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai } })); }; - const addrspace_ty = try sema.getBuiltinType(src, .AddressSpace); - const pointer_ty = try sema.getBuiltinType(src, .@"Type.Pointer"); - const ptr_size_ty = try sema.getBuiltinType(src, .@"Type.Pointer.Size"); + const addrspace_ty = try sema.getStdLangType(src, .AddressSpace); + const pointer_ty = try sema.getStdLangType(src, .@"Type.Pointer"); + const ptr_size_ty = try sema.getStdLangType(src, .@"Type.Pointer.Size"); const field_values = .{ // size: Size, @@ -16167,7 +16167,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai }))); }, .array => { - const array_field_ty = try sema.getBuiltinType(src, .@"Type.Array"); + const array_field_ty = try sema.getStdLangType(src, .@"Type.Array"); const info = ty.arrayInfo(zcu); const field_values = .{ @@ -16185,7 +16185,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai }))); }, .vector => { - const vector_field_ty = try sema.getBuiltinType(src, .@"Type.Vector"); + const vector_field_ty = try sema.getStdLangType(src, .@"Type.Vector"); const info = ty.arrayInfo(zcu); const field_values = .{ @@ -16201,7 +16201,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai }))); }, .optional => { - const optional_field_ty = try sema.getBuiltinType(src, .@"Type.Optional"); + const optional_field_ty = try sema.getStdLangType(src, .@"Type.Optional"); const field_values = .{ // child: type, @@ -16215,7 +16215,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai }, .error_set => { // Get the Error type - const error_field_ty = try sema.getBuiltinType(src, .@"Type.Error"); + const error_field_ty = try sema.getStdLangType(src, .@"Type.Error"); // Build our list of Error values // Optional value is only null if anyerror @@ -16305,7 +16305,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai }))); }, .error_union => { - const error_union_field_ty = try sema.getBuiltinType(src, .@"Type.ErrorUnion"); + const error_union_field_ty = try sema.getStdLangType(src, .@"Type.ErrorUnion"); const field_values = .{ // error_set: type, @@ -16323,7 +16323,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai const enum_obj = ip.loadEnumType(ty.toIntern()); const is_exhaustive: Value = .makeBool(!enum_obj.nonexhaustive); - const enum_field_ty = try sema.getBuiltinType(src, .@"Type.EnumField"); + const enum_field_ty = try sema.getStdLangType(src, .@"Type.EnumField"); const enum_field_vals = try sema.arena.alloc(InternPool.Index, enum_obj.field_names.len); for (enum_field_vals, 0..) |*field_val, tag_index| { @@ -16404,7 +16404,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai const decls_val = try sema.typeInfoDecls(src, ip.loadEnumType(ty.toIntern()).namespace.toOptional()); - const type_enum_ty = try sema.getBuiltinType(src, .@"Type.Enum"); + const type_enum_ty = try sema.getStdLangType(src, .@"Type.Enum"); const field_values = .{ // tag_type: type, @@ -16423,8 +16423,8 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai }))); }, .@"union" => { - const type_union_ty = try sema.getBuiltinType(src, .@"Type.Union"); - const union_field_ty = try sema.getBuiltinType(src, .@"Type.UnionField"); + const type_union_ty = try sema.getStdLangType(src, .@"Type.Union"); + const union_field_ty = try sema.getStdLangType(src, .@"Type.UnionField"); const union_obj = ip.loadUnionType(ty.toIntern()); const enum_obj = ip.loadEnumType(union_obj.enum_tag_type); @@ -16524,7 +16524,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai .val = if (ty.unionTagType(zcu)) |tag_ty| tag_ty.toIntern() else .none, } }); - const container_layout_ty = try sema.getBuiltinType(src, .@"Type.ContainerLayout"); + const container_layout_ty = try sema.getStdLangType(src, .@"Type.ContainerLayout"); const field_values = .{ // layout: ContainerLayout, @@ -16544,8 +16544,8 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai }))); }, .@"struct" => { - const type_struct_ty = try sema.getBuiltinType(src, .@"Type.Struct"); - const struct_field_ty = try sema.getBuiltinType(src, .@"Type.StructField"); + const type_struct_ty = try sema.getStdLangType(src, .@"Type.Struct"); + const struct_field_ty = try sema.getStdLangType(src, .@"Type.StructField"); var struct_field_vals: []InternPool.Index = &.{}; defer gpa.free(struct_field_vals); @@ -16713,7 +16713,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai } else .none, } }); - const container_layout_ty = try sema.getBuiltinType(src, .@"Type.ContainerLayout"); + const container_layout_ty = try sema.getStdLangType(src, .@"Type.ContainerLayout"); const layout = ty.containerLayout(zcu); @@ -16736,7 +16736,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai }))); }, .@"opaque" => { - const type_opaque_ty = try sema.getBuiltinType(src, .@"Type.Opaque"); + const type_opaque_ty = try sema.getStdLangType(src, .@"Type.Opaque"); const decls_val = try sema.typeInfoDecls(src, ty.getNamespace(zcu)); @@ -16764,7 +16764,7 @@ fn typeInfoDecls( const zcu = pt.zcu; const gpa = sema.gpa; - const declaration_ty = try sema.getBuiltinType(src, .@"Type.Declaration"); + const declaration_ty = try sema.getStdLangType(src, .@"Type.Declaration"); var decl_vals = std.array_list.Managed(InternPool.Index).init(gpa); defer decl_vals.deinit(); @@ -17714,7 +17714,7 @@ fn maybePushErrorTrace( assert(pt.zcu.intern_pool.funcAnalysisUnordered(sema.owner.unwrap().func).has_error_trace); const gpa = sema.gpa; - const return_err_fn = Air.internedToRef(try sema.getBuiltin(src, .returnError)); + const return_err_fn = Air.internedToRef(try sema.getStdLangValue(src, .returnError)); if (!need_check) { try sema.callBuiltin(parent_block, src, return_err_fn, .never_tail, &.{}, .@"error return"); @@ -19179,7 +19179,7 @@ fn getErrorReturnTrace(sema: *Sema, block: *Block) CompileError!Air.Inst.Ref { const pt = sema.pt; const zcu = pt.zcu; const ip = &zcu.intern_pool; - const stack_trace_ty = try sema.getBuiltinType(block.nodeOffset(.zero), .StackTrace); + const stack_trace_ty = try sema.getStdLangType(block.nodeOffset(.zero), .StackTrace); const ptr_stack_trace_ty = try pt.singleMutPtrType(stack_trace_ty); const opt_ptr_stack_trace_ty = try pt.optionalType(ptr_stack_trace_ty.toIntern()); @@ -19446,7 +19446,7 @@ fn zirReifyInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai const signedness_src = block.builtinCallArgSrc(inst_data.src_node, 0); const bits_src = block.builtinCallArgSrc(inst_data.src_node, 1); const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; - const signedness = try sema.resolveBuiltinEnum(block, signedness_src, extra.lhs, .Signedness, .{ .simple = .int_signedness }); + const signedness = try sema.resolveStdLangEnum(block, signedness_src, extra.lhs, .Signedness, .{ .simple = .int_signedness }); const bits: u16 = @intCast(try sema.resolveInt(block, bits_src, extra.rhs, .u16, .{ .simple = .int_bit_width })); if (bits == 0 and signedness == .signed) { return sema.fail(block, bits_src, "signed integer cannot have bit width 0", .{}); @@ -19469,11 +19469,11 @@ fn zirReifySliceArgTy( const comptime_reason: std.zig.SimpleComptimeReason, const in_scalar_ty: Type, const out_scalar_ty: Type = switch (info) { // zig fmt: off - .type_to_fn_param_attrs => .{ .fn_param_attrs, .type, try sema.getBuiltinType(src, .@"Type.Fn.Param.Attributes") }, + .type_to_fn_param_attrs => .{ .fn_param_attrs, .type, try sema.getStdLangType(src, .@"Type.Fn.Param.Attributes") }, .string_to_struct_field_type => .{ .struct_field_types, .slice_const_u8, .type }, .string_to_union_field_type => .{ .union_field_types, .slice_const_u8, .type }, - .string_to_struct_field_attrs => .{ .struct_field_attrs, .slice_const_u8, try sema.getBuiltinType(src, .@"Type.StructField.Attributes") }, - .string_to_union_field_attrs => .{ .union_field_attrs, .slice_const_u8, try sema.getBuiltinType(src, .@"Type.UnionField.Attributes") }, + .string_to_struct_field_attrs => .{ .struct_field_attrs, .slice_const_u8, try sema.getStdLangType(src, .@"Type.StructField.Attributes") }, + .string_to_union_field_attrs => .{ .union_field_attrs, .slice_const_u8, try sema.getStdLangType(src, .@"Type.UnionField.Attributes") }, // zig fmt: on }; @@ -19599,18 +19599,18 @@ fn zirReifyPointer( const elem_ty_src = block.builtinCallArgSrc(extra.node, 2); const sentinel_src = block.builtinCallArgSrc(extra.node, 3); - const size_ty = try sema.getBuiltinType(size_src, .@"Type.Pointer.Size"); - const attrs_ty = try sema.getBuiltinType(attrs_src, .@"Type.Pointer.Attributes"); + const size_ty = try sema.getStdLangType(size_src, .@"Type.Pointer.Size"); + const attrs_ty = try sema.getStdLangType(attrs_src, .@"Type.Pointer.Attributes"); const size_uncoerced = sema.resolveInst(extra.size); const size_coerced = try sema.coerce(block, size_ty, size_uncoerced, size_src); const size_val = try sema.resolveConstDefinedValue(block, size_src, size_coerced, .{ .simple = .pointer_size }); - const size = try sema.interpretBuiltinType(block, size_src, size_val, std.builtin.Type.Pointer.Size); + const size = try sema.interpretStdLangType(block, size_src, size_val, std.builtin.Type.Pointer.Size); const attrs_uncoerced = sema.resolveInst(extra.attrs); const attrs_coerced = try sema.coerce(block, attrs_ty, attrs_uncoerced, attrs_src); const attrs_val = try sema.resolveConstDefinedValue(block, attrs_src, attrs_coerced, .{ .simple = .pointer_attrs }); - const attrs = try sema.interpretBuiltinType(block, attrs_src, attrs_val, std.builtin.Type.Pointer.Attributes); + const attrs = try sema.interpretStdLangType(block, attrs_src, attrs_val, std.builtin.Type.Pointer.Attributes); const @"align": Alignment = if (attrs.@"align") |bytes| a: { break :a try sema.validateAlign(block, attrs_src, bytes); @@ -19687,8 +19687,8 @@ fn zirReifyFn( const ret_ty_src = block.builtinCallArgSrc(extra.node, 2); const fn_attrs_src = block.builtinCallArgSrc(extra.node, 3); - const single_param_attrs_ty = try sema.getBuiltinType(param_attrs_src, .@"Type.Fn.Param.Attributes"); - const fn_attrs_ty = try sema.getBuiltinType(fn_attrs_src, .@"Type.Fn.Attributes"); + const single_param_attrs_ty = try sema.getStdLangType(param_attrs_src, .@"Type.Fn.Param.Attributes"); + const fn_attrs_ty = try sema.getStdLangType(fn_attrs_src, .@"Type.Fn.Attributes"); const param_types_uncoerced = sema.resolveInst(extra.param_types); const param_types_coerced = try sema.coerce(block, .slice_const_type, param_types_uncoerced, param_types_src); @@ -19711,13 +19711,13 @@ fn zirReifyFn( const fn_attrs_uncoerced = sema.resolveInst(extra.fn_attrs); const fn_attrs_coerced = try sema.coerce(block, fn_attrs_ty, fn_attrs_uncoerced, fn_attrs_src); const fn_attrs_val = try sema.resolveConstDefinedValue(block, fn_attrs_src, fn_attrs_coerced, .{ .simple = .fn_attrs }); - const fn_attrs = try sema.interpretBuiltinType(block, fn_attrs_src, fn_attrs_val, std.builtin.Type.Fn.Attributes); + const fn_attrs = try sema.interpretStdLangType(block, fn_attrs_src, fn_attrs_val, std.builtin.Type.Fn.Attributes); var noalias_bits: u32 = 0; const param_types_ip = try sema.arena.alloc(InternPool.Index, @intCast(params_len)); for (param_types_ip, 0..@intCast(params_len)) |*param_ty_ip, param_idx| { const param_ty: Type = (try param_types_arr.elemValue(pt, param_idx)).toType(); - const param_attrs = try sema.interpretBuiltinType( + const param_attrs = try sema.interpretStdLangType( block, param_attrs_src, try param_attrs_arr.elemValue(pt, param_idx), @@ -19825,13 +19825,13 @@ fn zirReifyStruct( } }, }; - const container_layout_ty = try sema.getBuiltinType(layout_src, .@"Type.ContainerLayout"); - const single_field_attrs_ty = try sema.getBuiltinType(field_attrs_src, .@"Type.StructField.Attributes"); + const container_layout_ty = try sema.getStdLangType(layout_src, .@"Type.ContainerLayout"); + const single_field_attrs_ty = try sema.getStdLangType(field_attrs_src, .@"Type.StructField.Attributes"); const layout_uncoerced = sema.resolveInst(extra.layout); const layout_coerced = try sema.coerce(block, container_layout_ty, layout_uncoerced, layout_src); const layout_val = try sema.resolveConstDefinedValue(block, layout_src, layout_coerced, .{ .simple = .struct_layout }); - const layout = try sema.interpretBuiltinType(block, layout_src, layout_val, std.builtin.Type.ContainerLayout); + const layout = try sema.interpretStdLangType(block, layout_src, layout_val, std.builtin.Type.ContainerLayout); const backing_int_ty_uncoerced = sema.resolveInst(extra.backing_ty); const backing_int_ty_coerced = try sema.coerce(block, .optional_type, backing_int_ty_uncoerced, backing_ty_src); @@ -20105,13 +20105,13 @@ fn zirReifyUnion( } }, }; - const container_layout_ty = try sema.getBuiltinType(layout_src, .@"Type.ContainerLayout"); - const single_field_attrs_ty = try sema.getBuiltinType(field_attrs_src, .@"Type.UnionField.Attributes"); + const container_layout_ty = try sema.getStdLangType(layout_src, .@"Type.ContainerLayout"); + const single_field_attrs_ty = try sema.getStdLangType(field_attrs_src, .@"Type.UnionField.Attributes"); const layout_uncoerced = sema.resolveInst(extra.layout); const layout_coerced = try sema.coerce(block, container_layout_ty, layout_uncoerced, layout_src); const layout_val = try sema.resolveConstDefinedValue(block, layout_src, layout_coerced, .{ .simple = .union_layout }); - const layout = try sema.interpretBuiltinType(block, layout_src, layout_val, std.builtin.Type.ContainerLayout); + const layout = try sema.interpretStdLangType(block, layout_src, layout_val, std.builtin.Type.ContainerLayout); const arg_ty_uncoerced = sema.resolveInst(extra.arg_ty); const arg_ty_coerced = try sema.coerce(block, .optional_type, arg_ty_uncoerced, arg_ty_src); @@ -20191,7 +20191,7 @@ fn zirReifyUnion( const field_name = try sema.sliceToIpString(block, field_names_src, field_name_val, .{ .simple = .union_field_names }); std.hash.autoHash(&hasher, field_name); - const field_attrs = try sema.interpretBuiltinType( + const field_attrs = try sema.interpretStdLangType( block, field_attrs_src, try field_attrs_arr.elemValue(pt, field_idx), @@ -20240,7 +20240,7 @@ fn zirReifyUnion( wip.field_types.get(ip)[field_idx] = field_ty.toIntern(); // No source location; first loop checked this is valid. - const field_attrs = try sema.interpretBuiltinType( + const field_attrs = try sema.interpretStdLangType( block, .unneeded, try field_attrs_arr.elemValue(pt, field_idx), @@ -20319,7 +20319,7 @@ fn zirReifyEnum( } }, }; - const enum_mode_ty = try sema.getBuiltinType(mode_src, .@"Type.Enum.Mode"); + const enum_mode_ty = try sema.getStdLangType(mode_src, .@"Type.Enum.Mode"); const tag_ty_uncoerced = sema.resolveInst(extra.tag_ty); const tag_ty_coerced = try sema.coerce(block, .type, tag_ty_uncoerced, tag_ty_src); @@ -20329,7 +20329,7 @@ fn zirReifyEnum( const mode_uncoerced = sema.resolveInst(extra.mode); const mode_coerced = try sema.coerce(block, enum_mode_ty, mode_uncoerced, mode_src); const mode_val = try sema.resolveConstDefinedValue(block, mode_src, mode_coerced, .{ .simple = .type }); - const nonexhaustive = switch (try sema.interpretBuiltinType(block, mode_src, mode_val, std.builtin.Type.Enum.Mode)) { + const nonexhaustive = switch (try sema.interpretStdLangType(block, mode_src, mode_val, std.builtin.Type.Enum.Mode)) { .exhaustive => false, .nonexhaustive => true, }; @@ -20423,7 +20423,7 @@ fn zirReifyEnum( fn resolveVaListRef(sema: *Sema, block: *Block, src: LazySrcLoc, zir_ref: Zir.Inst.Ref) CompileError!Air.Inst.Ref { const pt = sema.pt; - const va_list_ty = try sema.getBuiltinType(src, .VaList); + const va_list_ty = try sema.getStdLangType(src, .VaList); const va_list_ptr = try pt.singleMutPtrType(va_list_ty); const inst = sema.resolveInst(zir_ref); @@ -20462,7 +20462,7 @@ fn zirCVaCopy(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) const va_list_src = block.builtinCallArgSrc(extra.node, 0); const va_list_ref = try sema.resolveVaListRef(block, va_list_src, extra.operand); - const va_list_ty = try sema.getBuiltinType(src, .VaList); + const va_list_ty = try sema.getStdLangType(src, .VaList); try sema.requireRuntimeBlock(block, src, null); return block.addTyOp(.c_va_copy, va_list_ty, va_list_ref); @@ -20484,7 +20484,7 @@ fn zirCVaStart(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) const src_node: std.zig.Ast.Node.Offset = @enumFromInt(@as(i32, @bitCast(extended.operand))); const src = block.nodeOffset(src_node); - const va_list_ty = try sema.getBuiltinType(src, .VaList); + const va_list_ty = try sema.getStdLangType(src, .VaList); try sema.requireRuntimeBlock(block, src, null); return block.addInst(.{ .tag = .c_va_start, @@ -22373,7 +22373,7 @@ fn resolveExportOptions( const io = comp.io; const ip = &zcu.intern_pool; - const export_options_ty = try sema.getBuiltinType(src, .ExportOptions); + const export_options_ty = try sema.getStdLangType(src, .ExportOptions); const air_ref = sema.resolveInst(zir_ref); const options = try sema.coerce(block, export_options_ty, air_ref, src); @@ -22387,7 +22387,7 @@ fn resolveExportOptions( const linkage_operand = try sema.fieldVal(block, src, options, try ip.getOrPutString(gpa, io, pt.tid, "linkage", .no_embedded_nulls), linkage_src); const linkage_val = try sema.resolveConstDefinedValue(block, linkage_src, linkage_operand, .{ .simple = .export_options }); - const linkage = try sema.interpretBuiltinType(block, linkage_src, linkage_val, std.builtin.GlobalLinkage); + const linkage = try sema.interpretStdLangType(block, linkage_src, linkage_val, std.builtin.GlobalLinkage); const section_operand = try sema.fieldVal(block, src, options, try ip.getOrPutString(gpa, io, pt.tid, "section", .no_embedded_nulls), section_src); const section_opt_val = try sema.resolveConstDefinedValue(block, section_src, section_operand, .{ .simple = .export_options }); @@ -22398,7 +22398,7 @@ fn resolveExportOptions( const visibility_operand = try sema.fieldVal(block, src, options, try ip.getOrPutString(gpa, io, pt.tid, "visibility", .no_embedded_nulls), visibility_src); const visibility_val = try sema.resolveConstDefinedValue(block, visibility_src, visibility_operand, .{ .simple = .export_options }); - const visibility = try sema.interpretBuiltinType(block, visibility_src, visibility_val, std.builtin.SymbolVisibility); + const visibility = try sema.interpretStdLangType(block, visibility_src, visibility_val, std.builtin.SymbolVisibility); if (name.len < 1) { return sema.fail(block, name_src, "exported symbol name cannot be empty", .{}); @@ -22418,19 +22418,19 @@ fn resolveExportOptions( }; } -fn resolveBuiltinEnum( +fn resolveStdLangEnum( sema: *Sema, block: *Block, src: LazySrcLoc, zir_ref: Zir.Inst.Ref, - comptime name: Zcu.BuiltinDecl, + comptime name: Zcu.StdLangDecl, reason: ComptimeReason, ) CompileError!@field(std.builtin, @tagName(name)) { - const ty = try sema.getBuiltinType(src, name); + const ty = try sema.getStdLangType(src, name); const air_ref = sema.resolveInst(zir_ref); const coerced = try sema.coerce(block, ty, air_ref, src); const val = try sema.resolveConstDefinedValue(block, src, coerced, reason); - return sema.interpretBuiltinType(block, src, val, @field(std.builtin, @tagName(name))); + return sema.interpretStdLangType(block, src, val, @field(std.builtin, @tagName(name))); } fn resolveAtomicOrder( @@ -22440,7 +22440,7 @@ fn resolveAtomicOrder( zir_ref: Zir.Inst.Ref, reason: ComptimeReason, ) CompileError!std.builtin.AtomicOrder { - return sema.resolveBuiltinEnum(block, src, zir_ref, .AtomicOrder, reason); + return sema.resolveStdLangEnum(block, src, zir_ref, .AtomicOrder, reason); } fn resolveAtomicRmwOp( @@ -22449,7 +22449,7 @@ fn resolveAtomicRmwOp( src: LazySrcLoc, zir_ref: Zir.Inst.Ref, ) CompileError!std.builtin.AtomicRmwOp { - return sema.resolveBuiltinEnum(block, src, zir_ref, .AtomicRmwOp, .{ .simple = .operand_atomicRmw_operation }); + return sema.resolveStdLangEnum(block, src, zir_ref, .AtomicRmwOp, .{ .simple = .operand_atomicRmw_operation }); } fn zirCmpxchg( @@ -22609,7 +22609,7 @@ fn zirReduce(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air. const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; const op_src = block.builtinCallArgSrc(inst_data.src_node, 0); const operand_src = block.builtinCallArgSrc(inst_data.src_node, 1); - const operation = try sema.resolveBuiltinEnum(block, op_src, extra.lhs, .ReduceOp, .{ .simple = .operand_reduce_operation }); + const operation = try sema.resolveStdLangEnum(block, op_src, extra.lhs, .ReduceOp, .{ .simple = .operand_reduce_operation }); const operand = sema.resolveInst(extra.rhs); const operand_ty = sema.typeOf(operand); const pt = sema.pt; @@ -23196,11 +23196,11 @@ fn zirBuiltinCall(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError const extra = sema.code.extraData(Zir.Inst.BuiltinCall, inst_data.payload_index).data; const func = sema.resolveInst(extra.callee); - const modifier_ty = try sema.getBuiltinType(call_src, .CallModifier); + const modifier_ty = try sema.getStdLangType(call_src, .CallModifier); const air_ref = sema.resolveInst(extra.modifier); const modifier_ref = try sema.coerce(block, modifier_ty, air_ref, modifier_src); const modifier_val = try sema.resolveConstDefinedValue(block, modifier_src, modifier_ref, .{ .simple = .call_modifier }); - var modifier = try sema.interpretBuiltinType(block, modifier_src, modifier_val, std.builtin.CallModifier); + var modifier = try sema.interpretStdLangType(block, modifier_src, modifier_val, std.builtin.CallModifier); switch (modifier) { // These can be upgraded to comptime or nosuspend calls. .auto, .never_tail, .no_suspend => { @@ -24256,13 +24256,13 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A const body = sema.code.bodySlice(extra_index, body_len); extra_index += body.len; - const cc_ty = try sema.getBuiltinType(cc_src, .CallingConvention); + const cc_ty = try sema.getStdLangType(cc_src, .CallingConvention); const val = try sema.resolveGenericBody(block, cc_src, body, inst, cc_ty, .{ .simple = .@"callconv" }); break :blk try sema.analyzeValueAsCallconv(block, cc_src, val); } else if (extra.data.bits.has_cc_ref) blk: { const cc_ref: Zir.Inst.Ref = @enumFromInt(sema.code.extra[extra_index]); extra_index += 1; - const cc_ty = try sema.getBuiltinType(cc_src, .CallingConvention); + const cc_ty = try sema.getStdLangType(cc_src, .CallingConvention); const uncoerced_cc = sema.resolveInst(cc_ref); const coerced_cc = try sema.coerce(block, cc_ty, uncoerced_cc, cc_src); const cc_val = try sema.resolveConstDefinedValue(block, cc_src, coerced_cc, .{ .simple = .@"callconv" }); @@ -24275,10 +24275,10 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A if (zir_decl.linkage == .@"export") { break :cc target.cCallingConvention() orelse { // This target has no default C calling convention. We sometimes trigger a similar - // error by trying to evaluate `std.builtin.CallingConvention.c`, so for consistency, + // error by trying to evaluate `std.lang.CallingConvention.c`, so for consistency, // let's eval that now and just get the transitive error. (It's guaranteed to error // because it does the exact `cCallingConvention` call we just did.) - const cc_type = try sema.getBuiltinType(cc_src, .CallingConvention); + const cc_type = try sema.getStdLangType(cc_src, .CallingConvention); _ = try sema.namespaceLookupVal( block, LazySrcLoc.unneeded, @@ -24286,7 +24286,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A try ip.getOrPutString(gpa, io, pt.tid, "c", .no_embedded_nulls), ); // The above should have errored. - @panic("std.builtin is corrupt"); + @panic("std.lang is corrupt"); }; } } @@ -24406,7 +24406,7 @@ fn resolvePrefetchOptions( const io = comp.io; const ip = &zcu.intern_pool; - const options_ty = try sema.getBuiltinType(src, .PrefetchOptions); + const options_ty = try sema.getStdLangType(src, .PrefetchOptions); const options = try sema.coerce(block, options_ty, sema.resolveInst(zir_ref), src); const rw_src = block.src(.{ .init_field_rw = src.offset.node_offset_builtin_call_arg.builtin_call_node }); @@ -24423,9 +24423,9 @@ fn resolvePrefetchOptions( const cache_val = try sema.resolveConstDefinedValue(block, cache_src, cache, .{ .simple = .prefetch_options }); return std.builtin.PrefetchOptions{ - .rw = try sema.interpretBuiltinType(block, rw_src, rw_val, std.builtin.PrefetchOptions.Rw), + .rw = try sema.interpretStdLangType(block, rw_src, rw_val, std.builtin.PrefetchOptions.Rw), .locality = @intCast(locality_val.toUnsignedInt(zcu)), - .cache = try sema.interpretBuiltinType(block, cache_src, cache_val, std.builtin.PrefetchOptions.Cache), + .cache = try sema.interpretStdLangType(block, cache_src, cache_val, std.builtin.PrefetchOptions.Cache), }; } @@ -24480,7 +24480,7 @@ fn resolveExternOptions( const ip = &zcu.intern_pool; const options_inst = sema.resolveInst(zir_ref); - const extern_options_ty = try sema.getBuiltinType(src, .ExternOptions); + const extern_options_ty = try sema.getStdLangType(src, .ExternOptions); const options = try sema.coerce(block, extern_options_ty, options_inst, src); const name_src = block.src(.{ .init_field_name = src.offset.node_offset_builtin_call_arg.builtin_call_node }); @@ -24500,11 +24500,11 @@ fn resolveExternOptions( const linkage_ref = try sema.fieldVal(block, src, options, try ip.getOrPutString(gpa, io, pt.tid, "linkage", .no_embedded_nulls), linkage_src); const linkage_val = try sema.resolveConstDefinedValue(block, linkage_src, linkage_ref, .{ .simple = .extern_options }); - const linkage = try sema.interpretBuiltinType(block, linkage_src, linkage_val, std.builtin.GlobalLinkage); + const linkage = try sema.interpretStdLangType(block, linkage_src, linkage_val, std.builtin.GlobalLinkage); const visibility_ref = try sema.fieldVal(block, src, options, try ip.getOrPutString(gpa, io, pt.tid, "visibility", .no_embedded_nulls), visibility_src); const visibility_val = try sema.resolveConstDefinedValue(block, visibility_src, visibility_ref, .{ .simple = .extern_options }); - const visibility = try sema.interpretBuiltinType(block, visibility_src, visibility_val, std.builtin.SymbolVisibility); + const visibility = try sema.interpretStdLangType(block, visibility_src, visibility_val, std.builtin.SymbolVisibility); const is_thread_local = try sema.fieldVal(block, src, options, try ip.getOrPutString(gpa, io, pt.tid, "is_thread_local", .no_embedded_nulls), thread_local_src); const is_thread_local_val = try sema.resolveConstDefinedValue(block, thread_local_src, is_thread_local, .{ .simple = .extern_options }); @@ -24523,11 +24523,11 @@ fn resolveExternOptions( const relocation_ref = try sema.fieldVal(block, src, options, try ip.getOrPutString(gpa, io, pt.tid, "relocation", .no_embedded_nulls), relocation_src); const relocation_val = try sema.resolveConstDefinedValue(block, relocation_src, relocation_ref, .{ .simple = .extern_options }); - const relocation = try sema.interpretBuiltinType(block, relocation_src, relocation_val, std.builtin.ExternOptions.Relocation); + const relocation = try sema.interpretStdLangType(block, relocation_src, relocation_val, std.builtin.ExternOptions.Relocation); const decoration_ref = try sema.fieldVal(block, src, options, try ip.getOrPutString(gpa, io, pt.tid, "decoration", .no_embedded_nulls), decoration_src); const decoration_val = try sema.resolveConstDefinedValue(block, decoration_src, decoration_ref, .{ .simple = .extern_options }); - const decoration = try sema.interpretBuiltinType(block, decoration_src, decoration_val, ?std.builtin.ExternOptions.Decoration); + const decoration = try sema.interpretStdLangType(block, decoration_src, decoration_val, ?std.builtin.ExternOptions.Decoration); if (name.len == 0) { return sema.fail(block, name_src, "extern symbol name cannot be empty", .{}); @@ -24696,7 +24696,7 @@ fn zirInComptime( return if (block.isComptime()) .bool_true else .bool_false; } -fn zirBuiltinValue(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) CompileError!Air.Inst.Ref { +fn zirStdLangValue(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) CompileError!Air.Inst.Ref { const pt = sema.pt; const zcu = pt.zcu; const comp = zcu.comp; @@ -24706,9 +24706,9 @@ fn zirBuiltinValue(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstD const src_node: std.zig.Ast.Node.Offset = @enumFromInt(@as(i32, @bitCast(extended.operand))); const src = block.nodeOffset(src_node); - const value: Zir.Inst.BuiltinValue = @enumFromInt(extended.small); + const value: Zir.Inst.StdLangValue = @enumFromInt(extended.small); - const builtin_type: Zcu.BuiltinDecl = switch (value) { + const std_lang_type: Zcu.StdLangDecl = switch (value) { // zig fmt: off .atomic_order => .AtomicOrder, .atomic_rmw_op => .AtomicRmwOp, @@ -24732,28 +24732,28 @@ fn zirBuiltinValue(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstD // Values are handled here. .calling_convention_c => { - const callconv_ty = try sema.getBuiltinType(src, .CallingConvention); + const callconv_ty = try sema.getStdLangType(src, .CallingConvention); // Cannot use `Value.uninterpret` because `c` is a *declaration* whose value depends on the target. return try sema.namespaceLookupVal( block, src, callconv_ty.getNamespaceIndex(zcu), try ip.getOrPutString(gpa, io, pt.tid, "c", .no_embedded_nulls), - ) orelse @panic("std.builtin is corrupt"); + ) orelse @panic("std.lang is corrupt"); }, .calling_convention_inline => { - const callconv_ty = try sema.getBuiltinType(src, .CallingConvention); + const callconv_ty = try sema.getStdLangType(src, .CallingConvention); return .fromValue(Value.uninterpret( @as(std.builtin.CallingConvention, .@"inline"), callconv_ty, pt, ) catch |err| switch (err) { - error.TypeMismatch => @panic("std.builtin is corrupt"), + error.TypeMismatch => @panic("std.lang is corrupt"), error.OutOfMemory => |e| return e, }); }, }; - return .fromType(try sema.getBuiltinType(src, builtin_type)); + return .fromType(try sema.getStdLangType(src, std_lang_type)); } fn zirInplaceArithResultTy(sema: *Sema, extended: Zir.Inst.Extended.InstData) CompileError!Air.Inst.Ref { @@ -24788,14 +24788,14 @@ fn zirBranchHint(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstDat const uncoerced_hint = sema.resolveInst(extra.operand); const operand_src = block.builtinCallArgSrc(extra.node, 0); - const hint_ty = try sema.getBuiltinType(operand_src, .BranchHint); + const hint_ty = try sema.getStdLangType(operand_src, .BranchHint); const coerced_hint = try sema.coerce(block, hint_ty, uncoerced_hint, operand_src); const hint_val = try sema.resolveConstDefinedValue(block, operand_src, coerced_hint, .{ .simple = .operand_branchHint }); // We only apply the first hint in a branch. // This allows user-provided hints to override implicit cold hints. if (sema.branch_hint == null) { - sema.branch_hint = try sema.interpretBuiltinType(block, operand_src, hint_val, std.builtin.BranchHint); + sema.branch_hint = try sema.interpretStdLangType(block, operand_src, hint_val, std.builtin.BranchHint); } } @@ -25148,7 +25148,7 @@ fn getPanicIdFunc(sema: *Sema, src: LazySrcLoc, panic_id: Zcu.SimplePanicId) !In const zcu = sema.pt.zcu; const io = zcu.comp.io; try sema.ensureMemoizedStateResolved(src, .panic); - const panic_fn_index = zcu.builtin_decl_values.get(panic_id.toBuiltin()); + const panic_fn_index = zcu.std_lang_decl_values.get(panic_id.toStdLangDecl()); switch (sema.owner.unwrap()) { .@"comptime", .nav_ty, @@ -25292,7 +25292,7 @@ fn safetyPanicUnwrapError(sema: *Sema, block: *Block, src: LazySrcLoc, err: Air. if (!zcu.backendSupportsFeature(.panic_fn)) { _ = try block.addNoOp(.trap); } else { - const panic_fn = try getBuiltin(sema, src, .@"panic.unwrapError"); + const panic_fn = try getStdLangValue(sema, src, .@"panic.unwrapError"); try sema.callBuiltin(block, src, Air.internedToRef(panic_fn), .auto, &.{err}, .@"safety check"); } } @@ -25382,7 +25382,7 @@ fn addSafetyCheckCall( parent_block: *Block, src: LazySrcLoc, ok: Air.Inst.Ref, - comptime func_decl: Zcu.BuiltinDecl, + comptime func_decl: Zcu.StdLangDecl, args: []const Air.Inst.Ref, ) !void { assert(!parent_block.isComptime()); @@ -25406,7 +25406,7 @@ fn addSafetyCheckCall( if (!zcu.backendSupportsFeature(.panic_fn)) { _ = try fail_block.addNoOp(.trap); } else { - const panic_fn = try getBuiltin(sema, src, func_decl); + const panic_fn = try getStdLangValue(sema, src, func_decl); try sema.callBuiltin(&fail_block, src, Air.internedToRef(panic_fn), .auto, args, .@"safety check"); } @@ -33114,10 +33114,10 @@ pub fn analyzeAsAddressSpace( ctx: std.Target.AddressSpaceContext, ) !std.builtin.AddressSpace { const pt = sema.pt; - const addrspace_ty = try sema.getBuiltinType(src, .AddressSpace); + const addrspace_ty = try sema.getStdLangType(src, .AddressSpace); const coerced = try sema.coerce(block, addrspace_ty, air_ref, src); const addrspace_val = try sema.resolveConstDefinedValue(block, src, coerced, .{ .simple = .@"addrspace" }); - const address_space = try sema.interpretBuiltinType(block, src, addrspace_val, std.builtin.AddressSpace); + const address_space = try sema.interpretStdLangType(block, src, addrspace_val, std.builtin.AddressSpace); const target = pt.zcu.getTarget(); if (!target.supportsAddressSpace(address_space, ctx)) { @@ -33819,15 +33819,15 @@ pub const type_resolution = @import("Sema/type_resolution.zig"); pub const ensureLayoutResolved = type_resolution.ensureLayoutResolved; pub const ensureStructDefaultsResolved = type_resolution.ensureStructDefaultsResolved; -pub fn getBuiltinType(sema: *Sema, src: LazySrcLoc, decl: Zcu.BuiltinDecl) SemaError!Type { +pub fn getStdLangType(sema: *Sema, src: LazySrcLoc, decl: Zcu.StdLangDecl) SemaError!Type { assert(decl.kind() == .type); try sema.ensureMemoizedStateResolved(src, decl.stage()); - return .fromInterned(sema.pt.zcu.builtin_decl_values.get(decl)); + return .fromInterned(sema.pt.zcu.std_lang_decl_values.get(decl)); } -pub fn getBuiltin(sema: *Sema, src: LazySrcLoc, decl: Zcu.BuiltinDecl) SemaError!InternPool.Index { +pub fn getStdLangValue(sema: *Sema, src: LazySrcLoc, decl: Zcu.StdLangDecl) SemaError!InternPool.Index { assert(decl.kind() != .type); try sema.ensureMemoizedStateResolved(src, decl.stage()); - return sema.pt.zcu.builtin_decl_values.get(decl); + return sema.pt.zcu.std_lang_decl_values.get(decl); } pub const NavPtrModifiers = struct { @@ -33928,30 +33928,30 @@ pub fn analyzeMemoizedState(sema: *Sema, stage: InternPool.MemoizedStateStage) C }; defer block.instructions.deinit(gpa); - const std_builtin_ty: Type = ty: { + const std_lang_ty: Type = ty: { const std_src = block.nodeOffset(.zero); - const decl_name = try ip.getOrPutString(gpa, io, pt.tid, "builtin", .no_embedded_nulls); + const decl_name = try ip.getOrPutString(gpa, io, pt.tid, "lang", .no_embedded_nulls); const nav = try sema.namespaceLookup(&block, std_src, block.namespace, decl_name) orelse { - return sema.fail(&block, std_src, "'std' missing 'builtin'", .{}); + return sema.fail(&block, std_src, "'std' missing 'lang'", .{}); }; const uncoerced_val = try sema.analyzeNavVal(&block, std_src, nav); const decl_src: LazySrcLoc = .{ .base_node_inst = ip.getNav(nav).srcInst(ip), .offset = .nodeOffset(.zero), }; - break :ty try sema.analyzeAsType(&block, decl_src, .std_builtin_decl, uncoerced_val); + break :ty try sema.analyzeAsType(&block, decl_src, .std_lang_decl, uncoerced_val); }; var any_changed = false; - inline for (comptime std.enums.values(Zcu.BuiltinDecl)) |builtin_decl| { - if (stage == comptime builtin_decl.stage()) { - const parent_ns_ty: Type, const parent_name: []const u8, const name: []const u8 = switch (comptime builtin_decl.access()) { - .direct => |name| .{ std_builtin_ty, "std.builtin", name }, + inline for (comptime std.enums.values(Zcu.StdLangDecl)) |std_lang_decl| { + if (stage == comptime std_lang_decl.stage()) { + const parent_ns_ty: Type, const parent_name: []const u8, const name: []const u8 = switch (comptime std_lang_decl.access()) { + .direct => |name| .{ std_lang_ty, "std.lang", name }, .nested => |nested| access: { const parent_decl, const name = nested; - const parent_ty: Type = .fromInterned(zcu.builtin_decl_values.get(parent_decl)); - break :access .{ parent_ty, "std.builtin." ++ @tagName(parent_decl), name }; + const parent_ty: Type = .fromInterned(zcu.std_lang_decl_values.get(parent_decl)); + break :access .{ parent_ty, "std.lang." ++ @tagName(parent_decl), name }; }, }; @@ -33970,25 +33970,25 @@ pub fn analyzeMemoizedState(sema: *Sema, stage: InternPool.MemoizedStateStage) C .offset = .nodeOffset(.zero), }; - const val: Value = switch (builtin_decl.kind()) { + const val: Value = switch (std_lang_decl.kind()) { .type => val: { - const ty = try sema.analyzeAsType(&block, decl_src, .std_builtin_decl, uncoerced_val); - try sema.ensureLayoutResolved(ty, decl_src, .builtin_type); + const ty = try sema.analyzeAsType(&block, decl_src, .std_lang_decl, uncoerced_val); + try sema.ensureLayoutResolved(ty, decl_src, .std_lang_type); break :val ty.toValue(); }, .func => val: { - const func_ty = try sema.getExpectedBuiltinFnType(builtin_decl); + const func_ty = try sema.getExpectedBuiltinFnType(std_lang_decl); const coerced = try sema.coerce(&block, func_ty, uncoerced_val, decl_src); - break :val try sema.resolveConstDefinedValue(&block, decl_src, coerced, .{ .simple = .std_builtin_decl }); + break :val try sema.resolveConstDefinedValue(&block, decl_src, coerced, .{ .simple = .std_lang_decl }); }, .string => val: { const coerced = try sema.coerce(&block, .slice_const_u8, uncoerced_val, decl_src); - break :val try sema.resolveConstDefinedValue(&block, decl_src, coerced, .{ .simple = .std_builtin_decl }); + break :val try sema.resolveConstDefinedValue(&block, decl_src, coerced, .{ .simple = .std_lang_decl }); }, }; - if (zcu.builtin_decl_values.get(builtin_decl) != val.toIntern()) { - zcu.builtin_decl_values.set(builtin_decl, val.toIntern()); + if (zcu.std_lang_decl_values.get(std_lang_decl) != val.toIntern()) { + zcu.std_lang_decl_values.set(std_lang_decl, val.toIntern()); any_changed = true; } } @@ -33998,7 +33998,7 @@ pub fn analyzeMemoizedState(sema: *Sema, stage: InternPool.MemoizedStateStage) C } /// Given that `decl.kind() == .func`, get the type expected of the function. -fn getExpectedBuiltinFnType(sema: *Sema, decl: Zcu.BuiltinDecl) CompileError!Type { +fn getExpectedBuiltinFnType(sema: *Sema, decl: Zcu.StdLangDecl) CompileError!Type { const pt = sema.pt; return switch (decl) { // `noinline fn () void` diff --git a/src/Sema/type_resolution.zig b/src/Sema/type_resolution.zig index 00da75abecbbc211ebdda06bac46611fb7c87193..c3ef0e41f0b3b2e8febc0c6ddd451fbe35c04045 100644 --- a/src/Sema/type_resolution.zig +++ b/src/Sema/type_resolution.zig @@ -35,7 +35,7 @@ pub const LayoutResolveReason = enum { @"export", @"extern", asm_out_type, - builtin_type, + std_lang_type, /// Written after string: "while resolving type 'T' " /// e.g. "while resolving type 'MyStruct' for variable declared here" @@ -62,7 +62,7 @@ pub const LayoutResolveReason = enum { .@"export" => "for export here", .@"extern" => "for extern declaration here", .asm_out_type => "for inline assembly output type declared here", - .builtin_type => "from 'std.builtin'", + .std_lang_type => "from 'std.lang'", // zig fmt: on }; } diff --git a/src/Value.zig b/src/Value.zig index 6e7d6e1395d120cf5edc5b0f5add5fd5a23c5962..e530edd92bec949a266f22dffb7e3479931c851c 100644 --- a/src/Value.zig +++ b/src/Value.zig @@ -2199,19 +2199,19 @@ pub fn pointerDerivation(ptr_val: Value, arena: Allocator, pt: Zcu.PerThread, op const InterpretMode = enum { /// In this mode, types are assumed to match what the compiler was built with in terms of field /// order, field types, etc. This improves compiler performance. However, it means that certain - /// modifications to `std.builtin` will result in compiler crashes. + /// modifications to `std.lang` will result in compiler crashes. direct, /// In this mode, various details of the type are allowed to differ from what the compiler was built /// with. Fields are matched by name rather than index; added struct fields are ignored, and removed /// struct fields use their default value if one exists. This is slower than `.direct`, but permits - /// making certain changes to `std.builtin` (in particular reordering/adding/removing fields), so it - /// is useful when applying breaking changes. + /// making certain changes to `std.lang` (in particular reordering/adding/removing fields), so it is + /// useful when applying breaking changes. by_name, }; const interpret_mode: InterpretMode = @field(InterpretMode, @tagName(build_options.value_interpret_mode)); /// Given a `Value` representing a comptime-known value of type `T`, unwrap it into an actual `T` known to the compiler. -/// This is useful for accessing `std.builtin` structures received from comptime logic. +/// This is useful for accessing `std.lang` structures received from comptime logic. pub fn interpret(val: Value, comptime T: type, pt: Zcu.PerThread) error{ OutOfMemory, UndefinedValue, TypeMismatch }!T { const zcu = pt.zcu; const io = zcu.comp.io; @@ -2313,7 +2313,7 @@ pub fn interpret(val: Value, comptime T: type, pt: Zcu.PerThread) error{ OutOfMe } /// Given any `val` and a `Type` corresponding `@TypeOf(val)`, construct a `Value` representing it which can be used -/// within the compilation. This is useful for passing `std.builtin` structures in the compiler back to the compilation. +/// within the compilation. This is useful for passing `std.lang` structures in the compiler back to the compilation. /// This is the inverse of `interpret`. pub fn uninterpret(val: anytype, ty: Type, pt: Zcu.PerThread) error{ OutOfMemory, TypeMismatch }!Value { const T = @TypeOf(val); diff --git a/src/Zcu.zig b/src/Zcu.zig index 3e5b9a6e8f00431b864df14d9b6da9c976a1e893..f27f07d2f29c13d046df6ddd5736835070bcdc40 100644 --- a/src/Zcu.zig +++ b/src/Zcu.zig @@ -333,7 +333,7 @@ all_type_references: std.ArrayList(TypeReference) = .empty, free_type_references: std.ArrayList(u32) = .empty, /// Populated by analysis of `AnalUnit.wrap(.{ .memoized_state = s })`, where `s` depends on the element. -builtin_decl_values: BuiltinDecl.Memoized = .initFill(.none), +std_lang_decl_values: StdLangDecl.Memoized = .initFill(.none), incremental_debug_state: if (build_options.enable_debug_extensions) IncrementalDebugState else void = if (build_options.enable_debug_extensions) .init else {}, @@ -425,11 +425,11 @@ pub const EmbedTableAdapter = struct { } }; -/// Names of declarations in `std.builtin` whose values are memoized in a `BuiltinDecl.Memoized`. +/// Names of declarations in `std.lang` whose values are memoized in a `StdLangDecl.Memoized`. /// The name must exactly match the declaration name, as comptime logic is used to compute the namespace accesses. /// Parent namespaces must be before their children in this enum. For instance, `.Type` must be before `.@"Type.Fn"`. -/// Additionally, parent namespaces must be resolved in the same stage as their children; see `BuiltinDecl.stage`. -pub const BuiltinDecl = enum { +/// Additionally, parent namespaces must be resolved in the same stage as their children; see `StdLangDecl.stage`. +pub const StdLangDecl = enum { Signedness, AddressSpace, CallingConvention, @@ -508,7 +508,7 @@ pub const BuiltinDecl = enum { @"assembly.Clobbers", /// Determines what kind of validation will be done to the decl's value. - pub fn kind(decl: BuiltinDecl) enum { type, func, string } { + pub fn kind(decl: StdLangDecl) enum { type, func, string } { return switch (decl) { .returnError => .func, @@ -593,7 +593,7 @@ pub const BuiltinDecl = enum { } /// Resolution of these values is done in three distinct stages: - /// * Resolution of `std.builtin.Panic` and everything under it + /// * Resolution of `std.lang.Panic` and everything under it /// * Resolution of `VaList` /// * Resolution of `assembly` /// * Everything else @@ -606,12 +606,12 @@ pub const BuiltinDecl = enum { /// by itself. /// /// `assembly` is separate because its value depends on the target. - pub fn stage(decl: BuiltinDecl) InternPool.MemoizedStateStage { + pub fn stage(decl: StdLangDecl) InternPool.MemoizedStateStage { return switch (decl) { .VaList => .va_list, .assembly, .@"assembly.Clobbers" => .assembly, else => { - if (@intFromEnum(decl) <= @intFromEnum(BuiltinDecl.@"Type.Declaration")) { + if (@intFromEnum(decl) <= @intFromEnum(StdLangDecl.@"Type.Declaration")) { return .main; } else { return .panic; @@ -621,24 +621,24 @@ pub const BuiltinDecl = enum { } /// Based on the tag name, determines how to access this decl; either as a direct child of the - /// `std.builtin` namespace, or as a child of some preceding `BuiltinDecl` value. - pub fn access(decl: BuiltinDecl) union(enum) { + /// `std.lang` namespace, or as a child of some preceding `StdLangDecl` value. + pub fn access(decl: StdLangDecl) union(enum) { direct: []const u8, - nested: struct { BuiltinDecl, []const u8 }, + nested: struct { StdLangDecl, []const u8 }, } { @setEvalBranchQuota(2000); return switch (decl) { inline else => |tag| { const name = @tagName(tag); const split = (comptime std.mem.lastIndexOfScalar(u8, name, '.')) orelse return .{ .direct = name }; - const parent = @field(BuiltinDecl, name[0..split]); + const parent = @field(StdLangDecl, name[0..split]); comptime assert(@intFromEnum(parent) < @intFromEnum(tag)); // dependencies ordered correctly return .{ .nested = .{ parent, name[split + 1 ..] } }; }, }; } - const Memoized = std.enums.EnumArray(BuiltinDecl, InternPool.Index); + const Memoized = std.enums.EnumArray(StdLangDecl, InternPool.Index); }; pub const SimplePanicId = enum { @@ -662,7 +662,7 @@ pub const SimplePanicId = enum { memcpy_alias, noreturn_returned, - pub fn toBuiltin(id: SimplePanicId) BuiltinDecl { + pub fn toStdLangDecl(id: SimplePanicId) StdLangDecl { return switch (id) { // zig fmt: off .reached_unreachable => .@"panic.reachedUnreachable", @@ -3941,7 +3941,7 @@ pub fn addGlobalAssembly(zcu: *Zcu, unit: AnalUnit, source: []const u8) !void { pub const Feature = enum { /// When this feature is enabled, Sema will emit calls to - /// `std.builtin.panic` functions for things like safety checks and + /// `std.lang.panic` functions for things like safety checks and /// unreachables. Otherwise traps will be emitted. panic_fn, /// When this feature is enabled, Sema will insert tracer functions for gathering a stack @@ -4995,7 +4995,7 @@ fn addDependencyLoopErrorLine( }), .memoized_state => |stage| switch (stage) { .panic => try eb.printString("{f} requires panic handler for call here", .{fmt_source}), - else => try eb.printString("{f} requires 'std.builtin' declarations here", .{fmt_source}), + else => try eb.printString("{f} requires 'std.lang' declarations here", .{fmt_source}), }, .func => |func| try eb.printString("{f} uses inferred error set of function '{f}' here", .{ fmt_source, ip.getNav(zcu.funcInfo(func).owner_nav).fqn.fmt(ip), @@ -5046,7 +5046,7 @@ fn formatDependencyLoopSourceUnit(data: FormatAnalUnit, w: *Io.Writer) Io.Writer .nav_ty => |nav| try w.print("type of declaration '{f}'", .{ip.getNav(nav).fqn.fmt(ip)}), .memoized_state => |stage| switch (stage) { .panic => try w.writeAll("panic handler"), - else => try w.writeAll("'std.builtin' declarations"), + else => try w.writeAll("'std.lang' declarations"), }, .type_layout => |ty| try w.print("type '{f}'", .{ Type.fromInterned(ty).containerTypeName(ip).fmt(ip), diff --git a/src/Zcu/PerThread.zig b/src/Zcu/PerThread.zig index a3728c5500573cd261a3b3c3387f618b7536a46f..2e6f7b49b8147d2092ebd858deecb56b04625c61 100644 --- a/src/Zcu/PerThread.zig +++ b/src/Zcu/PerThread.zig @@ -1083,13 +1083,13 @@ pub fn ensureMemoizedStateUpToDate( } else { if (prev_failed) return error.AnalysisFail; // We use an arbitrary element to check if the state has been resolved yet. - const to_check: Zcu.BuiltinDecl = switch (stage) { + const to_check: Zcu.StdLangDecl = switch (stage) { .main => .Type, .panic => .panic, .va_list => .VaList, .assembly => .assembly, }; - if (zcu.builtin_decl_values.get(to_check) != .none) return; + if (zcu.std_lang_decl_values.get(to_check) != .none) return; } if (zcu.comp.debugIncremental()) { @@ -3751,7 +3751,7 @@ pub fn populateTestFunctions(pt: Zcu.PerThread) Allocator.Error!void { // Our job is to correctly set the value of the `test_functions` declaration if it has been // analyzed and sent to codegen, It usually will have been, because the test runner will - // reference it, and `std.builtin` shouldn't have type errors. However, if it hasn't been + // reference it, and `std.lang` shouldn't have type errors. However, if it hasn't been // analyzed, we will just terminate early, since clearly the test runner hasn't referenced // `test_functions` so there's no point populating it. More to the the point, we potentially // *can't* populate it without doing some type resolution, and... let's try to leave Sema in diff --git a/src/codegen/aarch64/Select.zig b/src/codegen/aarch64/Select.zig index d0f7c45a0637ef6ccb889658041700a5d98495d8..968bb3134bc9f107789ce6807d146cafe79ab7e6 100644 --- a/src/codegen/aarch64/Select.zig +++ b/src/codegen/aarch64/Select.zig @@ -7981,7 +7981,7 @@ fn emit(isel: *Select, instruction: codegen.aarch64.encoding.Instruction) !void fn emitPanic(isel: *Select, panic_id: Zcu.SimplePanicId) !void { const zcu = isel.pt.zcu; try isel.nav_relocs.append(zcu.gpa, .{ - .nav = switch (zcu.intern_pool.indexToKey(zcu.builtin_decl_values.get(panic_id.toBuiltin()))) { + .nav = switch (zcu.intern_pool.indexToKey(zcu.std_lang_decl_values.get(panic_id.toStdLangDecl()))) { else => unreachable, inline .@"extern", .func => |func| func.owner_nav, }, diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index 847191ec1d67a51efc586ce87e209f6915e51f4b..eeac3e09d9b5c80aed5f9bbfbb736e8b8dde15db 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -1755,7 +1755,7 @@ pub const Object = struct { } // If the first export specifies a linksection, set the exported variable's section to that - // one. This is kind of a hack because `std.builtin.ExportOptions.section` doesn't actually + // one. This is kind of a hack because `std.lang.ExportOptions.section` doesn't actually // make much sense: the linksection should be associated with the declaration itself rather // than some particular symbol it is exported as! if (export_indices[0].ptr(zcu).opts.section.toSlice(ip)) |section_slice| { @@ -3378,7 +3378,7 @@ pub const Object = struct { } if (fn_info.cc == .auto and zcu.comp.config.any_error_tracing) { - // First parameter is a pointer to `std.builtin.StackTrace`. + // First parameter is a pointer to `std.lang.StackTrace`. const llvm_ptr_ty = try o.builder.ptrType(toLlvmAddressSpace(.generic, target)); try llvm_params.append(o.gpa, llvm_ptr_ty); } diff --git a/src/codegen/llvm/FuncGen.zig b/src/codegen/llvm/FuncGen.zig index e1942a624d0d4fecc5c4951dec339ad656deee96..e7683ab95ee080c6c80e47d29950877d79793829 100644 --- a/src/codegen/llvm/FuncGen.zig +++ b/src/codegen/llvm/FuncGen.zig @@ -891,7 +891,7 @@ fn buildSimplePanic(fg: *FuncGen, panic_id: Zcu.SimplePanicId) Allocator.Error!v const o = fg.object; const zcu = o.zcu; const target = zcu.getTarget(); - const panic_func = zcu.funcInfo(zcu.builtin_decl_values.get(panic_id.toBuiltin())); + const panic_func = zcu.funcInfo(zcu.std_lang_decl_values.get(panic_id.toStdLangDecl())); const fn_info = zcu.typeToFunc(.fromInterned(panic_func.ty)).?; const llvm_panic_fn_ty = try o.lowerType(.fromInterned(panic_func.ty)); diff --git a/src/codegen/spirv/CodeGen.zig b/src/codegen/spirv/CodeGen.zig index daf02bd8dcce573664a86585cc12f4bf4dc61298..0069db375bd115046f470b80ab849d7222519150 100644 --- a/src/codegen/spirv/CodeGen.zig +++ b/src/codegen/spirv/CodeGen.zig @@ -2358,7 +2358,7 @@ fn buildWideMul( /// The SPIR-V backend is not yet advanced enough to support the std testing infrastructure. /// In order to be able to run tests, we "temporarily" lower test kernels into separate entry- /// points. The test executor will then be able to invoke these to run the tests. -/// Note that tests are lowered according to std.builtin.TestFn, which is `fn () anyerror!void`. +/// Note that tests are lowered according to std.lang.TestFn, which is `fn () anyerror!void`. /// (anyerror!void has the same layout as anyerror). /// Each test declaration generates a function like. /// %anyerror = OpTypeInt 0 16 diff --git a/src/codegen/wasm/CodeGen.zig b/src/codegen/wasm/CodeGen.zig index 415f6d15f9cc9684882ceda84c9893f9339427db..7061d8548df43049b14b8244cf9c9f6ef6b9e226 100644 --- a/src/codegen/wasm/CodeGen.zig +++ b/src/codegen/wasm/CodeGen.zig @@ -586,7 +586,7 @@ fn addExtraAssumeCapacity(cg: *CodeGen, extra: anytype) error{OutOfMemory}!u32 { return result; } -/// For `std.builtin.CallingConvention.auto`. +/// For `std.lang.CallingConvention.auto`. pub fn typeToValtype(ty: Type, zcu: *const Zcu, target: *const std.Target) std.wasm.Valtype { return switch (ty.zigTypeTag(zcu)) { .float => switch (ty.floatBits(target)) { diff --git a/src/print_zir.zig b/src/print_zir.zig index 6647abe88a5333e08854a32f2af4dbfee36a0663..6f7af6c33c80eb0034640b3bf40e85c9990eecd7 100644 --- a/src/print_zir.zig +++ b/src/print_zir.zig @@ -693,7 +693,7 @@ const Writer = struct { .restore_err_ret_index => try self.writeRestoreErrRetIndex(stream, extended), .closure_get => try self.writeClosureGet(stream, extended), .field_parent_ptr => try self.writeFieldParentPtr(stream, extended), - .builtin_value => try self.writeBuiltinValue(stream, extended), + .std_lang_value => try self.writeStdLangValue(stream, extended), .inplace_arith_result_ty => try self.writeInplaceArithResultTy(stream, extended), .dbg_empty_stmt => try stream.writeAll("))"), @@ -2232,8 +2232,8 @@ const Writer = struct { try self.writeSrcNode(stream, src_node); } - fn writeBuiltinValue(self: *Writer, stream: *std.Io.Writer, extended: Zir.Inst.Extended.InstData) !void { - const val: Zir.Inst.BuiltinValue = @enumFromInt(extended.small); + fn writeStdLangValue(self: *Writer, stream: *std.Io.Writer, extended: Zir.Inst.Extended.InstData) !void { + const val: Zir.Inst.StdLangValue = @enumFromInt(extended.small); try stream.print("{s})) ", .{@tagName(val)}); const src_node: Ast.Node.Offset = @enumFromInt(@as(i32, @bitCast(extended.operand))); try self.writeSrcNode(stream, src_node); diff --git a/test/cases/compile_errors/invalid_member_of_builtin_enum.zig b/test/cases/compile_errors/invalid_member_of_builtin_enum.zig index c58029f2f585fce193ab6de35d3d11d54c1b3d1a..48f1012c1f6884d6a34c2255edd9e2924743c1b1 100644 --- a/test/cases/compile_errors/invalid_member_of_builtin_enum.zig +++ b/test/cases/compile_errors/invalid_member_of_builtin_enum.zig @@ -1,10 +1,10 @@ -const builtin = @import("std").builtin; +const lang = @import("std").lang; export fn entry() void { - const foo = builtin.OptimizeMode.x86; + const foo = lang.OptimizeMode.x86; _ = foo; } // error // -// :3:38: error: enum 'builtin.OptimizeMode' has no member named 'x86' +// :3:35: error: enum 'lang.OptimizeMode' has no member named 'x86' // : note: enum declared here diff --git a/test/cases/compile_errors/issue_15572_break_on_inline_while.zig b/test/cases/compile_errors/issue_15572_break_on_inline_while.zig index bd4b432a4272e41743770a7da74613411770e5a1..d1dc5072324ee66acae55c361fcd148f729c168c 100644 --- a/test/cases/compile_errors/issue_15572_break_on_inline_while.zig +++ b/test/cases/compile_errors/issue_15572_break_on_inline_while.zig @@ -16,4 +16,4 @@ pub fn main() void { // error // target=x86_64-linux // -// :9:28: error: incompatible types: 'builtin.Type.EnumField' and 'void' +// :9:28: error: incompatible types: 'lang.Type.EnumField' and 'void' diff --git a/test/cases/compile_errors/runtime_index_into_comptime_type_slice.zig b/test/cases/compile_errors/runtime_index_into_comptime_type_slice.zig index b4cf100c19978597ccf5f987f69fdebe1345a848..b212eebbdb7546617e0423e72d8f05f16dd2178d 100644 --- a/test/cases/compile_errors/runtime_index_into_comptime_type_slice.zig +++ b/test/cases/compile_errors/runtime_index_into_comptime_type_slice.zig @@ -12,6 +12,6 @@ export fn entry() void { // error // -// :9:54: error: values of type 'builtin.Type.StructField' must be comptime-known, but index value is runtime-known +// :9:54: error: values of type 'lang.Type.StructField' must be comptime-known, but index value is runtime-known // : note: struct requires comptime because of this field // : note: types are not available at runtime diff --git a/test/cases/compile_errors/wrong_type_for_reify_type.zig b/test/cases/compile_errors/wrong_type_for_reify_type.zig index cf93ff91b4dc0c1207b74bff9fdae87023155128..d5f3b56676d693225f125ac8683cfe6eb5052dd8 100644 --- a/test/cases/compile_errors/wrong_type_for_reify_type.zig +++ b/test/cases/compile_errors/wrong_type_for_reify_type.zig @@ -16,10 +16,10 @@ export fn entryU() void { // error // -// :2:14: error: expected type 'builtin.Signedness', found 'comptime_int' +// :2:14: error: expected type 'lang.Signedness', found 'comptime_int' // :?:?: note: enum declared here // :6:15: error: expected type 'type', found 'comptime_int' -// :10:17: error: expected type 'builtin.Type.ContainerLayout', found 'comptime_int' +// :10:17: error: expected type 'lang.Type.ContainerLayout', found 'comptime_int' // :?:?: enum declared here -// :14:16: error: expected type 'builtin.Type.ContainerLayout', found 'comptime_int' +// :14:16: error: expected type 'lang.Type.ContainerLayout', found 'comptime_int' // :?:?: enum declared here diff --git a/test/cases/compile_errors/wrong_types_given_to_atomic_order_args_in_cmpxchg.zig b/test/cases/compile_errors/wrong_types_given_to_atomic_order_args_in_cmpxchg.zig index fdb49d344a941d2f5e97138974696f7e7711dfa2..62a10262770bdb3350238ef0a703ce370bfd1476 100644 --- a/test/cases/compile_errors/wrong_types_given_to_atomic_order_args_in_cmpxchg.zig +++ b/test/cases/compile_errors/wrong_types_given_to_atomic_order_args_in_cmpxchg.zig @@ -5,5 +5,5 @@ export fn entry() void { // error // -// :3:47: error: expected type 'builtin.AtomicOrder', found 'u32' +// :3:47: error: expected type 'lang.AtomicOrder', found 'u32' // :?:?: note: enum declared here diff --git a/test/cases/compile_errors/wrong_types_given_to_export.zig b/test/cases/compile_errors/wrong_types_given_to_export.zig index ab26b399e977f7c3b5a8cf905f5398aa295f28eb..f859f5fda207cb70a19002d38fcb1e25f50e2e18 100644 --- a/test/cases/compile_errors/wrong_types_given_to_export.zig +++ b/test/cases/compile_errors/wrong_types_given_to_export.zig @@ -5,5 +5,5 @@ comptime { // error // -// :3:42: error: expected type 'builtin.GlobalLinkage', found 'u32' +// :3:42: error: expected type 'lang.GlobalLinkage', found 'u32' // :?:?: note: enum declared here -- 2.54.0 From 4c330e053ba45f383a7642da53482dfbce1b50cf Mon Sep 17 00:00:00 2001 From: Matthew Lugg Date: Sat, 2 May 2026 10:59:45 +0100 Subject: [PATCH 3/4] compiler: use 'std.lang' instead of 'std.builtin' --- build.zig | 19 +- lib/std/zig/Ast.zig | 4 +- lib/std/zig/AstGen.zig | 16 +- lib/std/zig/LibCInstallation.zig | 4 +- lib/std/zig/Zir.zig | 20 +- lib/std/zig/llvm/Builder.zig | 2 +- src/Air.zig | 28 +-- src/Air/print.zig | 2 +- src/Builtin.zig | 14 +- src/Compilation.zig | 24 +-- src/Compilation/Config.zig | 16 +- src/InternPool.zig | 102 +++++----- src/Package/Module.zig | 14 +- src/Sema.zig | 222 +++++++++++----------- src/Sema/arith.zig | 4 +- src/Type.zig | 16 +- src/Value.zig | 2 +- src/Zcu.zig | 8 +- src/Zcu/PerThread.zig | 2 +- src/codegen.zig | 6 +- src/codegen/aarch64/Assemble.zig | 2 +- src/codegen/aarch64/Select.zig | 32 ++-- src/codegen/aarch64/encoding.zig | 308 +++++++++++++++---------------- src/codegen/c.zig | 14 +- src/codegen/c/type.zig | 2 +- src/codegen/llvm.zig | 34 ++-- src/codegen/llvm/FuncGen.zig | 16 +- src/codegen/riscv64/CodeGen.zig | 8 +- src/codegen/riscv64/Lower.zig | 6 +- src/codegen/sparc64/CodeGen.zig | 6 +- src/codegen/sparc64/Emit.zig | 2 +- src/codegen/spirv/Assembler.zig | 4 +- src/codegen/spirv/CodeGen.zig | 8 +- src/codegen/spirv/Module.zig | 8 +- src/codegen/wasm/CodeGen.zig | 8 +- src/codegen/x86_64/CodeGen.zig | 30 +-- src/codegen/x86_64/Lower.zig | 2 +- src/codegen/x86_64/Mir.zig | 2 +- src/codegen/x86_64/abi.zig | 18 +- src/codegen/x86_64/bits.zig | 2 +- src/libs/freebsd.zig | 2 +- src/libs/glibc.zig | 2 +- src/libs/libcxx.zig | 2 +- src/libs/libtsan.zig | 4 +- src/libs/libunwind.zig | 2 +- src/libs/mingw.zig | 2 +- src/libs/musl.zig | 4 +- src/libs/netbsd.zig | 2 +- src/libs/openbsd.zig | 2 +- src/libs/wasi_libc.zig | 4 +- src/link.zig | 16 +- src/link/Coff.zig | 2 +- src/link/Dwarf.zig | 10 +- src/link/Elf2.zig | 2 +- src/link/Wasm.zig | 8 +- src/main.zig | 20 +- src/print_zir.zig | 2 +- src/target.zig | 30 +-- src/tracy.zig | 4 +- 59 files changed, 578 insertions(+), 579 deletions(-) diff --git a/build.zig b/build.zig index 30a82d84f3ee47d4fdd881222c2d8274b8bedaa2..099c1a954155d533118b0649b5060ccb6299bf98 100644 --- a/build.zig +++ b/build.zig @@ -1,5 +1,4 @@ const std = @import("std"); -const builtin = std.builtin; const BufMap = std.BufMap; const mem = std.mem; const fs = std.fs; @@ -398,22 +397,22 @@ pub fn build(b: *std.Build) !void { const test_target_filters = b.option([]const []const u8, "test-target-filter", "Skip tests whose target triple do not match any filter") orelse &[0][]const u8{}; const test_extra_targets = b.option(bool, "test-extra-targets", "Enable running module tests for additional targets") orelse false; - var chosen_opt_modes_buf: [4]builtin.OptimizeMode = undefined; + var chosen_opt_modes_buf: [4]std.lang.OptimizeMode = undefined; var chosen_mode_index: usize = 0; if (!skip_debug) { - chosen_opt_modes_buf[chosen_mode_index] = builtin.OptimizeMode.Debug; + chosen_opt_modes_buf[chosen_mode_index] = .Debug; chosen_mode_index += 1; } if (!skip_release_safe) { - chosen_opt_modes_buf[chosen_mode_index] = builtin.OptimizeMode.ReleaseSafe; + chosen_opt_modes_buf[chosen_mode_index] = .ReleaseSafe; chosen_mode_index += 1; } if (!skip_release_fast) { - chosen_opt_modes_buf[chosen_mode_index] = builtin.OptimizeMode.ReleaseFast; + chosen_opt_modes_buf[chosen_mode_index] = .ReleaseFast; chosen_mode_index += 1; } if (!skip_release_small) { - chosen_opt_modes_buf[chosen_mode_index] = builtin.OptimizeMode.ReleaseSmall; + chosen_opt_modes_buf[chosen_mode_index] = .ReleaseSmall; chosen_mode_index += 1; } const optimize_modes = chosen_opt_modes_buf[0..chosen_mode_index]; @@ -706,11 +705,11 @@ fn addWasiUpdateStep(b: *std.Build, version: [:0]const u8) !void { // // * We lose a small amount of performance. This is essentially irrelevant for zig1. // - // * We lose the ability to perform trivial renames on certain `std.builtin` types without + // * We lose the ability to perform trivial renames on certain `std.lang` types without // zig1.wasm updates. For instance, we cannot rename an enum from PascalCase fields to // snake_case fields without an update. // - // * We gain the ability to add and remove fields to and from `std.builtin` types without + // * We gain the ability to add and remove fields to and from `std.lang` types without // zig1.wasm updates. For instance, we can add a new tag to `CallingConvention` without // an update. // @@ -740,7 +739,7 @@ fn addWasiUpdateStep(b: *std.Build, version: [:0]const u8) !void { } const AddCompilerModOptions = struct { - optimize: std.builtin.OptimizeMode, + optimize: std.lang.OptimizeMode, target: std.Build.ResolvedTarget, strip: ?bool = null, valgrind: ?bool = null, @@ -1029,7 +1028,7 @@ fn addCMakeLibraryList(mod: *std.Build.Module, list: []const u8) void { } const CMakeConfig = struct { - llvm_linkage: std.builtin.LinkMode, + llvm_linkage: std.lang.LinkMode, cmake_binary_dir: []const u8, cmake_prefix_path: []const u8, cmake_static_library_prefix: []const u8, diff --git a/lib/std/zig/Ast.zig b/lib/std/zig/Ast.zig index 91b46073ce13d8f839d80218b7f1c261c184b2f5..7fe0962ecfda14a2c220d73ce93d233962469dc0 100644 --- a/lib/std/zig/Ast.zig +++ b/lib/std/zig/Ast.zig @@ -2103,7 +2103,7 @@ fn fullFnProtoComponents(tree: Ast, info: full.FnProto.Components) full.FnProto } fn fullPtrTypeComponents(tree: Ast, info: full.PtrType.Components) full.PtrType { - const size: std.builtin.Type.Pointer.Size = switch (tree.tokenTag(info.main_token)) { + const size: std.lang.Type.Pointer.Size = switch (tree.tokenTag(info.main_token)) { .asterisk => .one, .l_bracket => switch (tree.tokenTag(info.main_token + 1)) { .asterisk => if (tree.tokenTag(info.main_token + 2) == .identifier) .c else .many, @@ -2726,7 +2726,7 @@ pub const full = struct { }; pub const PtrType = struct { - size: std.builtin.Type.Pointer.Size, + size: std.lang.Type.Pointer.Size, allowzero_token: ?TokenIndex, const_token: ?TokenIndex, volatile_token: ?TokenIndex, diff --git a/lib/std/zig/AstGen.zig b/lib/std/zig/AstGen.zig index 58711d5471b7b3a1f75c3bcd7017150b74ac1dac..83139bab3d9a29fc90a03544772b0f52a2644c5d 100644 --- a/lib/std/zig/AstGen.zig +++ b/lib/std/zig/AstGen.zig @@ -4815,7 +4815,7 @@ fn structDeclInner( scope: *Scope, node: Ast.Node.Index, container_decl: Ast.full.ContainerDecl, - layout: std.builtin.Type.ContainerLayout, + layout: std.lang.Type.ContainerLayout, maybe_backing_int_node: Ast.Node.OptionalIndex, name_strat: Zir.Inst.NameStrategy, ) InnerError!Zir.Inst.Ref { @@ -5020,7 +5020,7 @@ fn tupleDecl( scope: *Scope, node: Ast.Node.Index, container_decl: Ast.full.ContainerDecl, - layout: std.builtin.Type.ContainerLayout, + layout: std.lang.Type.ContainerLayout, backing_int_node: Ast.Node.OptionalIndex, ) InnerError!Zir.Inst.Ref { const astgen = gz.astgen; @@ -5117,7 +5117,7 @@ fn unionDeclInner( scope: *Scope, node: Ast.Node.Index, members: []const Ast.Node.Index, - layout: std.builtin.Type.ContainerLayout, + layout: std.lang.Type.ContainerLayout, opt_arg_node: Ast.Node.OptionalIndex, auto_enum_tok: ?Ast.TokenIndex, name_strat: Zir.Inst.NameStrategy, @@ -5324,7 +5324,7 @@ fn containerDecl( switch (tree.tokenTag(container_decl.ast.main_token)) { .keyword_struct => { - const layout: std.builtin.Type.ContainerLayout = if (container_decl.layout_token) |t| switch (tree.tokenTag(t)) { + const layout: std.lang.Type.ContainerLayout = if (container_decl.layout_token) |t| switch (tree.tokenTag(t)) { .keyword_packed => .@"packed", .keyword_extern => .@"extern", else => unreachable, @@ -5334,7 +5334,7 @@ fn containerDecl( return rvalue(gz, ri, result, node); }, .keyword_union => { - const layout: std.builtin.Type.ContainerLayout = if (container_decl.layout_token) |t| switch (tree.tokenTag(t)) { + const layout: std.lang.Type.ContainerLayout = if (container_decl.layout_token) |t| switch (tree.tokenTag(t)) { .keyword_packed => .@"packed", .keyword_extern => .@"extern", else => unreachable, @@ -8060,7 +8060,7 @@ fn identifier( int_type: { if (ident_name_raw.len < 2) break :int_type; - const signedness: std.builtin.Signedness = switch (ident_name_raw[0]) { + const signedness: std.lang.Signedness = switch (ident_name_raw[0]) { 'u' => .unsigned, 'i' => .signed, else => break :int_type, @@ -9925,7 +9925,7 @@ fn callExpr( const astgen = gz.astgen; const callee = try calleeExpr(gz, scope, ri.rl, override_decl_literal_type, call.ast.fn_expr); - const modifier: std.builtin.CallModifier = blk: { + const modifier: std.lang.CallModifier = blk: { if (gz.nosuspend_node != .none) { break :blk .no_suspend; } @@ -12350,7 +12350,7 @@ const GenZir = struct { fn setStruct(gz: *GenZir, inst: Zir.Inst.Index, args: struct { src_node: Ast.Node.Index, name_strat: Zir.Inst.NameStrategy, - layout: std.builtin.Type.ContainerLayout, + layout: std.lang.Type.ContainerLayout, backing_int_type_body_len: ?u32, decls_len: u32, fields_len: u32, diff --git a/lib/std/zig/LibCInstallation.zig b/lib/std/zig/LibCInstallation.zig index 09aaf0dea204489ed8b8d2b2f7892b8277627c40..22432bdd165d139264fe46b5a5cbadcb5aa48391 100644 --- a/lib/std/zig/LibCInstallation.zig +++ b/lib/std/zig/LibCInstallation.zig @@ -703,8 +703,8 @@ pub const CrtBasenames = struct { pub const GetArgs = struct { target: *const std.Target, link_libc: bool, - output_mode: std.builtin.OutputMode, - link_mode: std.builtin.LinkMode, + output_mode: std.lang.OutputMode, + link_mode: std.lang.LinkMode, pie: bool, }; diff --git a/lib/std/zig/Zir.zig b/lib/std/zig/Zir.zig index f8af9688ae7857a4050b29ace18a89ba171e1f45..245b56c5fb1c0717a01f3c8b364b6883386919b7 100644 --- a/lib/std/zig/Zir.zig +++ b/lib/std/zig/Zir.zig @@ -2418,7 +2418,7 @@ pub const Inst = struct { has_bit_range: bool, _: u1 = 0, }, - size: std.builtin.Type.Pointer.Size, + size: std.lang.Type.Pointer.Size, /// Index into extra. See `PtrType`. payload_index: u32, }, @@ -2426,7 +2426,7 @@ pub const Inst = struct { /// Offset from Decl AST node index. /// `Tag` determines which kind of AST node this points to. src_node: Ast.Node.Offset, - signedness: std.builtin.Signedness, + signedness: std.lang.Signedness, bit_count: u16, }, @"unreachable": struct { @@ -3051,7 +3051,7 @@ pub const Inst = struct { callee: Ref, pub const Flags = packed struct { - /// std.builtin.CallModifier in packed form + /// std.lang.CallModifier in packed form pub const PackedModifier = u3; pub const PackedArgsLen = u27; @@ -3063,7 +3063,7 @@ pub const Inst = struct { comptime { if (@sizeOf(Flags) != 4 or @bitSizeOf(Flags) != 32) @compileError("Layout of Call.Flags needs to be updated!"); - if (@bitSizeOf(std.builtin.CallModifier) != @bitSizeOf(PackedModifier)) + if (@bitSizeOf(std.lang.CallModifier) != @bitSizeOf(PackedModifier)) @compileError("Call.Flags.PackedModifier needs to be updated!"); } }; @@ -3186,7 +3186,7 @@ pub const Inst = struct { pub const ReifySliceArgInfo = enum(u16) { /// Input element type is `type`. - /// Output element type is `std.builtin.Type.Fn.Param.Attributes`. + /// Output element type is `std.lang.Type.Fn.Param.Attributes`. type_to_fn_param_attrs, /// Input element type is `[]const u8`. /// Output element type is `type`. @@ -3194,10 +3194,10 @@ pub const Inst = struct { /// Identical to `string_to_struct_field_type` aside from emitting slightly different error messages. string_to_union_field_type, /// Input element type is `[]const u8`. - /// Output element type is `std.builtin.Type.StructField.Attributes`. + /// Output element type is `std.lang.Type.StructField.Attributes`. string_to_struct_field_attrs, /// Input element type is `[]const u8`. - /// Output element type is `std.builtin.Type.UnionField.Attributes`. + /// Output element type is `std.lang.Type.UnionField.Attributes`. string_to_union_field_attrs, }; @@ -3468,7 +3468,7 @@ pub const Inst = struct { has_decls_len: bool, has_fields_len: bool, name_strategy: NameStrategy, - layout: std.builtin.Type.ContainerLayout, + layout: std.lang.Type.ContainerLayout, /// Always `false` if `layout != .@"packed"`. has_backing_int_type: bool, any_field_aligns: bool, @@ -3688,7 +3688,7 @@ pub const Inst = struct { }; } - pub fn layout(k: Kind) std.builtin.Type.ContainerLayout { + pub fn layout(k: Kind) std.lang.Type.ContainerLayout { return switch (k) { .auto, .tagged_explicit, .tagged_enum, .tagged_enum_explicit => .auto, .@"extern" => .@"extern", @@ -5286,7 +5286,7 @@ pub const UnwrappedStructDecl = struct { decls: []const Inst.Index, - layout: std.builtin.Type.ContainerLayout, + layout: std.lang.Type.ContainerLayout, backing_int_type_body: ?[]const Inst.Index, field_names: []const NullTerminatedString, diff --git a/lib/std/zig/llvm/Builder.zig b/lib/std/zig/llvm/Builder.zig index f6b59d5c82e936f102f9c9fb654b455f22f97c59..b8651039ad2e2c9517cee5c96c7a17b0dfd7b387 100644 --- a/lib/std/zig/llvm/Builder.zig +++ b/lib/std/zig/llvm/Builder.zig @@ -1830,7 +1830,7 @@ pub const Visibility = enum(u2) { hidden = 1, protected = 2, - pub fn fromSymbolVisibility(sv: std.builtin.SymbolVisibility) Visibility { + pub fn fromSymbolVisibility(sv: std.lang.SymbolVisibility) Visibility { return switch (sv) { .default => .default, .hidden => .hidden, diff --git a/src/Air.zig b/src/Air.zig index 78086f567f5f5556d6541edf9ddd63d83dd2d193..5eb1314f6c22c53c2fbe79a70875df9e0e900693 100644 --- a/src/Air.zig +++ b/src/Air.zig @@ -1260,17 +1260,17 @@ pub const Inst = struct { }, atomic_load: struct { ptr: Ref, - order: std.builtin.AtomicOrder, + order: std.lang.AtomicOrder, }, prefetch: struct { ptr: Ref, - rw: std.builtin.PrefetchOptions.Rw, + rw: std.lang.PrefetchOptions.Rw, locality: u2, - cache: std.builtin.PrefetchOptions.Cache, + cache: std.lang.PrefetchOptions.Cache, }, reduce: struct { operand: Ref, - operation: std.builtin.ReduceOp, + operation: std.lang.ReduceOp, }, ty_nav: struct { ty: InternPool.Index, @@ -1332,8 +1332,8 @@ pub const CondBr = struct { else_body_len: u32, branch_hints: BranchHints, pub const BranchHints = packed struct(u32) { - true: std.builtin.BranchHint = .none, - false: std.builtin.BranchHint = .none, + true: std.lang.BranchHint = .none, + false: std.lang.BranchHint = .none, then_cov: CoveragePoint = .none, else_cov: CoveragePoint = .none, _: u24 = 0, @@ -1499,11 +1499,11 @@ pub const Cmpxchg = struct { /// 0b00000000000000000000000000XXX000 - failure_order flags: u32, - pub fn successOrder(self: Cmpxchg) std.builtin.AtomicOrder { + pub fn successOrder(self: Cmpxchg) std.lang.AtomicOrder { return @enumFromInt(@as(u3, @truncate(self.flags))); } - pub fn failureOrder(self: Cmpxchg) std.builtin.AtomicOrder { + pub fn failureOrder(self: Cmpxchg) std.lang.AtomicOrder { return @enumFromInt(@as(u3, @intCast(self.flags >> 3))); } }; @@ -1514,11 +1514,11 @@ pub const AtomicRmw = struct { /// 0b0000000000000000000000000XXXX000 - op flags: u32, - pub fn ordering(self: AtomicRmw) std.builtin.AtomicOrder { + pub fn ordering(self: AtomicRmw) std.lang.AtomicOrder { return @enumFromInt(@as(u3, @truncate(self.flags))); } - pub fn op(self: AtomicRmw) std.builtin.AtomicRmwOp { + pub fn op(self: AtomicRmw) std.lang.AtomicRmwOp { return @enumFromInt(@as(u4, @intCast(self.flags >> 3))); } }; @@ -2077,14 +2077,14 @@ pub const UnwrappedSwitch = struct { cases_start: u32, /// Asserts that `case_idx < us.cases_len`. - pub fn getHint(us: UnwrappedSwitch, case_idx: u32) std.builtin.BranchHint { + pub fn getHint(us: UnwrappedSwitch, case_idx: u32) std.lang.BranchHint { assert(case_idx < us.cases_len); return us.getHintInner(case_idx); } - pub fn getElseHint(us: UnwrappedSwitch) std.builtin.BranchHint { + pub fn getElseHint(us: UnwrappedSwitch) std.lang.BranchHint { return us.getHintInner(us.cases_len); } - fn getHintInner(us: UnwrappedSwitch, idx: u32) std.builtin.BranchHint { + fn getHintInner(us: UnwrappedSwitch, idx: u32) std.lang.BranchHint { const bag = us.air.extra.items[us.branch_hints_start..][idx / 10]; const bits: u3 = @truncate(bag >> @intCast(3 * (idx % 10))); return @enumFromInt(bits); @@ -2630,7 +2630,7 @@ pub const CompilerRtFunc = enum(u32) { }; } - pub fn @"callconv"(f: CompilerRtFunc, target: *const std.Target) std.builtin.CallingConvention { + pub fn @"callconv"(f: CompilerRtFunc, target: *const std.Target) std.lang.CallingConvention { const use_gnu_f16_abi = switch (target.cpu.arch) { .wasm32, .wasm64, diff --git a/src/Air/print.zig b/src/Air/print.zig index be328d86716cf56502dc209f35e36387c7de4c1a..70e5a9308424e781a54a1fc8c8a23ac075940d17 100644 --- a/src/Air/print.zig +++ b/src/Air/print.zig @@ -625,7 +625,7 @@ const Writer = struct { w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index, - order: std.builtin.AtomicOrder, + order: std.lang.AtomicOrder, ) Error!void { const bin_op = w.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; try w.writeOperand(s, inst, 0, bin_op.lhs); diff --git a/src/Builtin.zig b/src/Builtin.zig index f8cf9a38508c60587590f7d4375293771fa6e7af..7a15f6a701ebca52735e0deb211056e5c9c843fc 100644 --- a/src/Builtin.zig +++ b/src/Builtin.zig @@ -1,13 +1,13 @@ target: std.Target, -zig_backend: std.builtin.CompilerBackend, -output_mode: std.builtin.OutputMode, -link_mode: std.builtin.LinkMode, -unwind_tables: std.builtin.UnwindTables, +zig_backend: std.lang.CompilerBackend, +output_mode: std.lang.OutputMode, +link_mode: std.lang.LinkMode, +unwind_tables: std.lang.UnwindTables, is_test: bool, single_threaded: bool, link_libc: bool, link_libcpp: bool, -optimize_mode: std.builtin.OptimizeMode, +optimize_mode: std.lang.OptimizeMode, error_tracing: bool, valgrind: bool, sanitize_thread: bool, @@ -15,9 +15,9 @@ fuzz: bool, pic: bool, pie: bool, strip: bool, -code_model: std.builtin.CodeModel, +code_model: std.lang.CodeModel, omit_frame_pointer: bool, -wasi_exec_model: std.builtin.WasiExecModel, +wasi_exec_model: std.lang.WasiExecModel, /// Compute an abstract hash representing this `Builtin`. This is *not* a hash /// of the resulting file contents. diff --git a/src/Compilation.zig b/src/Compilation.zig index 67d845c4221fb8eced8e4224e60325adec1b3371..4901eebe95151e896b15416edefe3297e4377ca2 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -177,7 +177,7 @@ verbose_link: bool, link_depfile: ?[]const u8, disable_c_depfile: bool, stack_report: bool, -debug_compiler_runtime_libs: ?std.builtin.OptimizeMode, +debug_compiler_runtime_libs: ?std.lang.OptimizeMode, debug_compile_errors: bool, /// Do not check this field directly. Instead, use the `debugIncremental` wrapper function. debug_incremental: bool, @@ -1676,7 +1676,7 @@ pub const CreateOptions = struct { verbose_llvm_bc: ?[]const u8 = null, link_depfile: ?[]const u8 = null, verbose_llvm_cpu_features: bool = false, - debug_compiler_runtime_libs: ?std.builtin.OptimizeMode = null, + debug_compiler_runtime_libs: ?std.lang.OptimizeMode = null, debug_compile_errors: bool = false, debug_incremental: bool = false, /// Normally when you create a `Compilation`, Zig will automatically build @@ -4928,8 +4928,8 @@ fn workerDocsWasmFallible(comp: *Compilation, prog_node: std.Progress.Node) SubU defer arena_allocator.deinit(); const arena = arena_allocator.allocator(); - const optimize_mode = std.builtin.OptimizeMode.ReleaseSmall; - const output_mode = std.builtin.OutputMode.Exe; + const optimize_mode = std.lang.OptimizeMode.ReleaseSmall; + const output_mode = std.lang.OutputMode.Exe; const resolved_target: Package.Module.ResolvedTarget = .{ .result = std.zig.system.resolveTargetQuery(io, .{ .cpu_arch = .wasm32, @@ -5285,8 +5285,8 @@ fn buildRt( comp: *Compilation, root_source_name: []const u8, root_name: []const u8, - output_mode: std.builtin.OutputMode, - link_mode: std.builtin.LinkMode, + output_mode: std.lang.OutputMode, + link_mode: std.lang.LinkMode, misc_task: MiscTask, prog_node: std.Progress.Node, options: RtOptions, @@ -7260,7 +7260,7 @@ fn dumpArgvWriter(w: *Io.Writer, argv: []const []const u8) Io.Writer.Error!void try w.writeByte('\n'); } -pub fn getZigBackend(comp: Compilation) std.builtin.CompilerBackend { +pub fn getZigBackend(comp: Compilation) std.lang.CompilerBackend { const target = &comp.root_mod.resolved_target.result; return target_util.zigBackend(target, comp.config.use_llvm); } @@ -7302,8 +7302,8 @@ fn buildOutputFromZig( comp: *Compilation, src_basename: []const u8, root_name: []const u8, - output_mode: std.builtin.OutputMode, - link_mode: std.builtin.LinkMode, + output_mode: std.lang.OutputMode, + link_mode: std.lang.LinkMode, misc_task_tag: MiscTask, prog_node: std.Progress.Node, options: RtOptions, @@ -7433,7 +7433,7 @@ pub const CrtFileOptions = struct { function_sections: bool = true, data_sections: bool = true, omit_frame_pointer: ?bool = null, - unwind_tables: ?std.builtin.UnwindTables = null, + unwind_tables: ?std.lang.UnwindTables = null, pic: ?bool = null, no_builtin: ?bool = null, @@ -7443,7 +7443,7 @@ pub const CrtFileOptions = struct { pub fn build_crt_file( comp: *Compilation, root_name: []const u8, - output_mode: std.builtin.OutputMode, + output_mode: std.lang.OutputMode, misc_task_tag: MiscTask, prog_node: std.Progress.Node, /// These elements have to get mutated to add the owner module after it is @@ -7657,7 +7657,7 @@ pub fn addLinkLib(comp: *Compilation, lib_name: []const u8) !void { /// This decides the optimization mode for all zig-provided libraries, including /// compiler-rt, libcxx, libc, libunwind, etc. -pub fn compilerRtOptMode(comp: Compilation) std.builtin.OptimizeMode { +pub fn compilerRtOptMode(comp: Compilation) std.lang.OptimizeMode { if (comp.debug_compiler_runtime_libs) |mode| { return mode; } diff --git a/src/Compilation/Config.zig b/src/Compilation/Config.zig index b7f6df90969ae192b70b75668c41fb60c5d73724..62107d21679af3cc56ed3477e4b558a0bd566d30 100644 --- a/src/Compilation/Config.zig +++ b/src/Compilation/Config.zig @@ -4,8 +4,8 @@ //! order to resolve per-Module defaults. have_zcu: bool, -output_mode: std.builtin.OutputMode, -link_mode: std.builtin.LinkMode, +output_mode: std.lang.OutputMode, +link_mode: std.lang.LinkMode, link_libc: bool, link_libcpp: bool, link_libunwind: bool, @@ -53,13 +53,13 @@ lto: std.zig.LtoMode, incremental: bool, /// WASI-only. Type of WASI execution model ("command" or "reactor"). /// Always set to `command` for non-WASI targets. -wasi_exec_model: std.builtin.WasiExecModel, +wasi_exec_model: std.lang.WasiExecModel, import_memory: bool, export_memory: bool, shared_memory: bool, is_test: bool, debug_format: DebugFormat, -root_optimize_mode: std.builtin.OptimizeMode, +root_optimize_mode: std.lang.OptimizeMode, root_strip: bool, root_error_tracing: bool, dll_export_fns: bool, @@ -75,15 +75,15 @@ pub const DebugFormat = union(enum) { }; pub const Options = struct { - output_mode: std.builtin.OutputMode, + output_mode: std.lang.OutputMode, resolved_target: Module.ResolvedTarget, is_test: bool, have_zcu: bool, emit_bin: bool, - root_optimize_mode: ?std.builtin.OptimizeMode = null, + root_optimize_mode: ?std.lang.OptimizeMode = null, root_strip: ?bool = null, root_error_tracing: ?bool = null, - link_mode: ?std.builtin.LinkMode = null, + link_mode: ?std.lang.LinkMode = null, ensure_libc_on_non_freestanding: bool = false, ensure_libcpp_on_non_freestanding: bool = false, any_non_single_threaded: bool = false, @@ -109,7 +109,7 @@ pub const Options = struct { lto: ?std.zig.LtoMode = null, incremental: bool = false, /// WASI-only. Type of WASI execution model ("command" or "reactor"). - wasi_exec_model: ?std.builtin.WasiExecModel = null, + wasi_exec_model: ?std.lang.WasiExecModel = null, import_memory: ?bool = null, export_memory: ?bool = null, shared_memory: ?bool = null, diff --git a/src/InternPool.zig b/src/InternPool.zig index 29be84b0036d595fc34ba4f1a1b150eb29d106d0..b90922283884bf7fdd57cef6f0869afc348d22f0 100644 --- a/src/InternPool.zig +++ b/src/InternPool.zig @@ -566,7 +566,7 @@ pub const Nav = struct { type: InternPool.Index, @"align": Alignment, @"linksection": OptionalNullTerminatedString, - @"addrspace": std.builtin.AddressSpace, + @"addrspace": std.lang.AddressSpace, @"const": bool, @"threadlocal": bool, /// This field is whether this `Nav` is a literal `extern` definition. @@ -678,7 +678,7 @@ pub const Nav = struct { const Bits = packed struct(u16) { @"align": Alignment, - @"addrspace": std.builtin.AddressSpace, + @"addrspace": std.lang.AddressSpace, @"const": bool, @"threadlocal": bool, is_extern_decl: bool, @@ -1084,7 +1084,7 @@ const Local = struct { } } fn PtrElem(comptime opts: struct { - size: std.builtin.Type.Pointer.Size, + size: std.lang.Type.Pointer.Size, is_const: bool = false, }) type { const elem_info = @typeInfo(Elem).@"struct"; @@ -2029,7 +2029,7 @@ pub const Key = union(enum) { val: Index, }; - pub const IntType = std.builtin.Type.Int; + pub const IntType = std.lang.Type.Int; /// Extern for hashing via memory reinterpretation. pub const ErrorUnionType = extern struct { @@ -2090,8 +2090,8 @@ pub const Key = union(enum) { bit_offset: u16, }; - pub const Size = std.builtin.Type.Pointer.Size; - pub const AddressSpace = std.builtin.AddressSpace; + pub const Size = std.lang.Type.Pointer.Size; + pub const AddressSpace = std.lang.AddressSpace; }; /// Extern so that hashing can be done via memory reinterpreting. @@ -2160,7 +2160,7 @@ pub const Key = union(enum) { /// Tells whether a parameter is noalias. See `paramIsNoalias` helper /// method for accessing this. noalias_bits: u32, - cc: std.builtin.CallingConvention, + cc: std.lang.CallingConvention, is_var_args: bool, is_noinline: bool, @@ -2207,15 +2207,15 @@ pub const Key = union(enum) { /// For example `extern "c" fn write(...) usize` would have 'c' as library name. /// Index into the string table bytes. lib_name: OptionalNullTerminatedString, - linkage: std.builtin.GlobalLinkage, - visibility: std.builtin.SymbolVisibility, + linkage: std.lang.GlobalLinkage, + visibility: std.lang.SymbolVisibility, is_threadlocal: bool, is_dll_import: bool, - relocation: std.builtin.ExternOptions.Relocation, - decoration: ?std.builtin.ExternOptions.Decoration, + relocation: std.lang.ExternOptions.Relocation, + decoration: ?std.lang.ExternOptions.Decoration, is_const: bool, alignment: Alignment, - @"addrspace": std.builtin.AddressSpace, + @"addrspace": std.lang.AddressSpace, /// The ZIR instruction which created this extern; used only for source locations. /// This is a `declaration`. zir_index: TrackedInst.Index, @@ -2289,7 +2289,7 @@ pub const Key = union(enum) { return @atomicLoad(FuncAnalysis, func.analysisPtr(ip), .unordered); } - pub fn setBranchHint(func: Func, ip: *InternPool, io: Io, hint: std.builtin.BranchHint) void { + pub fn setBranchHint(func: Func, ip: *InternPool, io: Io, hint: std.lang.BranchHint) void { const extra_mutex = &ip.getLocal(func.tid).mutate.extra.mutex; extra_mutex.lockUncancelable(io); defer extra_mutex.unlock(io); @@ -3186,7 +3186,7 @@ pub const LoadedStructType = struct { name_nav: Nav.Index.Optional, namespace: NamespaceIndex, - layout: std.builtin.Type.ContainerLayout, + layout: std.lang.Type.ContainerLayout, /// May be `undefined` if `layout != .@"packed"`. packed_backing_mode: BackingTypeMode, @@ -3369,7 +3369,7 @@ pub const LoadedUnionType = struct { name_nav: Nav.Index.Optional, namespace: NamespaceIndex, - layout: std.builtin.Type.ContainerLayout, + layout: std.lang.Type.ContainerLayout, enum_tag_mode: BackingTypeMode, /// May be `undefined` if `layout != .@"packed"`. packed_backing_mode: BackingTypeMode, @@ -5368,10 +5368,10 @@ pub const Tag = enum(u8) { descriptor_binding: u32, pub const Flags = packed struct(u32) { - linkage: std.builtin.GlobalLinkage, - visibility: std.builtin.SymbolVisibility, + linkage: std.lang.GlobalLinkage, + visibility: std.lang.SymbolVisibility, is_dll_import: bool, - relocation: std.builtin.ExternOptions.Relocation, + relocation: std.lang.ExternOptions.Relocation, source: Source, decoration_type: DecorationType, _: u23 = 0, @@ -5380,13 +5380,13 @@ pub const Tag = enum(u8) { pub const DecorationType = enum(u2) { none, location, descriptor }; }; - pub fn decoration(self: Extern) ?std.builtin.ExternOptions.Decoration { + pub fn decoration(self: Extern) ?std.lang.ExternOptions.Decoration { return switch (self.flags.decoration_type) { .none => null, - .location => std.builtin.ExternOptions.Decoration{ + .location => std.lang.ExternOptions.Decoration{ .location = self.location_or_descriptor_set, }, - .descriptor => std.builtin.ExternOptions.Decoration{ .descriptor = .{ .set = self.location_or_descriptor_set, .binding = self.descriptor_binding } }, + .descriptor => std.lang.ExternOptions.Decoration{ .descriptor = .{ .set = self.location_or_descriptor_set, .binding = self.descriptor_binding } }, }; } }; @@ -5711,7 +5711,7 @@ pub const BackingTypeMode = enum(u1) { /// to be part of the type of the function. pub const FuncAnalysis = packed struct(u32) { want_runtime_analysis: bool, - branch_hint: std.builtin.BranchHint, + branch_hint: std.lang.BranchHint, is_noinline: bool, has_error_trace: bool, /// True if this function has an inferred error set. @@ -7980,7 +7980,7 @@ pub fn getDeclaredStructType( // InternPool, so that it is possible for their backing storage to be "reallocated" as needed // during type resolution. fields_len: u32, - layout: std.builtin.Type.ContainerLayout, + layout: std.lang.Type.ContainerLayout, any_comptime_fields: bool, any_field_defaults: bool, any_field_aligns: bool, @@ -8124,7 +8124,7 @@ pub fn getReifiedStructType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.Pe zir_index: TrackedInst.Index, type_hash: u64, fields_len: u32, - layout: std.builtin.Type.ContainerLayout, + layout: std.lang.Type.ContainerLayout, any_comptime_fields: bool, any_field_defaults: bool, any_field_aligns: bool, @@ -8300,7 +8300,7 @@ pub fn getDeclaredUnionType( // InternPool, so that it is possible for their backing storage to be "reallocated" as needed // during type resolution. fields_len: u32, - layout: std.builtin.Type.ContainerLayout, + layout: std.lang.Type.ContainerLayout, any_field_aligns: bool, tag_usage: LoadedUnionType.TagUsage, enum_tag_mode: BackingTypeMode, @@ -8421,7 +8421,7 @@ pub fn getReifiedUnionType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.Per zir_index: TrackedInst.Index, type_hash: u64, fields_len: u32, - layout: std.builtin.Type.ContainerLayout, + layout: std.lang.Type.ContainerLayout, any_field_aligns: bool, tag_usage: LoadedUnionType.TagUsage, /// Explicitly specified enum tag type. `.none` if `tag_usage != .tagged`. @@ -8969,7 +8969,7 @@ pub const GetFuncTypeKey = struct { comptime_bits: u32 = 0, noalias_bits: u32 = 0, /// `null` means generic. - cc: ?std.builtin.CallingConvention = .auto, + cc: ?std.lang.CallingConvention = .auto, is_var_args: bool = false, is_noinline: bool = false, }; @@ -9117,7 +9117,7 @@ pub const GetFuncDeclKey = struct { rbrace_line: u32, lbrace_column: u32, rbrace_column: u32, - cc: ?std.builtin.CallingConvention, + cc: ?std.lang.CallingConvention, is_noinline: bool, }; @@ -9193,7 +9193,7 @@ pub const GetFuncDeclIesKey = struct { comptime_bits: u32, bare_return_type: Index, /// null means generic. - cc: ?std.builtin.CallingConvention, + cc: ?std.lang.CallingConvention, is_var_args: bool, is_noinline: bool, zir_body_inst: TrackedInst.Index, @@ -11763,7 +11763,7 @@ pub fn getBackingAddrTag(ip: *const InternPool, val: Index) ?Key.Ptr.BaseAddr.Ta /// This is a particularly hot function, so we operate directly on encodings /// rather than the more straightforward implementation of calling `indexToKey`. /// Asserts `index` is not `.generic_poison_type`. -pub fn zigTypeTag(ip: *const InternPool, index: Index) std.builtin.TypeId { +pub fn zigTypeTag(ip: *const InternPool, index: Index) std.lang.TypeId { return switch (index) { .u0_type, .u1_type, @@ -12407,13 +12407,13 @@ pub fn getErrorValueIfExists(ip: *const InternPool, name: NullTerminatedString) } const PackedCallingConvention = packed struct(u18) { - tag: std.builtin.CallingConvention.Tag, + tag: std.lang.CallingConvention.Tag, /// May be ignored depending on `tag`. incoming_stack_alignment: Alignment, /// Interpretation depends on `tag`. extra: u4, - fn pack(cc: std.builtin.CallingConvention) PackedCallingConvention { + fn pack(cc: std.lang.CallingConvention) PackedCallingConvention { return switch (cc) { inline else => |pl, tag| switch (@TypeOf(pl)) { void => .{ @@ -12421,42 +12421,42 @@ const PackedCallingConvention = packed struct(u18) { .incoming_stack_alignment = .none, // unused .extra = 0, // unused }, - std.builtin.CallingConvention.CommonOptions => .{ + std.lang.CallingConvention.CommonOptions => .{ .tag = tag, .incoming_stack_alignment = .fromByteUnits(pl.incoming_stack_alignment orelse 0), .extra = 0, // unused }, - std.builtin.CallingConvention.X86RegparmOptions => .{ + std.lang.CallingConvention.X86RegparmOptions => .{ .tag = tag, .incoming_stack_alignment = .fromByteUnits(pl.incoming_stack_alignment orelse 0), .extra = pl.register_params, }, - std.builtin.CallingConvention.ArcInterruptOptions => .{ + std.lang.CallingConvention.ArcInterruptOptions => .{ .tag = tag, .incoming_stack_alignment = .fromByteUnits(pl.incoming_stack_alignment orelse 0), .extra = @intFromEnum(pl.type), }, - std.builtin.CallingConvention.ArmInterruptOptions => .{ + std.lang.CallingConvention.ArmInterruptOptions => .{ .tag = tag, .incoming_stack_alignment = .fromByteUnits(pl.incoming_stack_alignment orelse 0), .extra = @intFromEnum(pl.type), }, - std.builtin.CallingConvention.MicroblazeInterruptOptions => .{ + std.lang.CallingConvention.MicroblazeInterruptOptions => .{ .tag = tag, .incoming_stack_alignment = .fromByteUnits(pl.incoming_stack_alignment orelse 0), .extra = @intFromEnum(pl.type), }, - std.builtin.CallingConvention.MipsInterruptOptions => .{ + std.lang.CallingConvention.MipsInterruptOptions => .{ .tag = tag, .incoming_stack_alignment = .fromByteUnits(pl.incoming_stack_alignment orelse 0), .extra = @intFromEnum(pl.mode), }, - std.builtin.CallingConvention.RiscvInterruptOptions => .{ + std.lang.CallingConvention.RiscvInterruptOptions => .{ .tag = tag, .incoming_stack_alignment = .fromByteUnits(pl.incoming_stack_alignment orelse 0), .extra = @intFromEnum(pl.mode), }, - std.builtin.CallingConvention.ShInterruptOptions => .{ + std.lang.CallingConvention.ShInterruptOptions => .{ .tag = tag, .incoming_stack_alignment = .fromByteUnits(pl.incoming_stack_alignment orelse 0), .extra = @intFromEnum(pl.save), @@ -12466,41 +12466,41 @@ const PackedCallingConvention = packed struct(u18) { }; } - fn unpack(cc: PackedCallingConvention) std.builtin.CallingConvention { + fn unpack(cc: PackedCallingConvention) std.lang.CallingConvention { return switch (cc.tag) { inline else => |tag| @unionInit( - std.builtin.CallingConvention, + std.lang.CallingConvention, @tagName(tag), - switch (@FieldType(std.builtin.CallingConvention, @tagName(tag))) { + switch (@FieldType(std.lang.CallingConvention, @tagName(tag))) { void => {}, - std.builtin.CallingConvention.CommonOptions => .{ + std.lang.CallingConvention.CommonOptions => .{ .incoming_stack_alignment = cc.incoming_stack_alignment.toByteUnits(), }, - std.builtin.CallingConvention.X86RegparmOptions => .{ + std.lang.CallingConvention.X86RegparmOptions => .{ .incoming_stack_alignment = cc.incoming_stack_alignment.toByteUnits(), .register_params = @intCast(cc.extra), }, - std.builtin.CallingConvention.ArcInterruptOptions => .{ + std.lang.CallingConvention.ArcInterruptOptions => .{ .incoming_stack_alignment = cc.incoming_stack_alignment.toByteUnits(), .type = @enumFromInt(cc.extra), }, - std.builtin.CallingConvention.ArmInterruptOptions => .{ + std.lang.CallingConvention.ArmInterruptOptions => .{ .incoming_stack_alignment = cc.incoming_stack_alignment.toByteUnits(), .type = @enumFromInt(cc.extra), }, - std.builtin.CallingConvention.MicroblazeInterruptOptions => .{ + std.lang.CallingConvention.MicroblazeInterruptOptions => .{ .incoming_stack_alignment = cc.incoming_stack_alignment.toByteUnits(), .type = @enumFromInt(cc.extra), }, - std.builtin.CallingConvention.MipsInterruptOptions => .{ + std.lang.CallingConvention.MipsInterruptOptions => .{ .incoming_stack_alignment = cc.incoming_stack_alignment.toByteUnits(), .mode = @enumFromInt(cc.extra), }, - std.builtin.CallingConvention.RiscvInterruptOptions => .{ + std.lang.CallingConvention.RiscvInterruptOptions => .{ .incoming_stack_alignment = cc.incoming_stack_alignment.toByteUnits(), .mode = @enumFromInt(cc.extra), }, - std.builtin.CallingConvention.ShInterruptOptions => .{ + std.lang.CallingConvention.ShInterruptOptions => .{ .incoming_stack_alignment = cc.incoming_stack_alignment.toByteUnits(), .save = @enumFromInt(cc.extra), }, diff --git a/src/Package/Module.zig b/src/Package/Module.zig index aee98bbe3d102ad36ea0c337fe6af4f751a624ae..9241293d1dd480b1d9046c26e2d419a6874d2556 100644 --- a/src/Package/Module.zig +++ b/src/Package/Module.zig @@ -15,8 +15,8 @@ fully_qualified_name: []const u8, deps: Deps = .{}, resolved_target: ResolvedTarget, -optimize_mode: std.builtin.OptimizeMode, -code_model: std.builtin.CodeModel, +optimize_mode: std.lang.OptimizeMode, +code_model: std.lang.CodeModel, single_threaded: bool, error_tracing: bool, valgrind: bool, @@ -29,7 +29,7 @@ red_zone: bool, sanitize_c: std.zig.SanitizeC, sanitize_thread: bool, fuzz: bool, -unwind_tables: std.builtin.UnwindTables, +unwind_tables: std.lang.UnwindTables, cc_argv: []const []const u8, /// (SPIR-V) whether to generate a structured control flow graph or not structured_cfg: bool, @@ -61,8 +61,8 @@ pub const CreateOptions = struct { pub const Inherited = struct { /// If this is null then `parent` must be non-null. resolved_target: ?ResolvedTarget = null, - optimize_mode: ?std.builtin.OptimizeMode = null, - code_model: ?std.builtin.CodeModel = null, + optimize_mode: ?std.lang.OptimizeMode = null, + code_model: ?std.lang.CodeModel = null, single_threaded: ?bool = null, error_tracing: ?bool = null, valgrind: ?bool = null, @@ -75,7 +75,7 @@ pub const CreateOptions = struct { /// other number means stack protection with that buffer size. stack_protector: ?u32 = null, red_zone: ?bool = null, - unwind_tables: ?std.builtin.UnwindTables = null, + unwind_tables: ?std.lang.UnwindTables = null, sanitize_c: ?std.zig.SanitizeC = null, sanitize_thread: ?bool = null, fuzz: ?bool = null, @@ -238,7 +238,7 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Package.Module { break :b false; }; - const code_model: std.builtin.CodeModel = b: { + const code_model: std.lang.CodeModel = b: { if (options.inherited.code_model) |x| break :b x; if (options.parent) |p| break :b p.code_model; break :b .default; diff --git a/src/Sema.zig b/src/Sema.zig index 217216162009f0bbdeca2f56a7d4299be30d88f3..645e639f141e15c245de6648935a35598b8bbbba 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -135,7 +135,7 @@ allow_memoize: bool = true, /// The `BranchHint` for the current branch of runtime control flow. /// This state is on `Sema` so that `cold` hints can be propagated up through blocks with less special handling. -branch_hint: ?std.builtin.BranchHint = null, +branch_hint: ?std.lang.BranchHint = null, const RuntimeIndex = enum(u32) { zero = 0, @@ -383,7 +383,7 @@ pub const Block = struct { want_safety: ?bool = null, /// What mode to generate float operations in, set by @setFloatMode - float_mode: std.builtin.FloatMode = .strict, + float_mode: std.lang.FloatMode = .strict, /// If not `null`, this boolean is set when a `dbg_var_ptr`, `dbg_var_val`, or `dbg_arg_inline`. /// instruction is emitted. It signals that the innermost lexically @@ -759,7 +759,7 @@ pub const Block = struct { }); } - fn addReduce(block: *Block, operand: Air.Inst.Ref, operation: std.builtin.ReduceOp) !Air.Inst.Ref { + fn addReduce(block: *Block, operand: Air.Inst.Ref, operation: std.lang.ReduceOp) !Air.Inst.Ref { const sema = block.sema; const zcu = sema.pt.zcu; const allow_optimized = switch (sema.typeOf(operand).childType(zcu).zigTypeTag(zcu)) { @@ -1023,7 +1023,7 @@ pub fn deinit(sema: *Sema) void { /// control flow happens here, Sema will convert it to runtime control flow by introducing post-hoc /// blocks where necessary. /// Returns the branch hint for this branch. -fn analyzeBodyRuntimeBreak(sema: *Sema, block: *Block, body: []const Zir.Inst.Index) !std.builtin.BranchHint { +fn analyzeBodyRuntimeBreak(sema: *Sema, block: *Block, body: []const Zir.Inst.Index) !std.lang.BranchHint { const parent_hint = sema.branch_hint; defer sema.branch_hint = parent_hint; sema.branch_hint = null; @@ -2804,8 +2804,8 @@ fn analyzeValueAsCallconv( block: *Block, src: LazySrcLoc, val: Value, -) !std.builtin.CallingConvention { - return interpretStdLangType(sema, block, src, val, std.builtin.CallingConvention); +) !std.lang.CallingConvention { + return interpretStdLangType(sema, block, src, val, std.lang.CallingConvention); } fn interpretStdLangType( @@ -6147,7 +6147,7 @@ fn zirCall( const extra = sema.code.extraData(ExtraType, inst_data.payload_index); const args_len = extra.data.flags.args_len; - const modifier: std.builtin.CallModifier = @enumFromInt(extra.data.flags.packed_modifier); + const modifier: std.lang.CallModifier = @enumFromInt(extra.data.flags.packed_modifier); const ensure_result_used = extra.data.flags.ensure_result_used; const pop_error_return_trace = extra.data.flags.pop_error_return_trace; @@ -6322,7 +6322,7 @@ fn callBuiltin( block: *Block, call_src: LazySrcLoc, builtin_fn: Air.Inst.Ref, - modifier: std.builtin.CallModifier, + modifier: std.lang.CallModifier, args: []const Air.Inst.Ref, operation: CallOperation, ) !void { @@ -6543,7 +6543,7 @@ fn analyzeCall( func_ty: Type, func_src: LazySrcLoc, call_src: LazySrcLoc, - modifier: std.builtin.CallModifier, + modifier: std.lang.CallModifier, ensure_result_used: bool, args_info: CallArgsInfo, call_dbg_node: ?Zir.Inst.Index, @@ -8367,7 +8367,7 @@ fn zirFunc( // If this instruction has a body, then it's a function declaration, and we decide // the callconv based on whether it is exported. Otherwise, the callconv defaults // to `.auto`. - const cc: std.builtin.CallingConvention = if (has_body) cc: { + const cc: std.lang.CallingConvention = if (has_body) cc: { const func_decl_nav = sema.owner.unwrap().nav_val; const fn_is_exported = exported: { const decl_inst = ip.getNav(func_decl_nav).analysis.?.zir_index.resolve(ip) orelse return error.AnalysisFail; @@ -8509,7 +8509,7 @@ pub fn handleExternLibName( /// These are calling conventions that are confirmed to work with variadic functions. /// Any calling conventions not included here are either not yet verified to work with variadic /// functions or there are no more other calling conventions that support variadic functions. -const calling_conventions_supporting_var_args = [_]std.builtin.CallingConvention.Tag{ +const calling_conventions_supporting_var_args = [_]std.lang.CallingConvention.Tag{ .x86_16_cdecl, .x86_64_sysv, .x86_64_x32, @@ -8570,12 +8570,12 @@ const calling_conventions_supporting_var_args = [_]std.builtin.CallingConvention .xtensa_call0, .xtensa_windowed, }; -fn callConvSupportsVarArgs(cc: std.builtin.CallingConvention.Tag) bool { +fn callConvSupportsVarArgs(cc: std.lang.CallingConvention.Tag) bool { return for (calling_conventions_supporting_var_args) |supported_cc| { if (cc == supported_cc) return true; } else false; } -fn checkCallConvSupportsVarArgs(sema: *Sema, block: *Block, src: LazySrcLoc, cc: std.builtin.CallingConvention.Tag) CompileError!void { +fn checkCallConvSupportsVarArgs(sema: *Sema, block: *Block, src: LazySrcLoc, cc: std.lang.CallingConvention.Tag) CompileError!void { const CallingConventionsSupportingVarArgsList = struct { arch: std.Target.Cpu.Arch, pub fn format(ctx: @This(), w: *std.Io.Writer) std.Io.Writer.Error!void { @@ -8612,7 +8612,7 @@ fn checkParamType( param_is_comptime: bool, param_is_noalias: bool, param_src: LazySrcLoc, - cc: std.builtin.CallingConvention, + cc: std.lang.CallingConvention, ) CompileError!void { const pt = sema.pt; const zcu = pt.zcu; @@ -8668,7 +8668,7 @@ fn checkReturnTypeAndCallConv( block: *Block, bare_ret_ty: Type, ret_ty_src: LazySrcLoc, - @"callconv": std.builtin.CallingConvention, + @"callconv": std.lang.CallingConvention, callconv_src: LazySrcLoc, /// non-`null` only if the function is varargs. opt_varargs_src: ?LazySrcLoc, @@ -8772,7 +8772,7 @@ fn checkReturnTypeAndCallConv( fn validateResolvedFuncType( sema: *Sema, block: *Block, - @"callconv": std.builtin.CallingConvention, + @"callconv": std.lang.CallingConvention, param_types: []const InternPool.Index, ret_ty: Type, src: LazySrcLoc, @@ -8823,7 +8823,7 @@ fn validateResolvedFuncType( } } -fn callConvIsCallable(cc: std.builtin.CallingConvention.Tag) bool { +fn callConvIsCallable(cc: std.lang.CallingConvention.Tag) bool { return switch (cc) { .naked, @@ -8898,7 +8898,7 @@ fn funcCommon( block: *Block, src_node_offset: std.zig.Ast.Node.Offset, func_inst: Zir.Inst.Index, - cc: std.builtin.CallingConvention, + cc: std.lang.CallingConvention, /// this might be Type.generic_poison bare_return_type: Type, var_args: bool, @@ -9896,7 +9896,7 @@ fn zirSwitchBlockErrUnion(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Comp else try sema.analyzeIsNonErr(block, operand_src, eu_maybe_ptr); - const non_err_hint: std.builtin.BranchHint = hint: { + const non_err_hint: std.lang.BranchHint = hint: { // don't analyze the non-error body if it's unreachable if (non_err_cond == .bool_false) { break :hint undefined; @@ -10488,14 +10488,14 @@ fn finishSwitchBr( const bags_required = std.math.divCeil(u32, hints.count + additional_count, hints_per_bag) catch unreachable; return hints.bags.ensureUnusedCapacity(gpa_inner, bags_required); } - fn appendAssumeCapacity(hints: *@This(), hint: std.builtin.BranchHint) void { + fn appendAssumeCapacity(hints: *@This(), hint: std.lang.BranchHint) void { const idx_in_bag = hints.count % hints_per_bag; var bag: u32 = if (idx_in_bag > 0) hints.bags.pop().? else 0; - bag |= @as(u32, @intFromEnum(hint)) << @intCast(@bitSizeOf(std.builtin.BranchHint) * idx_in_bag); + bag |= @as(u32, @intFromEnum(hint)) << @intCast(@bitSizeOf(std.lang.BranchHint) * idx_in_bag); hints.count += 1; return hints.bags.appendAssumeCapacity(bag); } - fn append(hints: *@This(), gpa_inner: Allocator, hint: std.builtin.BranchHint) Allocator.Error!void { + fn append(hints: *@This(), gpa_inner: Allocator, hint: std.lang.BranchHint) Allocator.Error!void { try hints.ensureUnusedCapacity(gpa_inner, 1); return hints.appendAssumeCapacity(hint); } @@ -10574,7 +10574,7 @@ fn finishSwitchBr( } emit_bb = true; - const prong_hint: std.builtin.BranchHint = hint: { + const prong_hint: std.lang.BranchHint = hint: { if (analyze_body) break :hint try sema.analyzeSwitchProng( &case_block, operand, @@ -10717,7 +10717,7 @@ fn finishSwitchBr( case_block.instructions.clearRetainingCapacity(); case_block.error_return_trace_index = child_block.error_return_trace_index; - const prong_hint: std.builtin.BranchHint = hint: { + const prong_hint: std.lang.BranchHint = hint: { if (any_analyze_body) break :hint try sema.analyzeSwitchProng( &case_block, operand, @@ -10804,7 +10804,7 @@ fn finishSwitchBr( if (emit_bb) try sema.emitBackwardBranch(block, else_prong_src); emit_bb = true; - const prong_hint: std.builtin.BranchHint = hint: { + const prong_hint: std.lang.BranchHint = hint: { if (analyze_body) break :hint try sema.analyzeSwitchProng( &case_block, operand, @@ -10864,7 +10864,7 @@ fn finishSwitchBr( cases_len += 1; - const prong_hint: std.builtin.BranchHint = hint: { + const prong_hint: std.lang.BranchHint = hint: { if (!else_case.is_inline) break :hint try sema.analyzeSwitchProng( &case_block, operand, @@ -11937,7 +11937,7 @@ fn analyzeSwitchProng( else_err_ty: ?Type, switch_inst: Zir.Inst.Index, zir_switch: *const Zir.UnwrappedSwitchBlock, -) CompileError!std.builtin.BranchHint { +) CompileError!std.lang.BranchHint { const pt = sema.pt; const zcu = pt.zcu; @@ -12328,7 +12328,7 @@ fn analyzeSwitchPayloadCapture( { // All branch hints are `.none`, so just add zero elems. - comptime assert(@intFromEnum(std.builtin.BranchHint.none) == 0); + comptime assert(@intFromEnum(std.lang.BranchHint.none) == 0); const need_elems = std.math.divCeil(usize, prong_count + 1, 10) catch unreachable; try cases_extra.appendNTimes(0, need_elems); } @@ -16088,7 +16088,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai }; return Air.internedToRef((try pt.internUnion(.{ .ty = type_info_ty.toIntern(), - .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.@"fn"))).toIntern(), + .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.lang.TypeId.@"fn"))).toIntern(), .val = (try pt.aggregateValue(fn_info_ty, &field_values)).toIntern(), }))); }, @@ -16104,7 +16104,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai }; return Air.internedToRef((try pt.internUnion(.{ .ty = type_info_ty.toIntern(), - .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.int))).toIntern(), + .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.lang.TypeId.int))).toIntern(), .val = (try pt.aggregateValue(int_info_ty, &field_values)).toIntern(), }))); }, @@ -16117,7 +16117,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai }; return Air.internedToRef((try pt.internUnion(.{ .ty = type_info_ty.toIntern(), - .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.float))).toIntern(), + .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.lang.TypeId.float))).toIntern(), .val = (try pt.aggregateValue(float_info_ty, &field_vals)).toIntern(), }))); }, @@ -16162,7 +16162,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai }; return Air.internedToRef((try pt.internUnion(.{ .ty = type_info_ty.toIntern(), - .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.pointer))).toIntern(), + .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.lang.TypeId.pointer))).toIntern(), .val = (try pt.aggregateValue(pointer_ty, &field_values)).toIntern(), }))); }, @@ -16180,7 +16180,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai }; return Air.internedToRef((try pt.internUnion(.{ .ty = type_info_ty.toIntern(), - .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.array))).toIntern(), + .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.lang.TypeId.array))).toIntern(), .val = (try pt.aggregateValue(array_field_ty, &field_values)).toIntern(), }))); }, @@ -16196,7 +16196,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai }; return Air.internedToRef((try pt.internUnion(.{ .ty = type_info_ty.toIntern(), - .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.vector))).toIntern(), + .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.lang.TypeId.vector))).toIntern(), .val = (try pt.aggregateValue(vector_field_ty, &field_values)).toIntern(), }))); }, @@ -16209,7 +16209,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai }; return Air.internedToRef((try pt.internUnion(.{ .ty = type_info_ty.toIntern(), - .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.optional))).toIntern(), + .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.lang.TypeId.optional))).toIntern(), .val = (try pt.aggregateValue(optional_field_ty, &field_values)).toIntern(), }))); }, @@ -16300,7 +16300,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai // Construct Type{ .error_set = errors_val } return Air.internedToRef((try pt.internUnion(.{ .ty = type_info_ty.toIntern(), - .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.error_set))).toIntern(), + .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.lang.TypeId.error_set))).toIntern(), .val = errors_val, }))); }, @@ -16315,7 +16315,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai }; return Air.internedToRef((try pt.internUnion(.{ .ty = type_info_ty.toIntern(), - .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.error_union))).toIntern(), + .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.lang.TypeId.error_union))).toIntern(), .val = (try pt.aggregateValue(error_union_field_ty, &field_values)).toIntern(), }))); }, @@ -16418,7 +16418,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai }; return Air.internedToRef((try pt.internUnion(.{ .ty = type_info_ty.toIntern(), - .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.@"enum"))).toIntern(), + .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.lang.TypeId.@"enum"))).toIntern(), .val = (try pt.aggregateValue(type_enum_ty, &field_values)).toIntern(), }))); }, @@ -16539,7 +16539,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai }; return Air.internedToRef((try pt.internUnion(.{ .ty = type_info_ty.toIntern(), - .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.@"union"))).toIntern(), + .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.lang.TypeId.@"union"))).toIntern(), .val = (try pt.aggregateValue(type_union_ty, &field_values)).toIntern(), }))); }, @@ -16731,7 +16731,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai }; return Air.internedToRef((try pt.internUnion(.{ .ty = type_info_ty.toIntern(), - .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.@"struct"))).toIntern(), + .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.lang.TypeId.@"struct"))).toIntern(), .val = (try pt.aggregateValue(type_struct_ty, &field_values)).toIntern(), }))); }, @@ -16746,7 +16746,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai }; return Air.internedToRef((try pt.internUnion(.{ .ty = type_info_ty.toIntern(), - .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.@"opaque"))).toIntern(), + .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.lang.TypeId.@"opaque"))).toIntern(), .val = (try pt.aggregateValue(type_opaque_ty, &field_values)).toIntern(), }))); }, @@ -17323,7 +17323,7 @@ fn zirCondbr( // Reset, this may have been updated by the then block analysis sub_block.error_return_trace_index = parent_block.error_return_trace_index; - const false_hint: std.builtin.BranchHint = if (err_cond != null and + const false_hint: std.lang.BranchHint = if (err_cond != null and try sema.maybeErrorUnwrap(&sub_block, else_body, err_cond.?, cond_src, false)) h: { // nothing to do here. weight against error branch @@ -18040,7 +18040,7 @@ fn zirPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air break :blk try sema.validateAlign(block, align_src, align_bytes); } else .none; - const address_space: std.builtin.AddressSpace = if (inst_data.flags.has_addrspace) blk: { + const address_space: std.lang.AddressSpace = if (inst_data.flags.has_addrspace) blk: { const ref: Zir.Inst.Ref = @enumFromInt(sema.code.extra[extra_i]); extra_i += 1; break :blk try sema.resolveAddressSpace(block, addrspace_src, ref, .pointer); @@ -19605,12 +19605,12 @@ fn zirReifyPointer( const size_uncoerced = sema.resolveInst(extra.size); const size_coerced = try sema.coerce(block, size_ty, size_uncoerced, size_src); const size_val = try sema.resolveConstDefinedValue(block, size_src, size_coerced, .{ .simple = .pointer_size }); - const size = try sema.interpretStdLangType(block, size_src, size_val, std.builtin.Type.Pointer.Size); + const size = try sema.interpretStdLangType(block, size_src, size_val, std.lang.Type.Pointer.Size); const attrs_uncoerced = sema.resolveInst(extra.attrs); const attrs_coerced = try sema.coerce(block, attrs_ty, attrs_uncoerced, attrs_src); const attrs_val = try sema.resolveConstDefinedValue(block, attrs_src, attrs_coerced, .{ .simple = .pointer_attrs }); - const attrs = try sema.interpretStdLangType(block, attrs_src, attrs_val, std.builtin.Type.Pointer.Attributes); + const attrs = try sema.interpretStdLangType(block, attrs_src, attrs_val, std.lang.Type.Pointer.Attributes); const @"align": Alignment = if (attrs.@"align") |bytes| a: { break :a try sema.validateAlign(block, attrs_src, bytes); @@ -19711,7 +19711,7 @@ fn zirReifyFn( const fn_attrs_uncoerced = sema.resolveInst(extra.fn_attrs); const fn_attrs_coerced = try sema.coerce(block, fn_attrs_ty, fn_attrs_uncoerced, fn_attrs_src); const fn_attrs_val = try sema.resolveConstDefinedValue(block, fn_attrs_src, fn_attrs_coerced, .{ .simple = .fn_attrs }); - const fn_attrs = try sema.interpretStdLangType(block, fn_attrs_src, fn_attrs_val, std.builtin.Type.Fn.Attributes); + const fn_attrs = try sema.interpretStdLangType(block, fn_attrs_src, fn_attrs_val, std.lang.Type.Fn.Attributes); var noalias_bits: u32 = 0; const param_types_ip = try sema.arena.alloc(InternPool.Index, @intCast(params_len)); @@ -19721,7 +19721,7 @@ fn zirReifyFn( block, param_attrs_src, try param_attrs_arr.elemValue(pt, param_idx), - std.builtin.Type.Fn.Param.Attributes, + std.lang.Type.Fn.Param.Attributes, ); try sema.checkParamType( block, @@ -19831,7 +19831,7 @@ fn zirReifyStruct( const layout_uncoerced = sema.resolveInst(extra.layout); const layout_coerced = try sema.coerce(block, container_layout_ty, layout_uncoerced, layout_src); const layout_val = try sema.resolveConstDefinedValue(block, layout_src, layout_coerced, .{ .simple = .struct_layout }); - const layout = try sema.interpretStdLangType(block, layout_src, layout_val, std.builtin.Type.ContainerLayout); + const layout = try sema.interpretStdLangType(block, layout_src, layout_val, std.lang.Type.ContainerLayout); const backing_int_ty_uncoerced = sema.resolveInst(extra.backing_ty); const backing_int_ty_coerced = try sema.coerce(block, .optional_type, backing_int_ty_uncoerced, backing_ty_src); @@ -19912,15 +19912,15 @@ fn zirReifyStruct( const field_name = try sema.sliceToIpString(block, field_names_src, field_name_val, .{ .simple = .struct_field_names }); const field_attr_comptime = try field_attrs_val.fieldValue(pt, std.meta.fieldIndex( - std.builtin.Type.StructField.Attributes, + std.lang.Type.StructField.Attributes, "comptime", ).?); const field_attr_align = try field_attrs_val.fieldValue(pt, std.meta.fieldIndex( - std.builtin.Type.StructField.Attributes, + std.lang.Type.StructField.Attributes, "align", ).?); const field_attr_default_value_ptr = try field_attrs_val.fieldValue(pt, std.meta.fieldIndex( - std.builtin.Type.StructField.Attributes, + std.lang.Type.StructField.Attributes, "default_value_ptr", ).?); @@ -19997,15 +19997,15 @@ fn zirReifyStruct( wip.field_types.get(ip)[field_idx] = field_ty.toIntern(); const field_attr_comptime = try field_attrs_val.fieldValue(pt, std.meta.fieldIndex( - std.builtin.Type.StructField.Attributes, + std.lang.Type.StructField.Attributes, "comptime", ).?); const field_attr_align = try field_attrs_val.fieldValue(pt, std.meta.fieldIndex( - std.builtin.Type.StructField.Attributes, + std.lang.Type.StructField.Attributes, "align", ).?); const field_attr_default_value_ptr = try field_attrs_val.fieldValue(pt, std.meta.fieldIndex( - std.builtin.Type.StructField.Attributes, + std.lang.Type.StructField.Attributes, "default_value_ptr", ).?); @@ -20111,7 +20111,7 @@ fn zirReifyUnion( const layout_uncoerced = sema.resolveInst(extra.layout); const layout_coerced = try sema.coerce(block, container_layout_ty, layout_uncoerced, layout_src); const layout_val = try sema.resolveConstDefinedValue(block, layout_src, layout_coerced, .{ .simple = .union_layout }); - const layout = try sema.interpretStdLangType(block, layout_src, layout_val, std.builtin.Type.ContainerLayout); + const layout = try sema.interpretStdLangType(block, layout_src, layout_val, std.lang.Type.ContainerLayout); const arg_ty_uncoerced = sema.resolveInst(extra.arg_ty); const arg_ty_coerced = try sema.coerce(block, .optional_type, arg_ty_uncoerced, arg_ty_src); @@ -20195,7 +20195,7 @@ fn zirReifyUnion( block, field_attrs_src, try field_attrs_arr.elemValue(pt, field_idx), - std.builtin.Type.UnionField.Attributes, + std.lang.Type.UnionField.Attributes, ); if (field_attrs.@"align") |bytes| { if (layout == .@"packed") { @@ -20244,7 +20244,7 @@ fn zirReifyUnion( block, .unneeded, try field_attrs_arr.elemValue(pt, field_idx), - std.builtin.Type.UnionField.Attributes, + std.lang.Type.UnionField.Attributes, ); if (field_attrs.@"align") |bytes| { // No source location; first loop checked this is valid. @@ -20329,7 +20329,7 @@ fn zirReifyEnum( const mode_uncoerced = sema.resolveInst(extra.mode); const mode_coerced = try sema.coerce(block, enum_mode_ty, mode_uncoerced, mode_src); const mode_val = try sema.resolveConstDefinedValue(block, mode_src, mode_coerced, .{ .simple = .type }); - const nonexhaustive = switch (try sema.interpretStdLangType(block, mode_src, mode_val, std.builtin.Type.Enum.Mode)) { + const nonexhaustive = switch (try sema.interpretStdLangType(block, mode_src, mode_val, std.lang.Type.Enum.Mode)) { .exhaustive => false, .nonexhaustive => true, }; @@ -21962,9 +21962,9 @@ fn checkArithmeticOp( sema: *Sema, block: *Block, src: LazySrcLoc, - scalar_tag: std.builtin.TypeId, - lhs_zig_ty_tag: std.builtin.TypeId, - rhs_zig_ty_tag: std.builtin.TypeId, + scalar_tag: std.lang.TypeId, + lhs_zig_ty_tag: std.lang.TypeId, + rhs_zig_ty_tag: std.lang.TypeId, zir_tag: Zir.Inst.Tag, ) CompileError!void { const is_int = scalar_tag == .int or scalar_tag == .comptime_int; @@ -22387,7 +22387,7 @@ fn resolveExportOptions( const linkage_operand = try sema.fieldVal(block, src, options, try ip.getOrPutString(gpa, io, pt.tid, "linkage", .no_embedded_nulls), linkage_src); const linkage_val = try sema.resolveConstDefinedValue(block, linkage_src, linkage_operand, .{ .simple = .export_options }); - const linkage = try sema.interpretStdLangType(block, linkage_src, linkage_val, std.builtin.GlobalLinkage); + const linkage = try sema.interpretStdLangType(block, linkage_src, linkage_val, std.lang.GlobalLinkage); const section_operand = try sema.fieldVal(block, src, options, try ip.getOrPutString(gpa, io, pt.tid, "section", .no_embedded_nulls), section_src); const section_opt_val = try sema.resolveConstDefinedValue(block, section_src, section_operand, .{ .simple = .export_options }); @@ -22398,7 +22398,7 @@ fn resolveExportOptions( const visibility_operand = try sema.fieldVal(block, src, options, try ip.getOrPutString(gpa, io, pt.tid, "visibility", .no_embedded_nulls), visibility_src); const visibility_val = try sema.resolveConstDefinedValue(block, visibility_src, visibility_operand, .{ .simple = .export_options }); - const visibility = try sema.interpretStdLangType(block, visibility_src, visibility_val, std.builtin.SymbolVisibility); + const visibility = try sema.interpretStdLangType(block, visibility_src, visibility_val, std.lang.SymbolVisibility); if (name.len < 1) { return sema.fail(block, name_src, "exported symbol name cannot be empty", .{}); @@ -22425,12 +22425,12 @@ fn resolveStdLangEnum( zir_ref: Zir.Inst.Ref, comptime name: Zcu.StdLangDecl, reason: ComptimeReason, -) CompileError!@field(std.builtin, @tagName(name)) { +) CompileError!@field(std.lang, @tagName(name)) { const ty = try sema.getStdLangType(src, name); const air_ref = sema.resolveInst(zir_ref); const coerced = try sema.coerce(block, ty, air_ref, src); const val = try sema.resolveConstDefinedValue(block, src, coerced, reason); - return sema.interpretStdLangType(block, src, val, @field(std.builtin, @tagName(name))); + return sema.interpretStdLangType(block, src, val, @field(std.lang, @tagName(name))); } fn resolveAtomicOrder( @@ -22439,7 +22439,7 @@ fn resolveAtomicOrder( src: LazySrcLoc, zir_ref: Zir.Inst.Ref, reason: ComptimeReason, -) CompileError!std.builtin.AtomicOrder { +) CompileError!std.lang.AtomicOrder { return sema.resolveStdLangEnum(block, src, zir_ref, .AtomicOrder, reason); } @@ -22448,7 +22448,7 @@ fn resolveAtomicRmwOp( block: *Block, src: LazySrcLoc, zir_ref: Zir.Inst.Ref, -) CompileError!std.builtin.AtomicRmwOp { +) CompileError!std.lang.AtomicRmwOp { return sema.resolveStdLangEnum(block, src, zir_ref, .AtomicRmwOp, .{ .simple = .operand_atomicRmw_operation }); } @@ -22490,10 +22490,10 @@ fn zirCmpxchg( const success_order = try sema.resolveAtomicOrder(block, success_order_src, extra.success_order, .{ .simple = .atomic_order }); const failure_order = try sema.resolveAtomicOrder(block, failure_order_src, extra.failure_order, .{ .simple = .atomic_order }); - if (@intFromEnum(success_order) < @intFromEnum(std.builtin.AtomicOrder.monotonic)) { + if (@intFromEnum(success_order) < @intFromEnum(std.lang.AtomicOrder.monotonic)) { return sema.fail(block, success_order_src, "success atomic ordering must be monotonic or stricter", .{}); } - if (@intFromEnum(failure_order) < @intFromEnum(std.builtin.AtomicOrder.monotonic)) { + if (@intFromEnum(failure_order) < @intFromEnum(std.lang.AtomicOrder.monotonic)) { return sema.fail(block, failure_order_src, "failure atomic ordering must be monotonic or stricter", .{}); } if (@intFromEnum(failure_order) > @intFromEnum(success_order)) { @@ -23200,7 +23200,7 @@ fn zirBuiltinCall(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError const air_ref = sema.resolveInst(extra.modifier); const modifier_ref = try sema.coerce(block, modifier_ty, air_ref, modifier_src); const modifier_val = try sema.resolveConstDefinedValue(block, modifier_src, modifier_ref, .{ .simple = .call_modifier }); - var modifier = try sema.interpretStdLangType(block, modifier_src, modifier_val, std.builtin.CallModifier); + var modifier = try sema.interpretStdLangType(block, modifier_src, modifier_val, std.lang.CallModifier); switch (modifier) { // These can be upgraded to comptime or nosuspend calls. .auto, .never_tail, .no_suspend => { @@ -24250,7 +24250,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A var extra_index: usize = extra.end; - const cc: std.builtin.CallingConvention = if (extra.data.bits.has_cc_body) blk: { + const cc: std.lang.CallingConvention = if (extra.data.bits.has_cc_body) blk: { const body_len = sema.code.extra[extra_index]; extra_index += 1; const body = sema.code.bodySlice(extra_index, body_len); @@ -24398,7 +24398,7 @@ fn resolvePrefetchOptions( block: *Block, src: LazySrcLoc, zir_ref: Zir.Inst.Ref, -) CompileError!std.builtin.PrefetchOptions { +) CompileError!std.lang.PrefetchOptions { const pt = sema.pt; const zcu = pt.zcu; const comp = zcu.comp; @@ -24422,10 +24422,10 @@ fn resolvePrefetchOptions( const cache = try sema.fieldVal(block, src, options, try ip.getOrPutString(gpa, io, pt.tid, "cache", .no_embedded_nulls), cache_src); const cache_val = try sema.resolveConstDefinedValue(block, cache_src, cache, .{ .simple = .prefetch_options }); - return std.builtin.PrefetchOptions{ - .rw = try sema.interpretStdLangType(block, rw_src, rw_val, std.builtin.PrefetchOptions.Rw), + return std.lang.PrefetchOptions{ + .rw = try sema.interpretStdLangType(block, rw_src, rw_val, std.lang.PrefetchOptions.Rw), .locality = @intCast(locality_val.toUnsignedInt(zcu)), - .cache = try sema.interpretStdLangType(block, cache_src, cache_val, std.builtin.PrefetchOptions.Cache), + .cache = try sema.interpretStdLangType(block, cache_src, cache_val, std.lang.PrefetchOptions.Cache), }; } @@ -24465,12 +24465,12 @@ fn resolveExternOptions( ) CompileError!struct { name: InternPool.NullTerminatedString, library_name: InternPool.OptionalNullTerminatedString, - linkage: std.builtin.GlobalLinkage, - visibility: std.builtin.SymbolVisibility, + linkage: std.lang.GlobalLinkage, + visibility: std.lang.SymbolVisibility, is_thread_local: bool, is_dll_import: bool, - relocation: std.builtin.ExternOptions.Relocation, - decoration: ?std.builtin.ExternOptions.Decoration, + relocation: std.lang.ExternOptions.Relocation, + decoration: ?std.lang.ExternOptions.Decoration, } { const pt = sema.pt; const zcu = pt.zcu; @@ -24500,11 +24500,11 @@ fn resolveExternOptions( const linkage_ref = try sema.fieldVal(block, src, options, try ip.getOrPutString(gpa, io, pt.tid, "linkage", .no_embedded_nulls), linkage_src); const linkage_val = try sema.resolveConstDefinedValue(block, linkage_src, linkage_ref, .{ .simple = .extern_options }); - const linkage = try sema.interpretStdLangType(block, linkage_src, linkage_val, std.builtin.GlobalLinkage); + const linkage = try sema.interpretStdLangType(block, linkage_src, linkage_val, std.lang.GlobalLinkage); const visibility_ref = try sema.fieldVal(block, src, options, try ip.getOrPutString(gpa, io, pt.tid, "visibility", .no_embedded_nulls), visibility_src); const visibility_val = try sema.resolveConstDefinedValue(block, visibility_src, visibility_ref, .{ .simple = .extern_options }); - const visibility = try sema.interpretStdLangType(block, visibility_src, visibility_val, std.builtin.SymbolVisibility); + const visibility = try sema.interpretStdLangType(block, visibility_src, visibility_val, std.lang.SymbolVisibility); const is_thread_local = try sema.fieldVal(block, src, options, try ip.getOrPutString(gpa, io, pt.tid, "is_thread_local", .no_embedded_nulls), thread_local_src); const is_thread_local_val = try sema.resolveConstDefinedValue(block, thread_local_src, is_thread_local, .{ .simple = .extern_options }); @@ -24523,11 +24523,11 @@ fn resolveExternOptions( const relocation_ref = try sema.fieldVal(block, src, options, try ip.getOrPutString(gpa, io, pt.tid, "relocation", .no_embedded_nulls), relocation_src); const relocation_val = try sema.resolveConstDefinedValue(block, relocation_src, relocation_ref, .{ .simple = .extern_options }); - const relocation = try sema.interpretStdLangType(block, relocation_src, relocation_val, std.builtin.ExternOptions.Relocation); + const relocation = try sema.interpretStdLangType(block, relocation_src, relocation_val, std.lang.ExternOptions.Relocation); const decoration_ref = try sema.fieldVal(block, src, options, try ip.getOrPutString(gpa, io, pt.tid, "decoration", .no_embedded_nulls), decoration_src); const decoration_val = try sema.resolveConstDefinedValue(block, decoration_src, decoration_ref, .{ .simple = .extern_options }); - const decoration = try sema.interpretStdLangType(block, decoration_src, decoration_val, ?std.builtin.ExternOptions.Decoration); + const decoration = try sema.interpretStdLangType(block, decoration_src, decoration_val, ?std.lang.ExternOptions.Decoration); if (name.len == 0) { return sema.fail(block, name_src, "extern symbol name cannot be empty", .{}); @@ -24744,7 +24744,7 @@ fn zirStdLangValue(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstD .calling_convention_inline => { const callconv_ty = try sema.getStdLangType(src, .CallingConvention); return .fromValue(Value.uninterpret( - @as(std.builtin.CallingConvention, .@"inline"), + @as(std.lang.CallingConvention, .@"inline"), callconv_ty, pt, ) catch |err| switch (err) { @@ -24795,7 +24795,7 @@ fn zirBranchHint(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstDat // We only apply the first hint in a branch. // This allows user-provided hints to override implicit cold hints. if (sema.branch_hint == null) { - sema.branch_hint = try sema.interpretStdLangType(block, operand_src, hint_val, std.builtin.BranchHint); + sema.branch_hint = try sema.interpretStdLangType(block, operand_src, hint_val, std.lang.BranchHint); } } @@ -27911,8 +27911,8 @@ const InMemoryCoercionResult = union(enum) { }; const Int = struct { - actual_signedness: std.builtin.Signedness, - wanted_signedness: std.builtin.Signedness, + actual_signedness: std.lang.Signedness, + wanted_signedness: std.lang.Signedness, actual_bits: u16, wanted_bits: u16, }; @@ -27928,18 +27928,18 @@ const InMemoryCoercionResult = union(enum) { }; const Size = struct { - actual: std.builtin.Type.Pointer.Size, - wanted: std.builtin.Type.Pointer.Size, + actual: std.lang.Type.Pointer.Size, + wanted: std.lang.Type.Pointer.Size, }; const AddressSpace = struct { - actual: std.builtin.AddressSpace, - wanted: std.builtin.AddressSpace, + actual: std.lang.AddressSpace, + wanted: std.lang.AddressSpace, }; const CC = struct { - actual: std.builtin.CallingConvention, - wanted: std.builtin.CallingConvention, + actual: std.lang.CallingConvention, + wanted: std.lang.CallingConvention, }; const BitRange = struct { @@ -28209,7 +28209,7 @@ const InMemoryCoercionResult = union(enum) { } }; -fn pointerSizeString(size: std.builtin.Type.Pointer.Size) []const u8 { +fn pointerSizeString(size: std.lang.Type.Pointer.Size) []const u8 { return switch (size) { .one => "single pointer", .many => "many pointer", @@ -28635,10 +28635,10 @@ fn coerceInMemoryAllowedFns( fn callconvCoerceAllowed( target: *const std.Target, - src_cc: std.builtin.CallingConvention, - dest_cc: std.builtin.CallingConvention, + src_cc: std.lang.CallingConvention, + dest_cc: std.lang.CallingConvention, ) bool { - const Tag = std.builtin.CallingConvention.Tag; + const Tag = std.lang.CallingConvention.Tag; if (@as(Tag, src_cc) != @as(Tag, dest_cc)) return false; switch (src_cc) { @@ -28651,26 +28651,26 @@ fn callconvCoerceAllowed( if (dest_stack_align < src_stack_align) return false; } switch (@TypeOf(src_data)) { - void, std.builtin.CallingConvention.CommonOptions => {}, - std.builtin.CallingConvention.X86RegparmOptions => { + void, std.lang.CallingConvention.CommonOptions => {}, + std.lang.CallingConvention.X86RegparmOptions => { if (src_data.register_params != dest_data.register_params) return false; }, - std.builtin.CallingConvention.ArcInterruptOptions => { + std.lang.CallingConvention.ArcInterruptOptions => { if (src_data.type != dest_data.type) return false; }, - std.builtin.CallingConvention.ArmInterruptOptions => { + std.lang.CallingConvention.ArmInterruptOptions => { if (src_data.type != dest_data.type) return false; }, - std.builtin.CallingConvention.MicroblazeInterruptOptions => { + std.lang.CallingConvention.MicroblazeInterruptOptions => { if (src_data.type != dest_data.type) return false; }, - std.builtin.CallingConvention.MipsInterruptOptions => { + std.lang.CallingConvention.MipsInterruptOptions => { if (src_data.mode != dest_data.mode) return false; }, - std.builtin.CallingConvention.RiscvInterruptOptions => { + std.lang.CallingConvention.RiscvInterruptOptions => { if (src_data.mode != dest_data.mode) return false; }, - std.builtin.CallingConvention.ShInterruptOptions => { + std.lang.CallingConvention.ShInterruptOptions => { if (src_data.save != dest_data.save) return false; }, else => comptime unreachable, @@ -31115,7 +31115,7 @@ fn cmpNumeric( const dest_ty = if (dest_float_type) |ft| ft else blk: { const max_bits = @max(lhs_bits, rhs_bits); const casted_bits = std.math.cast(u16, max_bits) orelse return sema.fail(block, src, "{d} exceeds maximum integer bit count", .{max_bits}); - const signedness: std.builtin.Signedness = if (dest_int_is_signed) .signed else .unsigned; + const signedness: std.lang.Signedness = if (dest_int_is_signed) .signed else .unsigned; break :blk try pt.intType(signedness, casted_bits); }; const casted_lhs = try sema.coerce(block, dest_ty, lhs, lhs_src); @@ -33101,7 +33101,7 @@ fn resolveAddressSpace( src: LazySrcLoc, zir_ref: Zir.Inst.Ref, ctx: std.Target.AddressSpaceContext, -) !std.builtin.AddressSpace { +) !std.lang.AddressSpace { const air_ref = sema.resolveInst(zir_ref); return sema.analyzeAsAddressSpace(block, src, air_ref, ctx); } @@ -33112,12 +33112,12 @@ pub fn analyzeAsAddressSpace( src: LazySrcLoc, air_ref: Air.Inst.Ref, ctx: std.Target.AddressSpaceContext, -) !std.builtin.AddressSpace { +) !std.lang.AddressSpace { const pt = sema.pt; const addrspace_ty = try sema.getStdLangType(src, .AddressSpace); const coerced = try sema.coerce(block, addrspace_ty, air_ref, src); const addrspace_val = try sema.resolveConstDefinedValue(block, src, coerced, .{ .simple = .@"addrspace" }); - const address_space = try sema.interpretStdLangType(block, src, addrspace_val, std.builtin.AddressSpace); + const address_space = try sema.interpretStdLangType(block, src, addrspace_val, std.lang.AddressSpace); const target = pt.zcu.getTarget(); if (!target.supportsAddressSpace(address_space, ctx)) { @@ -33833,7 +33833,7 @@ pub fn getStdLangValue(sema: *Sema, src: LazySrcLoc, decl: Zcu.StdLangDecl) Sema pub const NavPtrModifiers = struct { @"align": Alignment, @"linksection": InternPool.OptionalNullTerminatedString, - @"addrspace": std.builtin.AddressSpace, + @"addrspace": std.lang.AddressSpace, }; pub fn resolveNavPtrModifiers( @@ -33872,7 +33872,7 @@ pub fn resolveNavPtrModifiers( break :ls try ip.getOrPutStringOpt(gpa, io, pt.tid, bytes, .no_embedded_nulls); }; - const @"addrspace": std.builtin.AddressSpace = as: { + const @"addrspace": std.lang.AddressSpace = as: { const addrspace_ctx: std.Target.AddressSpaceContext = switch (zir_decl.kind) { .@"var" => .variable, else => switch (nav_ty.zigTypeTag(zcu)) { diff --git a/src/Sema/arith.zig b/src/Sema/arith.zig index 709bc8a4fc5e797c3850ce0adec9627ab02b68d5..cf1c699e4a5682c6cd1d3669fe17aebad97d4b89 100644 --- a/src/Sema/arith.zig +++ b/src/Sema/arith.zig @@ -1191,7 +1191,7 @@ pub fn truncate( val: Value, ty: Type, dest_ty: Type, - dest_signedness: std.builtin.Signedness, + dest_signedness: std.lang.Signedness, dest_bits: u16, ) CompileError!Value { const pt = sema.pt; @@ -1808,7 +1808,7 @@ fn intTruncate( sema: *Sema, val: Value, dest_ty: Type, - dest_signedness: std.builtin.Signedness, + dest_signedness: std.lang.Signedness, dest_bits: u16, ) !Value { const pt = sema.pt; diff --git a/src/Type.zig b/src/Type.zig index c16f1c002507665fa3bf73d73f026b91847db5a0..8e8202c023d9d95832f1285839a4654380a23016 100644 --- a/src/Type.zig +++ b/src/Type.zig @@ -19,7 +19,7 @@ const Type = @This(); ip_index: InternPool.Index, -pub fn zigTypeTag(ty: Type, zcu: *const Zcu) std.builtin.TypeId { +pub fn zigTypeTag(ty: Type, zcu: *const Zcu) std.lang.TypeId { return zcu.intern_pool.zigTypeTag(ty.toIntern()); } @@ -903,7 +903,7 @@ pub fn ptrAlignment(ptr_ty: Type, zcu: *Zcu) Alignment { return Type.fromInterned(ptr_key.child).abiAlignment(zcu); } -pub fn ptrAddressSpace(ty: Type, zcu: *const Zcu) std.builtin.AddressSpace { +pub fn ptrAddressSpace(ty: Type, zcu: *const Zcu) std.lang.AddressSpace { return switch (zcu.intern_pool.indexToKey(ty.toIntern())) { .ptr_type => |ptr_type| ptr_type.flags.address_space, .opt_type => |child| zcu.intern_pool.indexToKey(child).ptr_type.flags.address_space, @@ -1337,12 +1337,12 @@ pub fn isSinglePointer(ty: Type, zcu: *const Zcu) bool { } /// Asserts `ty` is a pointer. -pub fn ptrSize(ty: Type, zcu: *const Zcu) std.builtin.Type.Pointer.Size { +pub fn ptrSize(ty: Type, zcu: *const Zcu) std.lang.Type.Pointer.Size { return ty.ptrSizeOrNull(zcu).?; } /// Returns `null` if `ty` is not a pointer. -pub fn ptrSizeOrNull(ty: Type, zcu: *const Zcu) ?std.builtin.Type.Pointer.Size { +pub fn ptrSizeOrNull(ty: Type, zcu: *const Zcu) ?std.lang.Type.Pointer.Size { return switch (zcu.intern_pool.indexToKey(ty.toIntern())) { .ptr_type => |ptr_info| ptr_info.flags.size, else => null, @@ -1627,7 +1627,7 @@ pub fn unionGetLayout(ty: Type, zcu: *const Zcu) Zcu.UnionLayout { return Type.getUnionLayout(union_obj, zcu); } -pub fn containerLayout(ty: Type, zcu: *const Zcu) std.builtin.Type.ContainerLayout { +pub fn containerLayout(ty: Type, zcu: *const Zcu) std.lang.Type.ContainerLayout { const ip = &zcu.intern_pool; return switch (ip.indexToKey(ty.toIntern())) { .tuple_type => .auto, @@ -1949,7 +1949,7 @@ pub fn fnReturnType(ty: Type, zcu: *const Zcu) Type { } /// Asserts the type is a function. -pub fn fnCallingConvention(ty: Type, zcu: *const Zcu) std.builtin.CallingConvention { +pub fn fnCallingConvention(ty: Type, zcu: *const Zcu) std.lang.CallingConvention { return zcu.intern_pool.indexToKey(ty.toIntern()).func_type.cc; } @@ -2477,7 +2477,7 @@ pub fn explicitFieldAlignment(ty: Type, index: usize, zcu: *const Zcu) Alignment /// Asserts that the layout of `field_ty` is resolved. Asserts that `layout` is not `.@"packed"`. pub fn defaultStructFieldAlignment( field_ty: Type, - layout: std.builtin.Type.ContainerLayout, + layout: std.lang.Type.ContainerLayout, zcu: *const Zcu, ) Alignment { const overalign_big_int = switch (layout) { @@ -3227,7 +3227,7 @@ pub fn validateExtern(ty: Type, position: ExternPosition, zcu: *const Zcu) bool .optional => ty.isPtrLikeOptional(zcu), }; } -fn validateExternCallconv(cc: std.builtin.CallingConvention) bool { +fn validateExternCallconv(cc: std.lang.CallingConvention) bool { return switch (cc) { // For now we want to authorize PTX kernel to use zig objects, even if we end up exposing the ABI. // The goal is to experiment with more integrated CPU/GPU code. diff --git a/src/Value.zig b/src/Value.zig index e530edd92bec949a266f22dffb7e3479931c851c..e79b1f31e8073b68636eecba4453448735bf1b38 100644 --- a/src/Value.zig +++ b/src/Value.zig @@ -1845,7 +1845,7 @@ pub fn ptrElem(orig_parent_ptr: Value, field_idx: u64, pt: Zcu.PerThread) !Value } })); } -fn canonicalizeBasePtr(base_ptr: Value, want_size: std.builtin.Type.Pointer.Size, want_child: Type, pt: Zcu.PerThread) !Value { +fn canonicalizeBasePtr(base_ptr: Value, want_size: std.lang.Type.Pointer.Size, want_child: Type, pt: Zcu.PerThread) !Value { const ptr_ty = base_ptr.typeOf(pt.zcu); const ptr_info = ptr_ty.ptrInfo(pt.zcu); diff --git a/src/Zcu.zig b/src/Zcu.zig index f27f07d2f29c13d046df6ddd5736835070bcdc40..16ee66ae7017de3f80461b1df57021fbfe835485 100644 --- a/src/Zcu.zig +++ b/src/Zcu.zig @@ -744,9 +744,9 @@ pub const Export = struct { pub const Options = struct { name: InternPool.NullTerminatedString, - linkage: std.builtin.GlobalLinkage = .strong, + linkage: std.lang.GlobalLinkage = .strong, section: InternPool.OptionalNullTerminatedString = .none, - visibility: std.builtin.SymbolVisibility = .default, + visibility: std.lang.SymbolVisibility = .default, }; /// Index into `all_exports`. @@ -4524,10 +4524,10 @@ fn formatDependee(data: FormatDependee, writer: *Io.Writer) Io.Writer.Error!void } } -pub fn callconvSupported(zcu: *Zcu, cc: std.builtin.CallingConvention) union(enum) { +pub fn callconvSupported(zcu: *Zcu, cc: std.lang.CallingConvention) union(enum) { ok, bad_arch: []const std.Target.Cpu.Arch, // value is allowed archs for cc - bad_backend: std.builtin.CompilerBackend, // value is current backend + bad_backend: std.lang.CompilerBackend, // value is current backend } { const target = zcu.getTarget(); const backend = target_util.zigBackend(target, zcu.comp.config.use_llvm); diff --git a/src/Zcu/PerThread.zig b/src/Zcu/PerThread.zig index 2e6f7b49b8147d2092ebd858deecb56b04625c61..5dd273fc380e8bc7611cc3919ef30031965a284b 100644 --- a/src/Zcu/PerThread.zig +++ b/src/Zcu/PerThread.zig @@ -3965,7 +3965,7 @@ pub fn getCoerced(pt: Zcu.PerThread, val: Value, new_ty: Type) Allocator.Error!V return .fromInterned(try ip.getCoerced(gpa, io, pt.tid, val.toIntern(), new_ty.toIntern())); } -pub fn intType(pt: Zcu.PerThread, signedness: std.builtin.Signedness, bits: u16) Allocator.Error!Type { +pub fn intType(pt: Zcu.PerThread, signedness: std.lang.Signedness, bits: u16) Allocator.Error!Type { return Type.fromInterned(try pt.intern(.{ .int_type = .{ .signedness = signedness, .bits = bits, diff --git a/src/codegen.zig b/src/codegen.zig index 509ec78d96c750f87ea20bfde8109ec02918cc34..57489a6bfe41ad374024ce2a9028f691ef866662 100644 --- a/src/codegen.zig +++ b/src/codegen.zig @@ -29,7 +29,7 @@ pub const CodeGenError = GenerateSymbolError || error{ CodegenFail, }; -fn devFeatureForBackend(backend: std.builtin.CompilerBackend) dev.Feature { +fn devFeatureForBackend(backend: std.lang.CompilerBackend) dev.Feature { return switch (backend) { .other, .stage1 => unreachable, .stage2_aarch64 => .aarch64_backend, @@ -47,7 +47,7 @@ fn devFeatureForBackend(backend: std.builtin.CompilerBackend) dev.Feature { }; } -fn importBackend(comptime backend: std.builtin.CompilerBackend) type { +fn importBackend(comptime backend: std.lang.CompilerBackend) type { return switch (backend) { .other, .stage1 => unreachable, .stage2_aarch64 => aarch64, @@ -105,7 +105,7 @@ pub const AnyMir = union { wasm: if (dev.env.supports(.wasm_backend)) @import("codegen/wasm/Mir.zig") else noreturn, c: if (dev.env.supports(.c_backend)) @import("codegen/c.zig").Mir else noreturn, - pub inline fn tag(comptime backend: std.builtin.CompilerBackend) []const u8 { + pub inline fn tag(comptime backend: std.lang.CompilerBackend) []const u8 { return switch (backend) { .stage2_aarch64 => "aarch64", .stage2_riscv64 => "riscv64", diff --git a/src/codegen/aarch64/Assemble.zig b/src/codegen/aarch64/Assemble.zig index 7c8a6a5d7ad580f76fe16ce3f576431d8e0c31fe..8ee9e933a4de835281d80883a2d363d77a3522ee 100644 --- a/src/codegen/aarch64/Assemble.zig +++ b/src/codegen/aarch64/Assemble.zig @@ -307,7 +307,7 @@ const SymbolSpec = union(enum) { }, systemreg, imm: struct { - type: std.builtin.Type.Int, + type: std.lang.Type.Int, multiple_of: ?comptime_int = null, min_valid: ?comptime_int = null, max_valid: ?comptime_int = null, diff --git a/src/codegen/aarch64/Select.zig b/src/codegen/aarch64/Select.zig index 968bb3134bc9f107789ce6807d146cafe79ab7e6..5a1bb5eb9bfc0d433403500ef7590842e9b180cb 100644 --- a/src/codegen/aarch64/Select.zig +++ b/src/codegen/aarch64/Select.zig @@ -2887,7 +2887,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory, const bin_op = air.data(air.inst_index).bin_op; const ty = isel.air.typeOf(bin_op.lhs, ip); - const int_info: std.builtin.Type.Int = if (ty.toIntern() == .bool_type) + const int_info: std.lang.Type.Int = if (ty.toIntern() == .bool_type) .{ .signedness = .unsigned, .bits = 1 } else if (ty.isAbiInt(zcu)) ty.intInfo(zcu) @@ -3144,7 +3144,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory, const ty_op = air.data(air.inst_index).ty_op; const ty = ty_op.ty.toType(); - const int_info: std.builtin.Type.Int = int_info: { + const int_info: std.lang.Type.Int = int_info: { if (ty_op.ty == .bool_type) break :int_info .{ .signedness = .unsigned, .bits = 1 }; if (!ty.isAbiInt(zcu)) return isel.fail("bad {t} {f}", .{ air_tag, isel.fmtType(ty) }); break :int_info ty.intInfo(zcu); @@ -3199,7 +3199,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory, const src_tag = src_ty.zigTypeTag(zcu); if (dst_ty.isAbiInt(zcu) and (src_tag == .bool or src_ty.isAbiInt(zcu))) { const dst_int_info = dst_ty.intInfo(zcu); - const src_int_info: std.builtin.Type.Int = if (src_tag == .bool) .{ .signedness = undefined, .bits = 1 } else src_ty.intInfo(zcu); + const src_int_info: std.lang.Type.Int = if (src_tag == .bool) .{ .signedness = undefined, .bits = 1 } else src_ty.intInfo(zcu); assert(dst_int_info.bits == src_int_info.bits); if (dst_tag != .@"struct" and src_tag != .@"struct" and src_tag != .bool and dst_int_info.signedness == src_int_info.signedness) { try dst_vi.value.move(isel, ty_op.operand); @@ -4517,7 +4517,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory, .switch_br => { const switch_br = isel.air.unwrapSwitch(air.inst_index); const cond_ty = isel.air.typeOf(switch_br.operand, ip); - const cond_int_info: std.builtin.Type.Int = if (cond_ty.toIntern() == .bool_type) + const cond_int_info: std.lang.Type.Int = if (cond_ty.toIntern() == .bool_type) .{ .signedness = .unsigned, .bits = 1 } else if (cond_ty.isAbiInt(zcu)) cond_ty.intInfo(zcu) @@ -8229,7 +8229,7 @@ fn elemPtr( fn clzLimb( isel: *Select, res_ra: Register.Alias, - src_int_info: std.builtin.Type.Int, + src_int_info: std.lang.Type.Int, src_ra: Register.Alias, ) !void { switch (src_int_info.bits) { @@ -8274,7 +8274,7 @@ fn clzLimb( fn ctzLimb( isel: *Select, res_ra: Register.Alias, - src_int_info: std.builtin.Type.Int, + src_int_info: std.lang.Type.Int, src_ra: Register.Alias, ) !void { switch (src_int_info.bits) { @@ -8319,7 +8319,7 @@ fn cmp( var lhs_vi = orig_lhs_vi; var rhs_vi = orig_rhs_vi; if (!ty.isRuntimeFloat()) { - const int_info: std.builtin.Type.Int = if (ty.toIntern() == .bool_type) + const int_info: std.lang.Type.Int = if (ty.toIntern() == .bool_type) .{ .signedness = .unsigned, .bits = 1 } else if (ty.isAbiInt(isel.pt.zcu)) ty.intInfo(isel.pt.zcu) @@ -8523,7 +8523,7 @@ fn loadReg( isel: *Select, ra: Register.Alias, size: u64, - signedness: std.builtin.Signedness, + signedness: std.lang.Signedness, base_ra: Register.Alias, offset: i65, ) !void { @@ -8908,7 +8908,7 @@ pub const Value = struct { }, small: struct { size: u5, - signedness: std.builtin.Signedness, + signedness: std.lang.Signedness, is_vector: bool, hint: Register.Alias, register: Register.Alias, @@ -9037,13 +9037,13 @@ pub const Value = struct { }; } - fn setSignedness(vi: Value.Index, isel: *Select, new_signedness: std.builtin.Signedness) void { + fn setSignedness(vi: Value.Index, isel: *Select, new_signedness: std.lang.Signedness) void { const value = vi.get(isel); assert(value.location_payload.small.size <= 2); value.location_payload.small.signedness = new_signedness; } - pub fn signedness(vi: Value.Index, isel: *Select) std.builtin.Signedness { + pub fn signedness(vi: Value.Index, isel: *Select) std.lang.Signedness { const value = vi.get(isel); return switch (value.flags.location_tag) { .large => .unsigned, @@ -9505,7 +9505,7 @@ pub const Value = struct { offset: u64 = 0, @"volatile": bool = false, split: bool = true, - wrap: ?std.builtin.Type.Int = null, + wrap: ?std.lang.Type.Int = null, expected_live_registers: *const LiveRegisters = &.initFill(.free), }; @@ -9717,7 +9717,7 @@ pub const Value = struct { root_ty: ZigType, opts: struct { root_vi: Value.Index = .free, - wrap: ?std.builtin.Type.Int = null, + wrap: ?std.lang.Type.Int = null, expected_live_registers: *const LiveRegisters = &.initFill(.free), }, ) !?void { @@ -10289,7 +10289,7 @@ pub const Value = struct { const payload_ty: ZigType = .fromInterned(error_union_type.payload_type); const error_set_offset = codegen.errUnionErrorOffset(payload_ty, zcu); const payload_offset = codegen.errUnionPayloadOffset(payload_ty, zcu); - const Part = struct { offset: u64, size: u64, signedness: ?std.builtin.Signedness, is_vector: bool }; + const Part = struct { offset: u64, size: u64, signedness: ?std.lang.Signedness, is_vector: bool }; var parts: [2]Part = undefined; var parts_len: Value.PartsLen = 0; var field_end: u64 = 0; @@ -10393,7 +10393,7 @@ pub const Value = struct { (std.math.divCeil(u64, size, @as(u64, 1) << min_part_log2_stride) catch unreachable) > Value.max_parts) return isel.fail("Value.FieldPartIterator.next({f})", .{isel.fmtType(ty)}); const alignment = vi.alignment(isel); - const Part = struct { offset: u64, size: u64, signedness: ?std.builtin.Signedness, is_vector: bool }; + const Part = struct { offset: u64, size: u64, signedness: ?std.lang.Signedness, is_vector: bool }; var parts: [Value.max_parts]Part = undefined; var parts_len: Value.PartsLen = 0; var field_end: u64 = 0; @@ -10512,7 +10512,7 @@ pub const Value = struct { const alignment = vi.alignment(isel); const tag_offset = union_layout.tagOffset(); const payload_offset = union_layout.payloadOffset(); - const Part = struct { offset: u64, size: u64, signedness: ?std.builtin.Signedness }; + const Part = struct { offset: u64, size: u64, signedness: ?std.lang.Signedness }; var parts: [2]Part = undefined; var parts_len: Value.PartsLen = 0; var field_end: u64 = 0; diff --git a/src/codegen/aarch64/encoding.zig b/src/codegen/aarch64/encoding.zig index 9dbd4ddc7cf9caecb51e42d89f68a28e8123e066..1a9c9a2dc7ae69bd490a132b6d701f52a2d3f1d1 100644 --- a/src/codegen/aarch64/encoding.zig +++ b/src/codegen/aarch64/encoding.zig @@ -6755,7 +6755,7 @@ pub const Instruction = packed union { o0: AddSubtractOp = .add, Rm: Register.Encoded, op21: u2 = 0b01, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, decoded24: u5 = 0b11011, op54: u2 = 0b00, sf: Register.GeneralSize = .doubleword, @@ -6769,7 +6769,7 @@ pub const Instruction = packed union { o0: AddSubtractOp = .sub, Rm: Register.Encoded, op21: u2 = 0b01, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, decoded24: u5 = 0b11011, op54: u2 = 0b00, sf: Register.GeneralSize = .doubleword, @@ -6783,7 +6783,7 @@ pub const Instruction = packed union { o0: AddSubtractOp = .add, Rm: Register.Encoded, op21: u2 = 0b10, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, decoded24: u5 = 0b11011, op54: u2 = 0b00, sf: Register.GeneralSize = .doubleword, @@ -6797,7 +6797,7 @@ pub const Instruction = packed union { o0: AddSubtractOp = .add, Rm: Register.Encoded, op21: u2 = 0b01, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, decoded24: u5 = 0b11011, op54: u2 = 0b00, sf: Register.GeneralSize = .doubleword, @@ -6811,7 +6811,7 @@ pub const Instruction = packed union { o0: AddSubtractOp = .sub, Rm: Register.Encoded, op21: u2 = 0b01, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, decoded24: u5 = 0b11011, op54: u2 = 0b00, sf: Register.GeneralSize = .doubleword, @@ -6825,7 +6825,7 @@ pub const Instruction = packed union { o0: AddSubtractOp = .add, Rm: Register.Encoded, op21: u2 = 0b10, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, decoded24: u5 = 0b11011, op54: u2 = 0b00, sf: Register.GeneralSize = .doubleword, @@ -7052,7 +7052,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, a: u1, decoded24: u5 = 0b11110, - U: std.builtin.Signedness, + U: std.lang.Signedness, decoded30: u2 = 0b01, }; @@ -7065,7 +7065,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b0, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, decoded30: u2 = 0b01, }; @@ -7078,7 +7078,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b0, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, decoded30: u2 = 0b01, }; @@ -7091,7 +7091,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b0, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, decoded30: u2 = 0b01, }; @@ -7104,7 +7104,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b0, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, decoded30: u2 = 0b01, }; @@ -7117,7 +7117,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b1, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, decoded30: u2 = 0b01, }; @@ -7130,7 +7130,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b1, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, decoded30: u2 = 0b01, }; @@ -7143,7 +7143,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b1, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, decoded30: u2 = 0b01, }; @@ -7156,7 +7156,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b1, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, decoded30: u2 = 0b01, }; @@ -7169,7 +7169,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b1, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, decoded30: u2 = 0b01, }; @@ -7182,7 +7182,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b1, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, decoded30: u2 = 0b01, }; @@ -7195,7 +7195,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b1, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, decoded30: u2 = 0b01, }; @@ -7208,7 +7208,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b0, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, decoded30: u2 = 0b01, }; @@ -7221,7 +7221,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b0, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, decoded30: u2 = 0b01, }; @@ -7234,7 +7234,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b0, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, decoded30: u2 = 0b01, }; @@ -7247,7 +7247,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b0, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, decoded30: u2 = 0b01, }; @@ -7260,7 +7260,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b1, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, decoded30: u2 = 0b01, }; @@ -7273,7 +7273,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b1, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, decoded30: u2 = 0b01, }; @@ -7286,7 +7286,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b1, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, decoded30: u2 = 0b01, }; @@ -7299,7 +7299,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b1, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, decoded30: u2 = 0b01, }; @@ -7312,7 +7312,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b1, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, decoded30: u2 = 0b01, }; @@ -7428,7 +7428,7 @@ pub const Instruction = packed union { decoded17: u5 = 0b10000, size: Size, decoded24: u5 = 0b11110, - U: std.builtin.Signedness, + U: std.lang.Signedness, decoded30: u2 = 0b01, }; @@ -7441,7 +7441,7 @@ pub const Instruction = packed union { decoded17: u5 = 0b10000, size: Size, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, decoded30: u2 = 0b01, }; @@ -7454,7 +7454,7 @@ pub const Instruction = packed union { decoded17: u5 = 0b10000, size: Size, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, decoded30: u2 = 0b01, }; @@ -7467,7 +7467,7 @@ pub const Instruction = packed union { decoded17: u5 = 0b10000, size: Size, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, decoded30: u2 = 0b01, }; @@ -7480,7 +7480,7 @@ pub const Instruction = packed union { decoded17: u5 = 0b10000, size: Size, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, decoded30: u2 = 0b01, }; @@ -7493,7 +7493,7 @@ pub const Instruction = packed union { decoded17: u5 = 0b10000, size: Size, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, decoded30: u2 = 0b01, }; @@ -7506,7 +7506,7 @@ pub const Instruction = packed union { decoded17: u5 = 0b10000, size: Size, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, decoded30: u2 = 0b01, }; @@ -7519,7 +7519,7 @@ pub const Instruction = packed union { decoded17: u5 = 0b10000, size: Size, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, decoded30: u2 = 0b01, }; @@ -7533,7 +7533,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b0, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, decoded30: u2 = 0b01, }; @@ -7547,7 +7547,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b0, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, decoded30: u2 = 0b01, }; @@ -7561,7 +7561,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b0, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, decoded30: u2 = 0b01, }; @@ -7575,7 +7575,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b0, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, decoded30: u2 = 0b01, }; @@ -7589,7 +7589,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b1, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, decoded30: u2 = 0b01, }; @@ -7603,7 +7603,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b1, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, decoded30: u2 = 0b01, }; @@ -7617,7 +7617,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b1, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, decoded30: u2 = 0b01, }; @@ -7631,7 +7631,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b1, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, decoded30: u2 = 0b01, }; @@ -7645,7 +7645,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b1, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, decoded30: u2 = 0b01, }; @@ -7659,7 +7659,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b1, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, decoded30: u2 = 0b01, }; @@ -7673,7 +7673,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b1, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, decoded30: u2 = 0b01, }; @@ -7686,7 +7686,7 @@ pub const Instruction = packed union { decoded17: u5 = 0b10000, size: Size, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, decoded30: u2 = 0b01, }; @@ -7699,7 +7699,7 @@ pub const Instruction = packed union { decoded17: u5 = 0b10000, size: Size, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, decoded30: u2 = 0b01, }; @@ -7712,7 +7712,7 @@ pub const Instruction = packed union { decoded17: u5 = 0b10000, size: Size, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, decoded30: u2 = 0b01, }; @@ -7725,7 +7725,7 @@ pub const Instruction = packed union { decoded17: u5 = 0b10000, size: Size, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, decoded30: u2 = 0b01, }; @@ -7738,7 +7738,7 @@ pub const Instruction = packed union { decoded17: u5 = 0b10000, size: Size, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, decoded30: u2 = 0b01, }; @@ -7751,7 +7751,7 @@ pub const Instruction = packed union { decoded17: u5 = 0b10000, size: Size, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, decoded30: u2 = 0b01, }; @@ -7764,7 +7764,7 @@ pub const Instruction = packed union { decoded17: u5 = 0b10000, size: Size, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, decoded30: u2 = 0b01, }; @@ -7778,7 +7778,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b0, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, decoded30: u2 = 0b01, }; @@ -7792,7 +7792,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b0, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, decoded30: u2 = 0b01, }; @@ -7806,7 +7806,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b0, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, decoded30: u2 = 0b01, }; @@ -7820,7 +7820,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b0, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, decoded30: u2 = 0b01, }; @@ -7834,7 +7834,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b0, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, decoded30: u2 = 0b01, }; @@ -7848,7 +7848,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b1, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, decoded30: u2 = 0b01, }; @@ -7862,7 +7862,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b1, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, decoded30: u2 = 0b01, }; @@ -7876,7 +7876,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b1, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, decoded30: u2 = 0b01, }; @@ -7890,7 +7890,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b1, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, decoded30: u2 = 0b01, }; @@ -7904,7 +7904,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b1, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, decoded30: u2 = 0b01, }; @@ -8045,7 +8045,7 @@ pub const Instruction = packed union { decoded17: u5 = 0b11000, size: Size, decoded24: u5 = 0b11110, - U: std.builtin.Signedness, + U: std.lang.Signedness, decoded30: u2 = 0b01, }; @@ -8058,7 +8058,7 @@ pub const Instruction = packed union { decoded17: u5 = 0b11000, size: Size, decoded24: u5 = 0b11110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, decoded30: u2 = 0b01, }; @@ -8262,7 +8262,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, a: u1, decoded24: u5 = 0b01110, - U: std.builtin.Signedness, + U: std.lang.Signedness, Q: Q, decoded31: u1 = 0b0, }; @@ -8276,7 +8276,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b0, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, Q: Q, decoded31: u1 = 0b0, }; @@ -8290,7 +8290,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b0, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, Q: Q, decoded31: u1 = 0b0, }; @@ -8304,7 +8304,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b0, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, Q: Q, decoded31: u1 = 0b0, }; @@ -8318,7 +8318,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b0, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, Q: Q, decoded31: u1 = 0b0, }; @@ -8332,7 +8332,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b0, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, Q: Q, decoded31: u1 = 0b0, }; @@ -8346,7 +8346,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b0, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, Q: Q, decoded31: u1 = 0b0, }; @@ -8360,7 +8360,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b1, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, Q: Q, decoded31: u1 = 0b0, }; @@ -8374,7 +8374,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b1, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, Q: Q, decoded31: u1 = 0b0, }; @@ -8388,7 +8388,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b1, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, Q: Q, decoded31: u1 = 0b0, }; @@ -8402,7 +8402,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b1, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, Q: Q, decoded31: u1 = 0b0, }; @@ -8416,7 +8416,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b1, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, Q: Q, decoded31: u1 = 0b0, }; @@ -8430,7 +8430,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b1, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, Q: Q, decoded31: u1 = 0b0, }; @@ -8444,7 +8444,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b1, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, Q: Q, decoded31: u1 = 0b0, }; @@ -8458,7 +8458,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b1, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, Q: Q, decoded31: u1 = 0b0, }; @@ -8472,7 +8472,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b1, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, Q: Q, decoded31: u1 = 0b0, }; @@ -8486,7 +8486,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b0, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, Q: Q, decoded31: u1 = 0b0, }; @@ -8500,7 +8500,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b0, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, Q: Q, decoded31: u1 = 0b0, }; @@ -8514,7 +8514,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b0, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, Q: Q, decoded31: u1 = 0b0, }; @@ -8528,7 +8528,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b0, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, Q: Q, decoded31: u1 = 0b0, }; @@ -8542,7 +8542,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b0, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, Q: Q, decoded31: u1 = 0b0, }; @@ -8556,7 +8556,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b0, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, Q: Q, decoded31: u1 = 0b0, }; @@ -8570,7 +8570,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b1, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, Q: Q, decoded31: u1 = 0b0, }; @@ -8584,7 +8584,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b1, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, Q: Q, decoded31: u1 = 0b0, }; @@ -8598,7 +8598,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b1, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, Q: Q, decoded31: u1 = 0b0, }; @@ -8612,7 +8612,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b1, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, Q: Q, decoded31: u1 = 0b0, }; @@ -8626,7 +8626,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b1, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, Q: Q, decoded31: u1 = 0b0, }; @@ -8640,7 +8640,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b1, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, Q: Q, decoded31: u1 = 0b0, }; @@ -8654,7 +8654,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b1, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, Q: Q, decoded31: u1 = 0b0, }; @@ -8668,7 +8668,7 @@ pub const Instruction = packed union { decoded17: u6 = 0b111100, o2: u1 = 0b1, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, Q: Q, decoded31: u1 = 0b0, }; @@ -8814,7 +8814,7 @@ pub const Instruction = packed union { decoded17: u5 = 0b10000, size: Size, decoded24: u5 = 0b01110, - U: std.builtin.Signedness, + U: std.lang.Signedness, Q: Q, decoded31: u1 = 0b0, }; @@ -8828,7 +8828,7 @@ pub const Instruction = packed union { decoded17: u5 = 0b10000, size: Size, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, Q: Q, decoded31: u1 = 0b0, }; @@ -8842,7 +8842,7 @@ pub const Instruction = packed union { decoded17: u5 = 0b10000, size: Size, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, Q: Q, decoded31: u1 = 0b0, }; @@ -8856,7 +8856,7 @@ pub const Instruction = packed union { decoded17: u5 = 0b10000, size: Size, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, Q: Q, decoded31: u1 = 0b0, }; @@ -8870,7 +8870,7 @@ pub const Instruction = packed union { decoded17: u5 = 0b10000, size: Size, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, Q: Q, decoded31: u1 = 0b0, }; @@ -8884,7 +8884,7 @@ pub const Instruction = packed union { decoded17: u5 = 0b10000, size: Size, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, Q: Q, decoded31: u1 = 0b0, }; @@ -8898,7 +8898,7 @@ pub const Instruction = packed union { decoded17: u5 = 0b10000, size: Size, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, Q: Q, decoded31: u1 = 0b0, }; @@ -8912,7 +8912,7 @@ pub const Instruction = packed union { decoded17: u5 = 0b10000, size: Size, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, Q: Q, decoded31: u1 = 0b0, }; @@ -8926,7 +8926,7 @@ pub const Instruction = packed union { decoded17: u5 = 0b10000, size: Size, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, Q: Q, decoded31: u1 = 0b0, }; @@ -8941,7 +8941,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b0, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, Q: Q, decoded31: u1 = 0b0, }; @@ -8956,7 +8956,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b0, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, Q: Q, decoded31: u1 = 0b0, }; @@ -8971,7 +8971,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b0, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, Q: Q, decoded31: u1 = 0b0, }; @@ -8986,7 +8986,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b0, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, Q: Q, decoded31: u1 = 0b0, }; @@ -9001,7 +9001,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b0, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, Q: Q, decoded31: u1 = 0b0, }; @@ -9016,7 +9016,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b0, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, Q: Q, decoded31: u1 = 0b0, }; @@ -9031,7 +9031,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b1, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, Q: Q, decoded31: u1 = 0b0, }; @@ -9046,7 +9046,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b1, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, Q: Q, decoded31: u1 = 0b0, }; @@ -9061,7 +9061,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b1, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, Q: Q, decoded31: u1 = 0b0, }; @@ -9076,7 +9076,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b1, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, Q: Q, decoded31: u1 = 0b0, }; @@ -9091,7 +9091,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b1, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, Q: Q, decoded31: u1 = 0b0, }; @@ -9106,7 +9106,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b1, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, Q: Q, decoded31: u1 = 0b0, }; @@ -9121,7 +9121,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b1, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, Q: Q, decoded31: u1 = 0b0, }; @@ -9136,7 +9136,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b1, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, Q: Q, decoded31: u1 = 0b0, }; @@ -9151,7 +9151,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b1, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, Q: Q, decoded31: u1 = 0b0, }; @@ -9165,7 +9165,7 @@ pub const Instruction = packed union { decoded17: u5 = 0b10000, size: Size, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, Q: Q, decoded31: u1 = 0b0, }; @@ -9179,7 +9179,7 @@ pub const Instruction = packed union { decoded17: u5 = 0b10000, size: Size, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, Q: Q, decoded31: u1 = 0b0, }; @@ -9193,7 +9193,7 @@ pub const Instruction = packed union { decoded17: u5 = 0b10000, size: Size, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, Q: Q, decoded31: u1 = 0b0, }; @@ -9207,7 +9207,7 @@ pub const Instruction = packed union { decoded17: u5 = 0b10000, size: Size, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, Q: Q, decoded31: u1 = 0b0, }; @@ -9221,7 +9221,7 @@ pub const Instruction = packed union { decoded17: u5 = 0b10000, size: Size, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, Q: Q, decoded31: u1 = 0b0, }; @@ -9235,7 +9235,7 @@ pub const Instruction = packed union { decoded17: u5 = 0b10000, size: Size, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, Q: Q, decoded31: u1 = 0b0, }; @@ -9249,7 +9249,7 @@ pub const Instruction = packed union { decoded17: u5 = 0b10000, size: Size, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, Q: Q, decoded31: u1 = 0b0, }; @@ -9264,7 +9264,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b0, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, Q: Q, decoded31: u1 = 0b0, }; @@ -9279,7 +9279,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b0, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, Q: Q, decoded31: u1 = 0b0, }; @@ -9294,7 +9294,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b0, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, Q: Q, decoded31: u1 = 0b0, }; @@ -9309,7 +9309,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b0, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, Q: Q, decoded31: u1 = 0b0, }; @@ -9324,7 +9324,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b0, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, Q: Q, decoded31: u1 = 0b0, }; @@ -9339,7 +9339,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b0, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, Q: Q, decoded31: u1 = 0b0, }; @@ -9354,7 +9354,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b0, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, Q: Q, decoded31: u1 = 0b0, }; @@ -9368,7 +9368,7 @@ pub const Instruction = packed union { decoded17: u5 = 0b10000, size: Size = .byte, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, Q: Q, decoded31: u1 = 0b0, }; @@ -9383,7 +9383,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b1, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, Q: Q, decoded31: u1 = 0b0, }; @@ -9398,7 +9398,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b1, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, Q: Q, decoded31: u1 = 0b0, }; @@ -9413,7 +9413,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b1, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, Q: Q, decoded31: u1 = 0b0, }; @@ -9428,7 +9428,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b1, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, Q: Q, decoded31: u1 = 0b0, }; @@ -9443,7 +9443,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b1, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, Q: Q, decoded31: u1 = 0b0, }; @@ -9458,7 +9458,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b1, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, Q: Q, decoded31: u1 = 0b0, }; @@ -9473,7 +9473,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b1, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, Q: Q, decoded31: u1 = 0b0, }; @@ -9488,7 +9488,7 @@ pub const Instruction = packed union { sz: Sz, o2: u1 = 0b1, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, Q: Q, decoded31: u1 = 0b0, }; @@ -9670,7 +9670,7 @@ pub const Instruction = packed union { decoded17: u5 = 0b11000, size: Size, decoded24: u5 = 0b01110, - U: std.builtin.Signedness, + U: std.lang.Signedness, Q: Q, decoded31: u1 = 0b0, }; @@ -9684,7 +9684,7 @@ pub const Instruction = packed union { decoded17: u5 = 0b11000, size: Size, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, Q: Q, decoded31: u1 = 0b0, }; @@ -9726,7 +9726,7 @@ pub const Instruction = packed union { decoded21: u1 = 0b1, size: Size, decoded24: u5 = 0b01110, - U: std.builtin.Signedness, + U: std.lang.Signedness, Q: Q, decoded31: u1 = 0b0, }; @@ -9741,7 +9741,7 @@ pub const Instruction = packed union { decoded21: u1 = 0b1, size: Size, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, Q: Q, decoded31: u1 = 0b0, }; @@ -9756,7 +9756,7 @@ pub const Instruction = packed union { decoded21: u1 = 0b1, size: Size = .byte, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, Q: Q, decoded31: u1 = 0b0, }; @@ -9771,7 +9771,7 @@ pub const Instruction = packed union { decoded21: u1 = 0b1, size: Size = .half, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, Q: Q, decoded31: u1 = 0b0, }; @@ -9786,7 +9786,7 @@ pub const Instruction = packed union { decoded21: u1 = 0b1, size: Size = .single, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, Q: Q, decoded31: u1 = 0b0, }; @@ -9801,7 +9801,7 @@ pub const Instruction = packed union { decoded21: u1 = 0b1, size: Size = .double, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .signed, + U: std.lang.Signedness = .signed, Q: Q, decoded31: u1 = 0b0, }; @@ -9816,7 +9816,7 @@ pub const Instruction = packed union { decoded21: u1 = 0b1, size: Size = .byte, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, Q: Q, decoded31: u1 = 0b0, }; @@ -9831,7 +9831,7 @@ pub const Instruction = packed union { decoded21: u1 = 0b1, size: Size = .half, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, Q: Q, decoded31: u1 = 0b0, }; @@ -9846,7 +9846,7 @@ pub const Instruction = packed union { decoded21: u1 = 0b1, size: Size = .single, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, Q: Q, decoded31: u1 = 0b0, }; @@ -9861,7 +9861,7 @@ pub const Instruction = packed union { decoded21: u1 = 0b1, size: Size = .double, decoded24: u5 = 0b01110, - U: std.builtin.Signedness = .unsigned, + U: std.lang.Signedness = .unsigned, Q: Q, decoded31: u1 = 0b0, }; diff --git a/src/codegen/c.zig b/src/codegen/c.zig index 4eec8b49a0ae6349208e84ee7fa6809b73520745..8da78030aca211b5001342bb702d260f54d4f3ab 100644 --- a/src/codegen/c.zig +++ b/src/codegen/c.zig @@ -1997,7 +1997,7 @@ pub const DeclGen = struct { .bits => {}, } - const int_info: std.builtin.Type.Int = if (ty.isAbiInt(zcu)) ty.intInfo(zcu) else .{ + const int_info: std.lang.Type.Int = if (ty.isAbiInt(zcu)) ty.intInfo(zcu) else .{ .signedness = .unsigned, .bits = @intCast(ty.bitSize(zcu)), }; @@ -3878,7 +3878,7 @@ fn airSlice(f: *Function, inst: Air.Inst.Index) !CValue { fn airCall( f: *Function, inst: Air.Inst.Index, - modifier: std.builtin.CallModifier, + modifier: std.lang.CallModifier, ) !CValue { const pt = f.dg.pt; const zcu = pt.zcu; @@ -6911,7 +6911,7 @@ fn airCVaCopy(f: *Function, inst: Air.Inst.Index) !CValue { return local; } -fn toMemoryOrder(order: std.builtin.AtomicOrder) [:0]const u8 { +fn toMemoryOrder(order: std.lang.AtomicOrder) [:0]const u8 { return switch (order) { // Note: unordered is actually even less atomic than relaxed .unordered, .monotonic => "zig_memory_order_relaxed", @@ -6922,11 +6922,11 @@ fn toMemoryOrder(order: std.builtin.AtomicOrder) [:0]const u8 { }; } -fn writeMemoryOrder(w: *Writer, order: std.builtin.AtomicOrder) !void { +fn writeMemoryOrder(w: *Writer, order: std.lang.AtomicOrder) !void { return w.writeAll(toMemoryOrder(order)); } -fn toCallingConvention(cc: std.builtin.CallingConvention, zcu: *Zcu) ?[]const u8 { +fn toCallingConvention(cc: std.lang.CallingConvention, zcu: *Zcu) ?[]const u8 { if (zcu.getTarget().cCallingConvention()) |ccc| { if (cc.eql(ccc)) { return null; @@ -7021,7 +7021,7 @@ fn toCallingConvention(cc: std.builtin.CallingConvention, zcu: *Zcu) ?[]const u8 }; } -fn toAtomicRmwSuffix(order: std.builtin.AtomicRmwOp) []const u8 { +fn toAtomicRmwSuffix(order: std.lang.AtomicRmwOp) []const u8 { return switch (order) { .Xchg => "xchg", .Add => "add", @@ -7044,7 +7044,7 @@ fn toCIntBits(zig_bits: u32) ?u32 { return null; } -fn signAbbrev(signedness: std.builtin.Signedness) u8 { +fn signAbbrev(signedness: std.lang.Signedness) u8 { return switch (signedness) { .signed => 'i', .unsigned => 'u', diff --git a/src/codegen/c/type.zig b/src/codegen/c/type.zig index 9fc5b9475c8db4616260dc31b01c0620c3c5ae39..c800605168e7481d109a7cd194911e7cbf937ba5 100644 --- a/src/codegen/c/type.zig +++ b/src/codegen/c/type.zig @@ -512,7 +512,7 @@ pub const CType = union(enum) { }, } } - fn classifyBitInt(signedness: std.builtin.Signedness, bits: u16, zcu: *const Zcu) IntClass { + fn classifyBitInt(signedness: std.lang.Signedness, bits: u16, zcu: *const Zcu) IntClass { const is_ez80 = zcu.getTarget().cpu.arch == .ez80; return switch (bits) { 0 => .void, diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index eeac3e09d9b5c80aed5f9bbfbb736e8b8dde15db..73790b5ea56a5dad5c2218f6675c26897be3d436 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -500,7 +500,7 @@ const CodeModel = enum { large, }; -fn codeModel(model: std.builtin.CodeModel, target: *const std.Target) CodeModel { +fn codeModel(model: std.lang.CodeModel, target: *const std.Target) CodeModel { // Roughly match Clang's mapping of GCC code models to LLVM code models. return switch (model) { .default => .default, @@ -556,7 +556,7 @@ pub const Object = struct { /// Same as `nav_map` but for UAVs (which are always global constants). uav_map: std.AutoHashMapUnmanaged(struct { val: InternPool.Index, - @"addrspace": std.builtin.AddressSpace, + @"addrspace": std.lang.AddressSpace, }, Builder.Variable.Index), /// Maps enum types to their corresponding LLVM functions for implementing the `tag_name` instruction. enum_tag_name_map: std.AutoHashMapUnmanaged(InternPool.Index, Builder.Function.Index), @@ -3986,7 +3986,7 @@ pub const Object = struct { o: *Object, /// Must not be `.none`. @"align": InternPool.Alignment, - @"addrspace": std.builtin.AddressSpace, + @"addrspace": std.lang.AddressSpace, ) Allocator.Error!Builder.Constant { const addr: u64 = @"align".toByteUnits().?; const llvm_usize = try o.lowerType(.usize); @@ -4000,7 +4000,7 @@ pub const Object = struct { uav_val: InternPool.Index, /// Must not be `.none`. @"align": InternPool.Alignment, - @"addrspace": std.builtin.AddressSpace, + @"addrspace": std.lang.AddressSpace, ) Allocator.Error!Builder.Constant { assert(@"align" != .none); @@ -4383,20 +4383,20 @@ const CallingConventionInfo = struct { inreg_param_count: u2 = 0, }; -pub fn toLlvmCallConv(cc: std.builtin.CallingConvention, target: *const std.Target) ?CallingConventionInfo { +pub fn toLlvmCallConv(cc: std.lang.CallingConvention, target: *const std.Target) ?CallingConventionInfo { const llvm_cc = toLlvmCallConvTag(cc, target) orelse return null; const incoming_stack_alignment: ?u64, const register_params: u2 = switch (cc) { inline else => |pl| switch (@TypeOf(pl)) { void => .{ null, 0 }, - std.builtin.CallingConvention.ArcInterruptOptions, - std.builtin.CallingConvention.ArmInterruptOptions, - std.builtin.CallingConvention.RiscvInterruptOptions, - std.builtin.CallingConvention.ShInterruptOptions, - std.builtin.CallingConvention.MicroblazeInterruptOptions, - std.builtin.CallingConvention.MipsInterruptOptions, - std.builtin.CallingConvention.CommonOptions, + std.lang.CallingConvention.ArcInterruptOptions, + std.lang.CallingConvention.ArmInterruptOptions, + std.lang.CallingConvention.RiscvInterruptOptions, + std.lang.CallingConvention.ShInterruptOptions, + std.lang.CallingConvention.MicroblazeInterruptOptions, + std.lang.CallingConvention.MipsInterruptOptions, + std.lang.CallingConvention.CommonOptions, => .{ pl.incoming_stack_alignment, 0 }, - std.builtin.CallingConvention.X86RegparmOptions => .{ pl.incoming_stack_alignment, pl.register_params }, + std.lang.CallingConvention.X86RegparmOptions => .{ pl.incoming_stack_alignment, pl.register_params }, else => @compileError("TODO: toLlvmCallConv" ++ @tagName(pl)), }, }; @@ -4410,7 +4410,7 @@ pub fn toLlvmCallConv(cc: std.builtin.CallingConvention, target: *const std.Targ .inreg_param_count = register_params, }; } -pub fn toLlvmCallConvTag(cc_tag: std.builtin.CallingConvention.Tag, target: *const std.Target) ?Builder.CallConv { +pub fn toLlvmCallConvTag(cc_tag: std.lang.CallingConvention.Tag, target: *const std.Target) ?Builder.CallConv { if (target.cCallingConvention()) |default_c| { if (cc_tag == default_c) { return .ccc; @@ -4543,13 +4543,13 @@ pub fn toLlvmCallConvTag(cc_tag: std.builtin.CallingConvention.Tag, target: *con } /// Convert a zig-address space to an llvm address space. -pub fn toLlvmAddressSpace(address_space: std.builtin.AddressSpace, target: *const std.Target) Builder.AddrSpace { +pub fn toLlvmAddressSpace(address_space: std.lang.AddressSpace, target: *const std.Target) Builder.AddrSpace { for (llvmAddrSpaceInfo(target)) |info| if (info.zig == address_space) return info.llvm; unreachable; } const AddrSpaceInfo = struct { - zig: ?std.builtin.AddressSpace, + zig: ?std.lang.AddressSpace, llvm: Builder.AddrSpace, non_integral: bool = false, size: ?u16 = null, @@ -4643,7 +4643,7 @@ fn llvmDefaultGlobalAddressSpace(target: *const std.Target) Builder.AddrSpace { /// Return the actual address space that a value should be stored in if its a global address space. /// When a value is placed in the resulting address space, it needs to be cast back into wanted_address_space. -fn toLlvmGlobalAddressSpace(wanted_address_space: std.builtin.AddressSpace, target: *const std.Target) Builder.AddrSpace { +fn toLlvmGlobalAddressSpace(wanted_address_space: std.lang.AddressSpace, target: *const std.Target) Builder.AddrSpace { return switch (wanted_address_space) { .generic => llvmDefaultGlobalAddressSpace(target), else => |as| toLlvmAddressSpace(as, target), diff --git a/src/codegen/llvm/FuncGen.zig b/src/codegen/llvm/FuncGen.zig index e7683ab95ee080c6c80e47d29950877d79793829..8c987d65e68f190a63558ffcb3d39d43445b9141 100644 --- a/src/codegen/llvm/FuncGen.zig +++ b/src/codegen/llvm/FuncGen.zig @@ -567,7 +567,7 @@ const CallAttr = enum { AlwaysInline, }; -fn airCall(self: *FuncGen, inst: Air.Inst.Index, modifier: std.builtin.CallModifier) Allocator.Error!Builder.Value { +fn airCall(self: *FuncGen, inst: Air.Inst.Index, modifier: std.lang.CallModifier) Allocator.Error!Builder.Value { const air_call = self.air.unwrapCall(inst); const args = air_call.args; const o = self.object; @@ -6017,14 +6017,14 @@ fn airPrefetch(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Val const o = self.object; const prefetch = self.air.instructions.items(.data)[@intFromEnum(inst)].prefetch; - comptime assert(@intFromEnum(std.builtin.PrefetchOptions.Rw.read) == 0); - comptime assert(@intFromEnum(std.builtin.PrefetchOptions.Rw.write) == 1); + comptime assert(@intFromEnum(std.lang.PrefetchOptions.Rw.read) == 0); + comptime assert(@intFromEnum(std.lang.PrefetchOptions.Rw.write) == 1); comptime assert(prefetch.locality >= 0); comptime assert(prefetch.locality <= 3); - comptime assert(@intFromEnum(std.builtin.PrefetchOptions.Cache.instruction) == 0); - comptime assert(@intFromEnum(std.builtin.PrefetchOptions.Cache.data) == 1); + comptime assert(@intFromEnum(std.lang.PrefetchOptions.Cache.instruction) == 0); + comptime assert(@intFromEnum(std.lang.PrefetchOptions.Cache.data) == 1); // LLVM fails during codegen of instruction cache prefetchs for these architectures. // This is an LLVM bug as the prefetch intrinsic should be a noop if not supported @@ -7106,7 +7106,7 @@ fn lowerSystemVFnRetTy(o: *Object, fn_info: InternPool.Key.FuncType) Allocator.E /// has different ABI than regular integer types, and there is no currently no /// way to determine whether a Zig integer type is meant to represent e.g. `int` /// or `_BitInt(32)`. -pub fn ccAbiPromoteInt(cc: std.builtin.CallingConvention, zcu: *Zcu, ty: Type) ?std.builtin.Signedness { +pub fn ccAbiPromoteInt(cc: std.lang.CallingConvention, zcu: *Zcu, ty: Type) ?std.lang.Signedness { switch (cc) { .auto, .@"inline", .async => return null, else => {}, @@ -7379,7 +7379,7 @@ fn intrinsicsAllowed(scalar_ty: Type, target: *const std.Target) bool { }; } -fn toLlvmAtomicOrdering(atomic_order: std.builtin.AtomicOrder) Builder.AtomicOrdering { +fn toLlvmAtomicOrdering(atomic_order: std.lang.AtomicOrder) Builder.AtomicOrdering { return switch (atomic_order) { .unordered => .unordered, .monotonic => .monotonic, @@ -7391,7 +7391,7 @@ fn toLlvmAtomicOrdering(atomic_order: std.builtin.AtomicOrder) Builder.AtomicOrd } fn toLlvmAtomicRmwBinOp( - op: std.builtin.AtomicRmwOp, + op: std.lang.AtomicRmwOp, is_signed: bool, is_float: bool, ) Builder.Function.Instruction.AtomicRmw.Operation { diff --git a/src/codegen/riscv64/CodeGen.zig b/src/codegen/riscv64/CodeGen.zig index f4aed08dbf986c78bef647534662203ef57c6a10..54e57868c196ed830275e92122899d00e713fa5f 100644 --- a/src/codegen/riscv64/CodeGen.zig +++ b/src/codegen/riscv64/CodeGen.zig @@ -1901,7 +1901,7 @@ fn splitType(func: *Func, ty: Type) ![2]Type { fn truncateRegister(func: *Func, ty: Type, reg: Register) !void { const pt = func.pt; const zcu = pt.zcu; - const int_info = if (ty.isAbiInt(zcu)) ty.intInfo(zcu) else std.builtin.Type.Int{ + const int_info = if (ty.isAbiInt(zcu)) ty.intInfo(zcu) else std.lang.Type.Int{ .signedness = .unsigned, .bits = @intCast(ty.bitSize(zcu)), }; @@ -4788,7 +4788,7 @@ fn airFrameAddress(func: *Func, inst: Air.Inst.Index) !void { return func.finishAir(inst, dst_mcv, .{ .none, .none, .none }); } -fn airCall(func: *Func, inst: Air.Inst.Index, modifier: std.builtin.CallModifier) !void { +fn airCall(func: *Func, inst: Air.Inst.Index, modifier: std.lang.CallModifier) !void { if (modifier == .always_tail) return func.fail("TODO implement tail calls for riscv64", .{}); const call = func.air.unwrapCall(inst); const arg_refs = call.args; @@ -7691,7 +7691,7 @@ fn airAtomicLoad(func: *Func, inst: Air.Inst.Index) !void { const pt = func.pt; const zcu = pt.zcu; const atomic_load = func.air.instructions.items(.data)[@intFromEnum(inst)].atomic_load; - const order: std.builtin.AtomicOrder = atomic_load.order; + const order: std.lang.AtomicOrder = atomic_load.order; const ptr_ty = func.typeOf(atomic_load.ptr); const elem_ty = ptr_ty.childType(zcu); @@ -7737,7 +7737,7 @@ fn airAtomicLoad(func: *Func, inst: Air.Inst.Index) !void { return func.finishAir(inst, result_mcv, .{ atomic_load.ptr, .none, .none }); } -fn airAtomicStore(func: *Func, inst: Air.Inst.Index, order: std.builtin.AtomicOrder) !void { +fn airAtomicStore(func: *Func, inst: Air.Inst.Index, order: std.lang.AtomicOrder) !void { const bin_op = func.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; const ptr_ty = func.typeOf(bin_op.lhs); diff --git a/src/codegen/riscv64/Lower.zig b/src/codegen/riscv64/Lower.zig index 08bb3e2b937b448492030a76d5467dec24da9e21..a3de43ad46d00ec6aa4c43015d9e8ff4f4f214b9 100644 --- a/src/codegen/riscv64/Lower.zig +++ b/src/codegen/riscv64/Lower.zig @@ -1,12 +1,12 @@ //! This file contains the functionality for lowering RISC-V MIR to Instructions pt: Zcu.PerThread, -output_mode: std.builtin.OutputMode, -link_mode: std.builtin.LinkMode, +output_mode: std.lang.OutputMode, +link_mode: std.lang.LinkMode, pic: bool, allocator: Allocator, mir: Mir, -cc: std.builtin.CallingConvention, +cc: std.lang.CallingConvention, err_msg: ?*ErrorMsg = null, src_loc: Zcu.LazySrcLoc, result_insts_len: u8 = undefined, diff --git a/src/codegen/sparc64/CodeGen.zig b/src/codegen/sparc64/CodeGen.zig index f523c039f1ed227b09da028719660338516710bb..d36f72bb216614727f912beb03a01a3a550f0a35 100644 --- a/src/codegen/sparc64/CodeGen.zig +++ b/src/codegen/sparc64/CodeGen.zig @@ -20,7 +20,7 @@ const Mir = @import("Mir.zig"); const Emit = @import("Emit.zig"); const Type = @import("../../Type.zig"); const CodeGenError = codegen.CodeGenError; -const Endian = std.builtin.Endian; +const Endian = std.lang.Endian; const Alignment = InternPool.Alignment; const build_options = @import("build_options"); @@ -1255,7 +1255,7 @@ fn airByteSwap(self: *Self, inst: Air.Inst.Index) !void { return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); } -fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier) !void { +fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.lang.CallModifier) !void { if (modifier == .always_tail) return self.fail("TODO implement tail calls for {}", .{self.target.cpu.arch}); const call = self.air.unwrapCall(inst); @@ -4702,7 +4702,7 @@ fn truncRegister( self: *Self, operand_reg: Register, dest_reg: Register, - int_signedness: std.builtin.Signedness, + int_signedness: std.lang.Signedness, int_bits: u16, ) !void { switch (int_bits) { diff --git a/src/codegen/sparc64/Emit.zig b/src/codegen/sparc64/Emit.zig index 9442fc19088c000287f8c03657af82e0cc363b91..1fd9b5c769e258c68dd3c50e994f032a159f5bcc 100644 --- a/src/codegen/sparc64/Emit.zig +++ b/src/codegen/sparc64/Emit.zig @@ -2,7 +2,7 @@ //! machine code const std = @import("std"); -const Endian = std.builtin.Endian; +const Endian = std.lang.Endian; const assert = std.debug.assert; const link = @import("../../link.zig"); const Zcu = @import("../../Zcu.zig"); diff --git a/src/codegen/spirv/Assembler.zig b/src/codegen/spirv/Assembler.zig index 5b19f960a7a4f0d4fe8bf342f4224935b8e8146e..1da075d8dc83e254681aafe9fd26aac80ad082bc 100644 --- a/src/codegen/spirv/Assembler.zig +++ b/src/codegen/spirv/Assembler.zig @@ -212,7 +212,7 @@ fn processTypeInstruction(ass: *Assembler) !AsmValue { .OpTypeVoid => try module.voidType(), .OpTypeBool => try module.boolType(), .OpTypeInt => blk: { - const signedness: std.builtin.Signedness = switch (operands[2].literal32) { + const signedness: std.lang.Signedness = switch (operands[2].literal32) { 0 => .unsigned, 1 => .signed, else => { @@ -766,7 +766,7 @@ fn parseContextDependentNumber(ass: *Assembler) !void { return ass.fail(tok.start, "cannot parse literal constant", .{}); } -fn parseContextDependentInt(ass: *Assembler, signedness: std.builtin.Signedness, width: u32) !void { +fn parseContextDependentInt(ass: *Assembler, signedness: std.lang.Signedness, width: u32) !void { const gpa = ass.cg.module.gpa; const tok = ass.currentToken(); diff --git a/src/codegen/spirv/CodeGen.zig b/src/codegen/spirv/CodeGen.zig index 0069db375bd115046f470b80ab849d7222519150..1b0ff57e698ecbf6fe4b4b8a097c783a5ee40303 100644 --- a/src/codegen/spirv/CodeGen.zig +++ b/src/codegen/spirv/CodeGen.zig @@ -1,7 +1,7 @@ const std = @import("std"); const Allocator = std.mem.Allocator; const Target = std.Target; -const Signedness = std.builtin.Signedness; +const Signedness = std.lang.Signedness; const assert = std.debug.assert; const log = std.log.scoped(.codegen); @@ -569,7 +569,7 @@ const ArithmeticTypeInfo = struct { /// Null if this type is a scalar, or the length of the vector otherwise. vector_len: ?u32, /// Whether the inner type is signed. Only relevant for integers. - signedness: std.builtin.Signedness, + signedness: std.lang.Signedness, }; fn arithmeticTypeInfo(cg: *CodeGen, ty: Type) ArithmeticTypeInfo { @@ -2251,7 +2251,7 @@ fn buildBinary(cg: *CodeGen, opcode: Opcode, lhs: Temporary, rhs: Temporary) !Te /// or OpIMul and s_mul_hi or u_mul_hi on OpenCL. fn buildWideMul( cg: *CodeGen, - signedness: std.builtin.Signedness, + signedness: std.lang.Signedness, lhs: Temporary, rhs: Temporary, ) !struct { Temporary, Temporary } { @@ -5976,7 +5976,7 @@ fn airAssembly(cg: *CodeGen, inst: Air.Inst.Index) !?Id { return null; } -fn airCall(cg: *CodeGen, inst: Air.Inst.Index, modifier: std.builtin.CallModifier) !?Id { +fn airCall(cg: *CodeGen, inst: Air.Inst.Index, modifier: std.lang.CallModifier) !?Id { _ = modifier; const gpa = cg.module.gpa; diff --git a/src/codegen/spirv/Module.zig b/src/codegen/spirv/Module.zig index 7308a2f44119359b80d31068eb631efc19ec30c8..f2fe02873c914723f2cb847470556133df4631b5 100644 --- a/src/codegen/spirv/Module.zig +++ b/src/codegen/spirv/Module.zig @@ -54,8 +54,8 @@ cache: struct { bool_type: ?Id = null, void_type: ?Id = null, opaque_types: std.StringHashMapUnmanaged(Id) = .empty, - int_types: std.AutoHashMapUnmanaged(std.builtin.Type.Int, Id) = .empty, - float_types: std.AutoHashMapUnmanaged(std.builtin.Type.Float, Id) = .empty, + int_types: std.AutoHashMapUnmanaged(std.lang.Type.Int, Id) = .empty, + float_types: std.AutoHashMapUnmanaged(std.lang.Type.Float, Id) = .empty, vector_types: std.AutoHashMapUnmanaged(struct { Id, u32 }, Id) = .empty, array_types: std.AutoHashMapUnmanaged(struct { Id, Id }, Id) = .empty, struct_types: std.ArrayHashMapUnmanaged(StructType, Id, StructType.HashContext, true) = .empty, @@ -582,7 +582,7 @@ pub fn backingIntBits(module: *Module, bits: u16) struct { u16, bool } { return .{ std.mem.alignForward(u16, bits, big_int_bits), true }; } -pub fn intType(module: *Module, signedness: std.builtin.Signedness, bits: u16) !Id { +pub fn intType(module: *Module, signedness: std.lang.Signedness, bits: u16) !Id { assert(bits > 0); const target = module.zcu.getTarget(); @@ -918,7 +918,7 @@ pub fn debugString(module: *Module, string: []const u8) !Id { return entry.value_ptr.*; } -pub fn storageClass(module: *Module, as: std.builtin.AddressSpace) spec.StorageClass { +pub fn storageClass(module: *Module, as: std.lang.AddressSpace) spec.StorageClass { const target = module.zcu.getTarget(); return switch (as) { .generic => .function, diff --git a/src/codegen/wasm/CodeGen.zig b/src/codegen/wasm/CodeGen.zig index 7061d8548df43049b14b8244cf9c9f6ef6b9e226..415dc5b3693c94b67b699615353e5c5c2be2e46e 100644 --- a/src/codegen/wasm/CodeGen.zig +++ b/src/codegen/wasm/CodeGen.zig @@ -951,7 +951,7 @@ fn resolveCallingConventionValues( } pub fn firstParamSRet( - cc: std.builtin.CallingConvention, + cc: std.lang.CallingConvention, return_type: Type, zcu: *const Zcu, target: *const std.Target, @@ -970,7 +970,7 @@ pub fn firstParamSRet( /// Lowers a Zig type and its value based on a given calling convention to ensure /// it matches the ABI. -fn lowerArg(cg: *CodeGen, cc: std.builtin.CallingConvention, ty: Type, value: WValue) !void { +fn lowerArg(cg: *CodeGen, cc: std.lang.CallingConvention, ty: Type, value: WValue) !void { if (cc != .wasm_mvp) { return cg.lowerToStack(value); } @@ -1989,7 +1989,7 @@ fn airRetLoad(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { return cg.finishAir(inst, .none, &.{un_op}); } -fn airCall(cg: *CodeGen, inst: Air.Inst.Index, modifier: std.builtin.CallModifier) InnerError!void { +fn airCall(cg: *CodeGen, inst: Air.Inst.Index, modifier: std.lang.CallModifier) InnerError!void { if (modifier == .always_tail) return cg.fail("TODO implement tail calls for wasm", .{}); const call = cg.air.unwrapCall(inst); const args = call.args; @@ -7268,7 +7268,7 @@ fn airAtomicRmw(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { const ptr = try cg.resolveInst(pl_op.operand); const operand = try cg.resolveInst(extra.operand); const ty = cg.typeOfIndex(inst); - const op: std.builtin.AtomicRmwOp = extra.op(); + const op: std.lang.AtomicRmwOp = extra.op(); if (cg.useAtomicFeature()) { const int_ty: IntType = .fromType(cg, ty); diff --git a/src/codegen/x86_64/CodeGen.zig b/src/codegen/x86_64/CodeGen.zig index 4cd5ac2f9c13768d9d63a1d063f372336cf01450..2677c0638fb676ff8b2e476c23d8a96aa6cf5d3d 100644 --- a/src/codegen/x86_64/CodeGen.zig +++ b/src/codegen/x86_64/CodeGen.zig @@ -173952,7 +173952,7 @@ fn setFrameLoc( offset.* += self.frame_allocs.items(.abi_size)[frame_i]; } -fn computeFrameLayout(self: *CodeGen, cc: std.builtin.CallingConvention.Tag) !FrameLayout { +fn computeFrameLayout(self: *CodeGen, cc: std.lang.CallingConvention.Tag) !FrameLayout { const frame_allocs_len = self.frame_allocs.len; try self.frame_locs.resize(self.gpa, frame_allocs_len); const stack_frame_order = try self.gpa.alloc(FrameIndex, frame_allocs_len - FrameIndex.named_count); @@ -174294,7 +174294,7 @@ pub fn spillEflagsIfOccupied(self: *CodeGen) !void { } } -pub fn spillCallerPreservedRegs(self: *CodeGen, cc: std.builtin.CallingConvention.Tag, ignore_reg: Register) !void { +pub fn spillCallerPreservedRegs(self: *CodeGen, cc: std.lang.CallingConvention.Tag, ignore_reg: Register) !void { switch (cc) { inline .auto, .x86_64_sysv, .x86_64_win => |tag| inline for (comptime abi.getCallerPreservedRegs(tag)) |reg| if (reg != ignore_reg) try self.register_manager.getKnownReg(reg, null), @@ -175917,7 +175917,7 @@ fn genLocalDebugInfo(cg: *CodeGen, air_tag: Air.Inst.Tag, ty: Type, mcv: MCValue }; } -fn airCall(self: *CodeGen, inst: Air.Inst.Index, modifier: std.builtin.CallModifier, opts: CopyOptions) !void { +fn airCall(self: *CodeGen, inst: Air.Inst.Index, modifier: std.lang.CallModifier, opts: CopyOptions) !void { if (modifier == .always_tail) return self.fail("TODO implement tail calls for x86_64", .{}); const call = self.air.unwrapCall(inst); @@ -179498,7 +179498,7 @@ fn airBitCast(self: *CodeGen, inst: Air.Inst.Index) !void { ); var offset = dst_limbs_len * 8; if (offset < abi_size) { - const dst_signedness: std.builtin.Signedness = if (dst_ty.isAbiInt(zcu)) + const dst_signedness: std.lang.Signedness = if (dst_ty.isAbiInt(zcu)) dst_ty.intInfo(zcu).signedness else .unsigned; @@ -179640,8 +179640,8 @@ fn atomicOp( ptr_ty: Type, val_ty: Type, unused: bool, - rmw_op: ?std.builtin.AtomicRmwOp, - order: std.builtin.AtomicOrder, + rmw_op: ?std.lang.AtomicRmwOp, + order: std.lang.AtomicOrder, ) InnerError!MCValue { const pt = self.pt; const zcu = pt.zcu; @@ -179714,7 +179714,7 @@ fn atomicOp( defer self.register_manager.unlockReg(dst_lock); try self.genSetReg(dst_reg, val_ty, val_mcv, .{}); - if (rmw_op == std.builtin.AtomicRmwOp.Sub and mir_tag[1] == .xadd) { + if (rmw_op == std.lang.AtomicRmwOp.Sub and mir_tag[1] == .xadd) { try self.genUnOpMir(.{ ._, .neg }, val_ty, dst_mcv); } try self.asmMemoryRegister(mir_tag, ptr_mem, registerAlias(dst_reg, val_abi_size)); @@ -179898,7 +179898,7 @@ fn atomicOp( }; const val_lo_mem = try val_mem_mcv.mem(self, .{ .size = .qword }); const val_hi_mem = try val_mem_mcv.address().offset(8).deref().mem(self, .{ .size = .qword }); - if (rmw_op != std.builtin.AtomicRmwOp.Xchg) { + if (rmw_op != std.lang.AtomicRmwOp.Xchg) { try self.asmRegisterRegister(.{ ._, .mov }, .rbx, .rax); try self.asmRegisterRegister(.{ ._, .mov }, .rcx, .rdx); } @@ -180033,7 +180033,7 @@ fn airAtomicLoad(self: *CodeGen, inst: Air.Inst.Index) !void { return self.finishAir(inst, result, .{ atomic_load.ptr, .none, .none }); } -fn airAtomicStore(self: *CodeGen, inst: Air.Inst.Index, order: std.builtin.AtomicOrder) !void { +fn airAtomicStore(self: *CodeGen, inst: Air.Inst.Index, order: std.lang.AtomicOrder) !void { const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; const ptr_ty = self.typeOf(bin_op.lhs); @@ -181813,7 +181813,7 @@ fn nonBoolScalarBitSize(cg: *CodeGen, ty: Type) u32 { }; } -fn intInfo(cg: *CodeGen, ty: Type) ?std.builtin.Type.Int { +fn intInfo(cg: *CodeGen, ty: Type) ?std.lang.Type.Int { const zcu = cg.pt.zcu; const ip = &zcu.intern_pool; var ty_index = ty.ip_index; @@ -188528,7 +188528,7 @@ const Select = struct { const ConstSpec = struct { ref: Select.Operand.Ref = .none, - to_signedness: ?std.builtin.Signedness = null, + to_signedness: ?std.lang.Signedness = null, vectorize_to: ?Memory.Size = null, }; @@ -188537,7 +188537,7 @@ const Select = struct { after: u2, at: u2, - fn tag(spec: CallConvRegSpec, cg: *const CodeGen) std.builtin.CallingConvention.Tag { + fn tag(spec: CallConvRegSpec, cg: *const CodeGen) std.lang.CallingConvention.Tag { return switch (spec.cc) { .none => unreachable, .ccc => cg.target.cCallingConvention().?, @@ -188667,11 +188667,11 @@ const Select = struct { .smax_mem, .umin_mem => .bool_false, }) }, else => { - const scalar_info: std.builtin.Type.Int = cg.intInfo(scalar_ty) orelse .{ + const scalar_info: std.lang.Type.Int = cg.intInfo(scalar_ty) orelse .{ .signedness = .signed, .bits = cg.floatBits(scalar_ty).?, }; - const res_scalar_info: std.builtin.Type.Int = .{ + const res_scalar_info: std.lang.Type.Int = .{ .signedness = const_spec.to_signedness orelse scalar_info.signedness, .bits = switch (spec.kind) { else => scalar_info.bits, @@ -188739,7 +188739,7 @@ const Select = struct { .positive = undefined, }; defer allocator.free(big_int.limbs); - const signedness: std.builtin.Signedness = switch (spec.kind) { + const signedness: std.lang.Signedness = switch (spec.kind) { else => unreachable, .slimit_delta_mem => .signed, .umax_delta_mem => .unsigned, diff --git a/src/codegen/x86_64/Lower.zig b/src/codegen/x86_64/Lower.zig index b93c08b1b58770b792d6afa621ffee0a5c0dfd3b..508ed964ee78ceecf64dd9ea3b9a0014c6ab2b39 100644 --- a/src/codegen/x86_64/Lower.zig +++ b/src/codegen/x86_64/Lower.zig @@ -3,7 +3,7 @@ target: *const std.Target, allocator: std.mem.Allocator, mir: Mir, -cc: std.builtin.CallingConvention, +cc: std.lang.CallingConvention, err_msg: ?*Zcu.ErrorMsg = null, src_loc: Zcu.LazySrcLoc, result_insts_len: ResultInstIndex = undefined, diff --git a/src/codegen/x86_64/Mir.zig b/src/codegen/x86_64/Mir.zig index aa7442891a1988e9c55d87eef1194442c760fea5..addcaf27f3e1654b65733a163dfd8748e274d991 100644 --- a/src/codegen/x86_64/Mir.zig +++ b/src/codegen/x86_64/Mir.zig @@ -1737,7 +1737,7 @@ pub const Inst = struct { @typeInfo(Tag).@"enum".fields.len != 251) { const cond_src = (struct { - fn src() std.builtin.SourceLocation { + fn src() std.lang.SourceLocation { return @src(); } }).src(); diff --git a/src/codegen/x86_64/abi.zig b/src/codegen/x86_64/abi.zig index fcd6e63f922b8f6f300104ba63e81d41f2450d7f..6f620876521aeb4a2f866028c406ade71ee10a8c 100644 --- a/src/codegen/x86_64/abi.zig +++ b/src/codegen/x86_64/abi.zig @@ -478,7 +478,7 @@ pub const Win64 = struct { pub const c_abi_sse_return_regs = sse_avx_regs[0..1]; }; -pub fn getCalleePreservedRegs(cc: std.builtin.CallingConvention.Tag) []const Register { +pub fn getCalleePreservedRegs(cc: std.lang.CallingConvention.Tag) []const Register { return switch (cc) { .auto => zigcc.callee_preserved_regs, .x86_64_sysv => &SysV.callee_preserved_regs, @@ -487,7 +487,7 @@ pub fn getCalleePreservedRegs(cc: std.builtin.CallingConvention.Tag) []const Reg }; } -pub fn getCallerPreservedRegs(cc: std.builtin.CallingConvention.Tag) []const Register { +pub fn getCallerPreservedRegs(cc: std.lang.CallingConvention.Tag) []const Register { return switch (cc) { .auto => zigcc.caller_preserved_regs, .x86_64_sysv => &SysV.caller_preserved_regs, @@ -496,7 +496,7 @@ pub fn getCallerPreservedRegs(cc: std.builtin.CallingConvention.Tag) []const Reg }; } -pub fn getCAbiIntParamRegs(cc: std.builtin.CallingConvention.Tag) []const Register { +pub fn getCAbiIntParamRegs(cc: std.lang.CallingConvention.Tag) []const Register { return switch (cc) { .auto => zigcc.int_param_regs, .x86_64_sysv => &SysV.c_abi_int_param_regs, @@ -505,7 +505,7 @@ pub fn getCAbiIntParamRegs(cc: std.builtin.CallingConvention.Tag) []const Regist }; } -pub fn getCAbiX87ParamRegs(cc: std.builtin.CallingConvention.Tag) []const Register { +pub fn getCAbiX87ParamRegs(cc: std.lang.CallingConvention.Tag) []const Register { return switch (cc) { .auto => zigcc.x87_param_regs, .x86_64_sysv => SysV.c_abi_x87_param_regs, @@ -514,7 +514,7 @@ pub fn getCAbiX87ParamRegs(cc: std.builtin.CallingConvention.Tag) []const Regist }; } -pub fn getCAbiSseParamRegs(cc: std.builtin.CallingConvention.Tag, target: *const std.Target) []const Register { +pub fn getCAbiSseParamRegs(cc: std.lang.CallingConvention.Tag, target: *const std.Target) []const Register { return switch (cc) { .auto => switch (target.cpu.arch) { else => unreachable, @@ -527,7 +527,7 @@ pub fn getCAbiSseParamRegs(cc: std.builtin.CallingConvention.Tag, target: *const }; } -pub fn getCAbiIntReturnRegs(cc: std.builtin.CallingConvention.Tag) []const Register { +pub fn getCAbiIntReturnRegs(cc: std.lang.CallingConvention.Tag) []const Register { return switch (cc) { .auto => zigcc.int_return_regs, .x86_64_sysv => &SysV.c_abi_int_return_regs, @@ -536,7 +536,7 @@ pub fn getCAbiIntReturnRegs(cc: std.builtin.CallingConvention.Tag) []const Regis }; } -pub fn getCAbiX87ReturnRegs(cc: std.builtin.CallingConvention.Tag) []const Register { +pub fn getCAbiX87ReturnRegs(cc: std.lang.CallingConvention.Tag) []const Register { return switch (cc) { .auto => zigcc.x87_return_regs, .x86_64_sysv => SysV.c_abi_x87_return_regs, @@ -545,7 +545,7 @@ pub fn getCAbiX87ReturnRegs(cc: std.builtin.CallingConvention.Tag) []const Regis }; } -pub fn getCAbiSseReturnRegs(cc: std.builtin.CallingConvention.Tag) []const Register { +pub fn getCAbiSseReturnRegs(cc: std.lang.CallingConvention.Tag) []const Register { return switch (cc) { .auto => zigcc.sse_return_regs, .x86_64_sysv => SysV.c_abi_sse_return_regs, @@ -554,7 +554,7 @@ pub fn getCAbiSseReturnRegs(cc: std.builtin.CallingConvention.Tag) []const Regis }; } -pub fn getCAbiLinkerScratchReg(cc: std.builtin.CallingConvention.Tag) Register { +pub fn getCAbiLinkerScratchReg(cc: std.lang.CallingConvention.Tag) Register { return switch (cc) { .auto => zigcc.int_return_regs[zigcc.int_return_regs.len - 1], .x86_64_sysv => SysV.c_abi_int_return_regs[0], diff --git a/src/codegen/x86_64/bits.zig b/src/codegen/x86_64/bits.zig index 452518e14e90c40c14aebc4f0718f89bc31dc338..5e464af42b5262f638efd4a1e8b9a56588f4b288 100644 --- a/src/codegen/x86_64/bits.zig +++ b/src/codegen/x86_64/bits.zig @@ -106,7 +106,7 @@ pub const Condition = enum(u5) { } pub fn fromCompareOperator( - signedness: std.builtin.Signedness, + signedness: std.lang.Signedness, op: std.math.CompareOperator, ) Condition { return switch (signedness) { diff --git a/src/libs/freebsd.zig b/src/libs/freebsd.zig index 2d1d707d9d4e0e1267d28cb1546d019e8fbed183..2270de6d60fd38aa527c9bd78ee21823e2b89554 100644 --- a/src/libs/freebsd.zig +++ b/src/libs/freebsd.zig @@ -19,7 +19,7 @@ pub const CrtFile = enum { scrt1_o, }; -pub fn needsCrt0(output_mode: std.builtin.OutputMode) ?CrtFile { +pub fn needsCrt0(output_mode: std.lang.OutputMode) ?CrtFile { // For shared libraries and PIC executables, we should actually link in a variant of crt1 that // is built with `-DSHARED` so that it calls `__cxa_finalize` in an ELF destructor. However, we // currently make no effort to respect `__cxa_finalize` on any other targets, so for now, we're diff --git a/src/libs/glibc.zig b/src/libs/glibc.zig index 04492d166f635e61cea6f3a95e18d29b511676f2..9d07149dfc867f68640a73f34e3e9d19656fff26 100644 --- a/src/libs/glibc.zig +++ b/src/libs/glibc.zig @@ -1277,7 +1277,7 @@ fn buildSharedLib( try comp.updateSubCompilation(sub_compilation, misc_task, prog_node); } -pub fn needsCrt0(output_mode: std.builtin.OutputMode) ?CrtFile { +pub fn needsCrt0(output_mode: std.lang.OutputMode) ?CrtFile { return switch (output_mode) { .Obj, .Lib => null, .Exe => .scrt1_o, diff --git a/src/libs/libcxx.zig b/src/libs/libcxx.zig index f5d10171f58a546f55dce79e88334d84d7ad3691..3eb4161235382c9b63dab07edf88c27e74dc1a08 100644 --- a/src/libs/libcxx.zig +++ b/src/libs/libcxx.zig @@ -324,7 +324,7 @@ pub fn buildLibCxxAbi(comp: *Compilation, prog_node: std.Progress.Node) BuildErr const strip = comp.compilerRtStrip(); // See the `-fno-exceptions` logic for WASI. // The old 32-bit x86 variant of SEH doesn't use tables. - const unwind_tables: std.builtin.UnwindTables = + const unwind_tables: std.lang.UnwindTables = if (target.os.tag == .wasi or (target.cpu.arch == .x86 and target.os.tag == .windows)) .none else .async; const config = Compilation.Config.resolve(.{ diff --git a/src/libs/libtsan.zig b/src/libs/libtsan.zig index a2c0baf32670291d759c17c8530e3ca846cecd4b..588217738ad2021a67075c36e6b13d05821ae347 100644 --- a/src/libs/libtsan.zig +++ b/src/libs/libtsan.zig @@ -37,7 +37,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo .watchos => if (target.abi == .simulator) "clang_rt.tsan_watchossim_dynamic" else "clang_rt.tsan_watchos_dynamic", else => "tsan", }; - const link_mode: std.builtin.LinkMode = if (target.os.tag.isDarwin()) .dynamic else .static; + const link_mode: std.lang.LinkMode = if (target.os.tag.isDarwin()) .dynamic else .static; const output_mode = .Lib; const basename = try std.zig.binNameAlloc(arena, .{ .root_name = root_name, @@ -48,7 +48,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo const optimize_mode = comp.compilerRtOptMode(); const strip = comp.compilerRtStrip(); - const unwind_tables: std.builtin.UnwindTables = + const unwind_tables: std.lang.UnwindTables = if (target.cpu.arch == .x86 and target.os.tag == .windows) .none else .async; const link_libcpp = target.os.tag.isDarwin(); diff --git a/src/libs/libunwind.zig b/src/libs/libunwind.zig index dd380b550f472a4ebe3064289011376b73ae3f13..e4c1096efd5d37368d485100be96304d77be2846 100644 --- a/src/libs/libunwind.zig +++ b/src/libs/libunwind.zig @@ -29,7 +29,7 @@ pub fn buildStaticLib(comp: *Compilation, prog_node: std.Progress.Node) BuildErr const io = comp.io; const output_mode = .Lib; const target = &comp.root_mod.resolved_target.result; - const unwind_tables: std.builtin.UnwindTables = + const unwind_tables: std.lang.UnwindTables = if (target.cpu.arch == .x86 and target.os.tag == .windows) .none else .async; const config = Compilation.Config.resolve(.{ .output_mode = output_mode, diff --git a/src/libs/mingw.zig b/src/libs/mingw.zig index 4dfc8107fb3bd5fadac55f1a4d390c9d7631f6fa..384af94084d98f65316f16f74c019e5a57292dfc 100644 --- a/src/libs/mingw.zig +++ b/src/libs/mingw.zig @@ -37,7 +37,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre const target = comp.getTarget(); // The old 32-bit x86 variant of SEH doesn't use tables. - const unwind_tables: std.builtin.UnwindTables = if (target.cpu.arch != .x86) .async else .none; + const unwind_tables: std.lang.UnwindTables = if (target.cpu.arch != .x86) .async else .none; switch (crt_file) { .crt2_o => { diff --git a/src/libs/musl.zig b/src/libs/musl.zig index b3fa9dd0fa2a40735edf9f867995ffd32f8ad738..8ed0af0de8152a0c593c70ec29aa82974962760b 100644 --- a/src/libs/musl.zig +++ b/src/libs/musl.zig @@ -173,7 +173,7 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro .libc_so => { const optimize_mode = comp.compilerRtOptMode(); const strip = comp.compilerRtStrip(); - const output_mode: std.builtin.OutputMode = .Lib; + const output_mode: std.lang.OutputMode = .Lib; const config = try Compilation.Config.resolve(.{ .output_mode = output_mode, .link_mode = .dynamic, @@ -290,7 +290,7 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro } } -pub fn needsCrt0(output_mode: std.builtin.OutputMode, link_mode: std.builtin.LinkMode, pie: bool) ?CrtFile { +pub fn needsCrt0(output_mode: std.lang.OutputMode, link_mode: std.lang.LinkMode, pie: bool) ?CrtFile { return switch (output_mode) { .Obj, .Lib => null, .Exe => switch (link_mode) { diff --git a/src/libs/netbsd.zig b/src/libs/netbsd.zig index e17c33d69d1781c846ef16e473c5f2c8eb1e28d7..f81ad41267a6f450936ad076347e1180510ac532 100644 --- a/src/libs/netbsd.zig +++ b/src/libs/netbsd.zig @@ -19,7 +19,7 @@ pub const CrtFile = enum { scrt0_o, }; -pub fn needsCrt0(output_mode: std.builtin.OutputMode) ?CrtFile { +pub fn needsCrt0(output_mode: std.lang.OutputMode) ?CrtFile { // For shared libraries and PIC executables, we should actually link in a variant of crt1 that // is built with `-DSHARED` so that it calls `__cxa_finalize` in an ELF destructor. However, we // currently make no effort to respect `__cxa_finalize` on any other targets, so for now, we're diff --git a/src/libs/openbsd.zig b/src/libs/openbsd.zig index 493b62345ffb94178e4e5967fe0996269cef226d..05d30e53edf9130ea13e32d6f42e40870c00198d 100644 --- a/src/libs/openbsd.zig +++ b/src/libs/openbsd.zig @@ -20,7 +20,7 @@ pub const CrtFile = enum { scrt0_o, }; -pub fn needsCrt0(output_mode: std.builtin.OutputMode) ?CrtFile { +pub fn needsCrt0(output_mode: std.lang.OutputMode) ?CrtFile { // https://github.com/ziglang/zig/issues/23574#issuecomment-2869089897 return switch (output_mode) { .Obj, .Lib => null, diff --git a/src/libs/wasi_libc.zig b/src/libs/wasi_libc.zig index 8c328cc21cb9f4d7fdf5131a5505740d8d9e6a6b..bebe4759f0755d845948e706f5d94219c7dbd822 100644 --- a/src/libs/wasi_libc.zig +++ b/src/libs/wasi_libc.zig @@ -12,14 +12,14 @@ pub const CrtFile = enum { libc_a, }; -pub fn execModelCrtFile(wasi_exec_model: std.builtin.WasiExecModel) CrtFile { +pub fn execModelCrtFile(wasi_exec_model: std.lang.WasiExecModel) CrtFile { return switch (wasi_exec_model) { .reactor => CrtFile.crt1_reactor_o, .command => CrtFile.crt1_command_o, }; } -pub fn execModelCrtFileFullName(wasi_exec_model: std.builtin.WasiExecModel) []const u8 { +pub fn execModelCrtFileFullName(wasi_exec_model: std.lang.WasiExecModel) []const u8 { return switch (execModelCrtFile(wasi_exec_model)) { .crt1_reactor_o => "crt1-reactor.o", .crt1_command_o => "crt1-command.o", diff --git a/src/link.zig b/src/link.zig index c63197201ca4ccd3608892104162b3d41ffaf2e3..c98fbf4371137606172c52f67aec2320c8903cea 100644 --- a/src/link.zig +++ b/src/link.zig @@ -1300,8 +1300,8 @@ pub const File = struct { }; pub fn determinePermissions( - output_mode: std.builtin.OutputMode, - link_mode: std.builtin.LinkMode, + output_mode: std.lang.OutputMode, + link_mode: std.lang.LinkMode, ) Io.File.Permissions { // On common systems with a 0o022 umask, 0o777 will still result in a file created // with 0o755 permissions, but it works appropriately if the system is configured @@ -1714,10 +1714,10 @@ pub const UnresolvedInput = union(enum) { must_link: bool = false, hidden: bool = false, allow_so_scripts: bool = false, - preferred_mode: std.builtin.LinkMode, + preferred_mode: std.lang.LinkMode, search_strategy: SearchStrategy, - fn fallbackMode(q: Query) std.builtin.LinkMode { + fn fallbackMode(q: Query) std.lang.LinkMode { assert(q.search_strategy != .no_fallback); return switch (q.preferred_mode) { .dynamic => .static, @@ -1843,7 +1843,7 @@ pub fn resolveInputs( name: []const u8, strategy: UnresolvedInput.SearchStrategy, checked_paths: []const u8, - preferred_mode: std.builtin.LinkMode, + preferred_mode: std.lang.LinkMode, }) = .empty; // Convert external system libs into a stack so that items can be @@ -2077,7 +2077,7 @@ fn resolveLibInput( lib_directory: Directory, name_query: UnresolvedInput.NameQuery, target: *const std.Target, - link_mode: std.builtin.LinkMode, + link_mode: std.lang.LinkMode, color: std.zig.Color, ) Allocator.Error!ResolveLibInputResult { try resolved_inputs.ensureUnusedCapacity(gpa, 1); @@ -2161,7 +2161,7 @@ fn finishResolveLibInput( resolved_inputs: *std.ArrayList(Input), path: Path, file: Io.File, - link_mode: std.builtin.LinkMode, + link_mode: std.lang.LinkMode, query: UnresolvedInput.Query, ) ResolveLibInputResult { switch (link_mode) { @@ -2237,7 +2237,7 @@ fn resolvePathInputLib( ld_script_bytes: *std.ArrayList(u8), target: *const std.Target, pq: UnresolvedInput.PathQuery, - link_mode: std.builtin.LinkMode, + link_mode: std.lang.LinkMode, color: std.zig.Color, ) Allocator.Error!ResolveLibInputResult { try resolved_inputs.ensureUnusedCapacity(gpa, 1); diff --git a/src/link/Coff.zig b/src/link/Coff.zig index 60b683e3a7ae39e6c27d2c1e8220b0d0c106bc0f..569df41c18dc895180a00045cb44b310fba6052c 100644 --- a/src/link/Coff.zig +++ b/src/link/Coff.zig @@ -1091,7 +1091,7 @@ fn computeNodeSectionOffset(coff: *Coff, ni: MappedFile.Node.Index) u32 { } } -pub inline fn targetEndian(_: *const Coff) std.builtin.Endian { +pub inline fn targetEndian(_: *const Coff) std.lang.Endian { return .little; } fn targetLoad(coff: *const Coff, ptr: anytype) @typeInfo(@TypeOf(ptr)).pointer.child { diff --git a/src/link/Dwarf.zig b/src/link/Dwarf.zig index 98829efc552958dfd68a744c386df24fbd943636..d800ef49bcd53e6c2b4f6f19db25c563af0c5d76 100644 --- a/src/link/Dwarf.zig +++ b/src/link/Dwarf.zig @@ -22,7 +22,7 @@ const target_info = @import("../target.zig"); gpa: Allocator, bin_file: *link.File, format: DW.Format, -endian: std.builtin.Endian, +endian: std.lang.Endian, address_size: AddressSize, const_pool: link.ConstPool, @@ -1963,7 +1963,7 @@ pub const WipNav = struct { fn writer(counter: *ExprLocCounter) *Writer { return &counter.dw.writer; } - fn endian(_: ExprLocCounter) std.builtin.Endian { + fn endian(_: ExprLocCounter) std.lang.Endian { return @import("builtin").cpu.arch.endian(); } fn addrSym(counter: *ExprLocCounter, _: u32) Writer.Error!void { @@ -1984,7 +1984,7 @@ pub const WipNav = struct { fn writer(ctx: @This()) *Writer { return &ctx.wip_nav.debug_info.writer; } - fn endian(ctx: @This()) std.builtin.Endian { + fn endian(ctx: @This()) std.lang.Endian { return ctx.wip_nav.dwarf.endian; } fn addrSym(ctx: @This(), sym_index: u32) (UpdateError || Writer.Error)!void { @@ -2026,7 +2026,7 @@ pub const WipNav = struct { fn writer(ctx: @This()) *Writer { return &ctx.wip_nav.debug_frame.writer; } - fn endian(ctx: @This()) std.builtin.Endian { + fn endian(ctx: @This()) std.lang.Endian { return ctx.wip_nav.dwarf.endian; } fn addrSym(ctx: @This(), sym_index: u32) (UpdateError || Writer.Error)!void { @@ -4164,7 +4164,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co try wip_nav.strpFmt("{f}", .{val.toType().fmt(pt)}); const cc: DW.CC = cc: { if (zcu.getTarget().cCallingConvention()) |cc| { - if (@as(std.builtin.CallingConvention.Tag, cc) == func_type.cc) { + if (@as(std.lang.CallingConvention.Tag, cc) == func_type.cc) { break :cc .normal; } } diff --git a/src/link/Elf2.zig b/src/link/Elf2.zig index a5b4a9478b55599be5f8d4d8ce9ab3619527bbd1..164401c90f450842100c2055d87ea6dd1d577187 100644 --- a/src/link/Elf2.zig +++ b/src/link/Elf2.zig @@ -1697,7 +1697,7 @@ pub fn identData(elf: *const Elf) std.elf.DATA { return @enumFromInt(elf.mf.memory_map.memory[std.elf.EI.DATA]); } -pub fn targetEndian(elf: *const Elf) std.builtin.Endian { +pub fn targetEndian(elf: *const Elf) std.lang.Endian { return switch (elf.identData()) { .NONE, _ => unreachable, .@"2LSB" => .little, diff --git a/src/link/Wasm.zig b/src/link/Wasm.zig index 37c182c51432d850a4858f0f4ffffabdd3386740..95ee2fae1cedf025587612fa3eba4911e000403b 100644 --- a/src/link/Wasm.zig +++ b/src/link/Wasm.zig @@ -3882,7 +3882,7 @@ pub fn flush( fn defaultEntrySymbolName( preloaded_strings: *const PreloadedStrings, - wasi_exec_model: std.builtin.WasiExecModel, + wasi_exec_model: std.lang.WasiExecModel, ) String { return switch (wasi_exec_model) { .reactor => preloaded_strings._initialize, @@ -3962,7 +3962,7 @@ pub fn getExistingFuncType2(wasm: *const Wasm, params: []const std.wasm.Valtype, pub fn internFunctionType( wasm: *Wasm, - cc: std.builtin.CallingConvention, + cc: std.lang.CallingConvention, params: []const InternPool.Index, return_type: Zcu.Type, target: *const std.Target, @@ -3976,7 +3976,7 @@ pub fn internFunctionType( pub fn getExistingFunctionType( wasm: *Wasm, - cc: std.builtin.CallingConvention, + cc: std.lang.CallingConvention, params: []const InternPool.Index, return_type: Zcu.Type, target: *const std.Target, @@ -4210,7 +4210,7 @@ pub fn errorNameTableAddr(wasm: *Wasm) u32 { fn convertZcuFnType( comp: *Compilation, - cc: std.builtin.CallingConvention, + cc: std.lang.CallingConvention, params: []const InternPool.Index, return_type: Zcu.Type, target: *const std.Target, diff --git a/src/main.zig b/src/main.zig index 95ee9a82f15ac3b6591fe07bc061dd9c336b1f4e..d813a1061ec0f4c69f6a4d9356d0d9da0432c0f5 100644 --- a/src/main.zig +++ b/src/main.zig @@ -766,7 +766,7 @@ const Emit = union(enum) { }; const ArgMode = union(enum) { - build: std.builtin.OutputMode, + build: std.lang.OutputMode, cc, cpp, translate_c, @@ -935,13 +935,13 @@ fn buildOutputType( var minor_subsystem_version: ?u16 = null; var mingw_unicode_entry_point: bool = false; var enable_link_snapshots: bool = false; - var debug_compiler_runtime_libs: ?std.builtin.OptimizeMode = null; + var debug_compiler_runtime_libs: ?std.lang.OptimizeMode = null; var install_name: ?[]const u8 = null; var hash_style: link.File.Lld.Elf.HashStyle = .both; var entitlements: ?[]const u8 = null; var pagezero_size: ?u64 = null; var lib_search_strategy: link.UnresolvedInput.SearchStrategy = .paths_first; - var lib_preferred_mode: std.builtin.LinkMode = .dynamic; + var lib_preferred_mode: std.lang.LinkMode = .dynamic; var headerpad_size: ?u32 = null; var headerpad_max_install_names: bool = false; var dead_strip_dylibs: bool = false; @@ -5754,7 +5754,7 @@ fn jitCmdInner( const self_exe_path = process.executablePathAlloc(io, arena) catch |err| fatal("unable to find self exe path: {t}", .{err}); - const optimize_mode: std.builtin.OptimizeMode = if (EnvVar.ZIG_DEBUG_CMD.isSet(environ_map)) + const optimize_mode: std.lang.OptimizeMode = if (EnvVar.ZIG_DEBUG_CMD.isSet(environ_map)) .Debug else .ReleaseFast; @@ -6265,8 +6265,8 @@ pub const ClangArgIterator = struct { } }; -fn parseCodeModel(arg: []const u8) std.builtin.CodeModel { - return std.meta.stringToEnum(std.builtin.CodeModel, arg) orelse +fn parseCodeModel(arg: []const u8) std.lang.CodeModel { + return std.meta.stringToEnum(std.lang.CodeModel, arg) orelse fatal("unsupported machine code model: '{s}'", .{arg}); } @@ -7669,13 +7669,13 @@ fn findTemplates(gpa: Allocator, arena: Allocator, io: Io) Templates { }; } -fn parseOptimizeMode(s: []const u8) std.builtin.OptimizeMode { - return std.meta.stringToEnum(std.builtin.OptimizeMode, s) orelse +fn parseOptimizeMode(s: []const u8) std.lang.OptimizeMode { + return std.meta.stringToEnum(std.lang.OptimizeMode, s) orelse fatal("unrecognized optimization mode: '{s}'", .{s}); } -fn parseWasiExecModel(s: []const u8) std.builtin.WasiExecModel { - return std.meta.stringToEnum(std.builtin.WasiExecModel, s) orelse +fn parseWasiExecModel(s: []const u8) std.lang.WasiExecModel { + return std.meta.stringToEnum(std.lang.WasiExecModel, s) orelse fatal("expected [command|reactor] for -mexec-mode=[value], found '{s}'", .{s}); } diff --git a/src/print_zir.zig b/src/print_zir.zig index 6f7af6c33c80eb0034640b3bf40e85c9990eecd7..596c6d504091089638d35af7901f45091227ad9c 100644 --- a/src/print_zir.zig +++ b/src/print_zir.zig @@ -1340,7 +1340,7 @@ const Writer = struct { if (extra.data.flags.ensure_result_used) { try stream.writeAll("nodiscard "); } - try stream.print(".{s}, ", .{@tagName(@as(std.builtin.CallModifier, @enumFromInt(extra.data.flags.packed_modifier)))}); + try stream.print(".{s}, ", .{@tagName(@as(std.lang.CallModifier, @enumFromInt(extra.data.flags.packed_modifier)))}); switch (kind) { .direct => try self.writeInstRef(stream, extra.data.callee), .field => { diff --git a/src/target.zig b/src/target.zig index 871a5982395f29d4a6f9eabadb634fa33c1efdfa..ba268c9bf6ca06602ef615981486d7522409d2c6 100644 --- a/src/target.zig +++ b/src/target.zig @@ -3,7 +3,7 @@ const std = @import("std"); const assert = std.debug.assert; const Type = @import("Type.zig"); -const AddressSpace = std.builtin.AddressSpace; +const AddressSpace = std.lang.AddressSpace; const Alignment = @import("InternPool.zig").Alignment; const Compilation = @import("Compilation.zig"); const Feature = @import("Zcu.zig").Feature; @@ -31,7 +31,7 @@ pub fn canDynamicLink(target: *const std.Target) bool { }; } -pub fn libCNeedsLibUnwind(target: *const std.Target, link_mode: std.builtin.LinkMode) bool { +pub fn libCNeedsLibUnwind(target: *const std.Target, link_mode: std.lang.LinkMode) bool { return target.isGnuLibC() and link_mode == .static; } @@ -119,7 +119,7 @@ pub fn useEmulatedTls(target: *const std.Target) bool { }; } -pub fn hasValgrindSupport(target: *const std.Target, backend: std.builtin.CompilerBackend) bool { +pub fn hasValgrindSupport(target: *const std.Target, backend: std.lang.CompilerBackend) bool { // We can't currently output the necessary Valgrind client request assembly when using the C // backend and compiling with an MSVC-like compiler. const ofmt_c_msvc = (target.abi == .msvc or target.abi == .itanium) and target.ofmt == .c; @@ -265,7 +265,7 @@ pub fn hasLldSupport(ofmt: std.Target.ObjectFormat) bool { }; } -pub fn hasNewLinkerSupport(ofmt: std.Target.ObjectFormat, backend: std.builtin.CompilerBackend) bool { +pub fn hasNewLinkerSupport(ofmt: std.Target.ObjectFormat, backend: std.lang.CompilerBackend) bool { return switch (ofmt) { .elf, .coff => switch (backend) { .stage2_x86_64 => true, @@ -299,7 +299,7 @@ pub fn selfHostedBackendIsAsRobustAsLlvm(target: *const std.Target) bool { return false; } -pub fn supportsStackProbing(target: *const std.Target, backend: std.builtin.CompilerBackend) bool { +pub fn supportsStackProbing(target: *const std.Target, backend: std.lang.CompilerBackend) bool { return switch (backend) { .stage2_aarch64, .stage2_x86_64 => true, .stage2_llvm => target.os.tag != .windows and target.os.tag != .uefi and @@ -308,7 +308,7 @@ pub fn supportsStackProbing(target: *const std.Target, backend: std.builtin.Comp }; } -pub fn supportsStackProtector(target: *const std.Target, backend: std.builtin.CompilerBackend) bool { +pub fn supportsStackProtector(target: *const std.Target, backend: std.lang.CompilerBackend) bool { switch (target.os.tag) { .plan9 => return false, else => {}, @@ -336,7 +336,7 @@ pub fn libcProvidesStackProtector(target: *const std.Target) bool { /// Returns true if `@returnAddress()` is supported by the target and has a /// reasonably performant implementation for the requested optimization mode. -pub fn supportsReturnAddress(target: *const std.Target, optimize: std.builtin.OptimizeMode) bool { +pub fn supportsReturnAddress(target: *const std.Target, optimize: std.lang.OptimizeMode) bool { return switch (target.cpu.arch) { // Emscripten currently implements `emscripten_return_address()` by calling // out into JavaScript and parsing a stack trace, which introduces significant @@ -396,7 +396,7 @@ pub fn hasDebugInfo(target: *const std.Target) bool { }; } -pub fn defaultCompilerRtOptimizeMode(target: *const std.Target) std.builtin.OptimizeMode { +pub fn defaultCompilerRtOptimizeMode(target: *const std.Target) std.lang.OptimizeMode { if (target.cpu.arch.isWasm() and target.os.tag == .freestanding) { return .ReleaseSmall; } else { @@ -437,7 +437,7 @@ pub fn canBuildLibUbsanRt(target: *const std.Target) enum { no, yes, llvm_only, /// Whether libzigc can fill-in the gaps of an existing libc /// or *is* the libc of the target. -pub fn wantsZigC(target: *const std.Target, link_mode: std.builtin.LinkMode) bool { +pub fn wantsZigC(target: *const std.Target, link_mode: std.lang.LinkMode) bool { return (target.isMuslLibC() and link_mode == .static) or target.isWasiLibC() or target.isMinGW(); } @@ -547,7 +547,7 @@ pub fn clangSupportsNoImplicitFloatArg(target: *const std.Target) bool { }; } -pub fn defaultUnwindTables(target: *const std.Target, libunwind: bool, libtsan: bool) std.builtin.UnwindTables { +pub fn defaultUnwindTables(target: *const std.Target, libunwind: bool, libtsan: bool) std.lang.UnwindTables { if (target.os.tag == .windows) { // The old 32-bit x86 variant of SEH doesn't use tables. return if (target.cpu.arch != .x86) .async else .none; @@ -824,7 +824,7 @@ pub fn functionPointerMask(target: *const std.Target) ?u64 { null; } -pub fn supportsTailCall(target: *const std.Target, backend: std.builtin.CompilerBackend) bool { +pub fn supportsTailCall(target: *const std.Target, backend: std.lang.CompilerBackend) bool { switch (backend) { .stage2_llvm => return @import("codegen/llvm.zig").supportsTailCall(target), .stage2_c => return true, @@ -832,7 +832,7 @@ pub fn supportsTailCall(target: *const std.Target, backend: std.builtin.Compiler } } -pub fn supportsThreads(target: *const std.Target, backend: std.builtin.CompilerBackend) bool { +pub fn supportsThreads(target: *const std.Target, backend: std.lang.CompilerBackend) bool { _ = target; return switch (backend) { .stage2_aarch64 => false, @@ -880,7 +880,7 @@ pub fn compilerRtIntAbbrev(bits: u16) []const u8 { }; } -pub fn fnCallConvAllowsZigTypes(cc: std.builtin.CallingConvention) bool { +pub fn fnCallConvAllowsZigTypes(cc: std.lang.CallingConvention) bool { return switch (cc) { .auto, .async, .@"inline" => true, // For now we want to authorize PTX kernel to use zig objects, even if @@ -891,7 +891,7 @@ pub fn fnCallConvAllowsZigTypes(cc: std.builtin.CallingConvention) bool { }; } -pub fn zigBackend(target: *const std.Target, use_llvm: bool) std.builtin.CompilerBackend { +pub fn zigBackend(target: *const std.Target, use_llvm: bool) std.lang.CompilerBackend { if (use_llvm) return .stage2_llvm; if (target.ofmt == .c) return .stage2_c; return switch (target.cpu.arch) { @@ -908,7 +908,7 @@ pub fn zigBackend(target: *const std.Target, use_llvm: bool) std.builtin.Compile }; } -pub inline fn backendSupportsFeature(backend: std.builtin.CompilerBackend, comptime feature: Feature) bool { +pub inline fn backendSupportsFeature(backend: std.lang.CompilerBackend, comptime feature: Feature) bool { return switch (feature) { .panic_fn => switch (backend) { .stage2_aarch64, diff --git a/src/tracy.zig b/src/tracy.zig index 4fc2b009344aaa96f4a013a40b8dc9d99ffe10fb..7dd8123b98f7b186ff577c5c6fcf13016ecd49ac 100644 --- a/src/tracy.zig +++ b/src/tracy.zig @@ -58,7 +58,7 @@ pub const Ctx = if (enable) ___tracy_c_zone_context else struct { } }; -pub inline fn trace(comptime src: std.builtin.SourceLocation) Ctx { +pub inline fn trace(comptime src: std.lang.SourceLocation) Ctx { if (!enable) return .{}; const global = struct { @@ -78,7 +78,7 @@ pub inline fn trace(comptime src: std.builtin.SourceLocation) Ctx { } } -pub inline fn traceNamed(comptime src: std.builtin.SourceLocation, comptime name: [:0]const u8) Ctx { +pub inline fn traceNamed(comptime src: std.lang.SourceLocation, comptime name: [:0]const u8) Ctx { if (!enable) return .{}; const global = struct { -- 2.54.0 From e393962bc2348a03ee53fd0a6e4dec6250842600 Mon Sep 17 00:00:00 2001 From: Matthew Lugg Date: Sat, 2 May 2026 11:26:58 +0100 Subject: [PATCH 4/4] langref: use 'std.lang' instead of 'std.builtin' --- doc/langref.html.in | 68 +++++++++---------- ...truct.zig => lang.CallModifier struct.zig} | 0 doc/langref/test_noreturn_from_exit.zig | 5 +- 3 files changed, 35 insertions(+), 38 deletions(-) rename doc/langref/{builtin.CallModifier struct.zig => lang.CallModifier struct.zig} (100%) diff --git a/doc/langref.html.in b/doc/langref.html.in index 074c324de7357c983a918a59a56c05a7d8d4133a..bcfda4d66adc693e415a70772290ac937468d2ef 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -3763,7 +3763,7 @@ void do_a_thing(struct Foo *foo) { {#syntax#}@Int(x, y){#endsyntax#} - - {#syntax#}x{#endsyntax#} is a {#syntax#}std.builtin.Signedness{#endsyntax#}, {#syntax#}y{#endsyntax#} is a {#syntax#}u16{#endsyntax#} + {#syntax#}x{#endsyntax#} is a {#syntax#}std.lang.Signedness{#endsyntax#}, {#syntax#}y{#endsyntax#} is a {#syntax#}u16{#endsyntax#} {#syntax#}@typeInfo(x){#endsyntax#} @@ -4373,7 +4373,7 @@ comptime { {#syntax#}T{#endsyntax#} must be a pointer, a {#syntax#}bool{#endsyntax#}, a float, an integer, an enum, or a packed struct.

-

{#syntax#}AtomicOrder{#endsyntax#} can be found with {#syntax#}@import("std").builtin.AtomicOrder{#endsyntax#}.

+

{#syntax#}AtomicOrder{#endsyntax#} can be found with {#syntax#}@import("std").lang.AtomicOrder{#endsyntax#}.

{#see_also|@atomicStore|@atomicRmw||@cmpxchgWeak|@cmpxchgStrong#} {#header_close#} @@ -4387,8 +4387,8 @@ comptime { {#syntax#}T{#endsyntax#} must be a pointer, a {#syntax#}bool{#endsyntax#}, a float, an integer, an enum, or a packed struct.

-

{#syntax#}AtomicOrder{#endsyntax#} can be found with {#syntax#}@import("std").builtin.AtomicOrder{#endsyntax#}.

-

{#syntax#}AtomicRmwOp{#endsyntax#} can be found with {#syntax#}@import("std").builtin.AtomicRmwOp{#endsyntax#}.

+

{#syntax#}AtomicOrder{#endsyntax#} can be found with {#syntax#}@import("std").lang.AtomicOrder{#endsyntax#}.

+

{#syntax#}AtomicRmwOp{#endsyntax#} can be found with {#syntax#}@import("std").lang.AtomicRmwOp{#endsyntax#}.

{#see_also|@atomicStore|@atomicLoad|@cmpxchgWeak|@cmpxchgStrong#} {#header_close#} @@ -4401,7 +4401,7 @@ comptime { {#syntax#}T{#endsyntax#} must be a pointer, a {#syntax#}bool{#endsyntax#}, a float, an integer, an enum, or a packed struct.

-

{#syntax#}AtomicOrder{#endsyntax#} can be found with {#syntax#}@import("std").builtin.AtomicOrder{#endsyntax#}.

+

{#syntax#}AtomicOrder{#endsyntax#} can be found with {#syntax#}@import("std").lang.AtomicOrder{#endsyntax#}.

{#see_also|@atomicLoad|@atomicRmw|@cmpxchgWeak|@cmpxchgStrong#} {#header_close#} @@ -4459,7 +4459,7 @@ comptime { {#header_open|@branchHint#}
{#syntax#}@branchHint(hint: BranchHint) void{#endsyntax#}

Hints to the optimizer how likely a given branch of control flow is to be reached.

-

{#syntax#}BranchHint{#endsyntax#} can be found with {#syntax#}@import("std").builtin.BranchHint{#endsyntax#}.

+

{#syntax#}BranchHint{#endsyntax#} can be found with {#syntax#}@import("std").lang.BranchHint{#endsyntax#}.

This function is only valid as the first statement in a control flow branch, or the first statement in a function.

{#header_close#} @@ -4526,7 +4526,7 @@ comptime { {#header_close#} {#header_open|@call#} -
{#syntax#}@call(modifier: std.builtin.CallModifier, function: anytype, args: anytype) anytype{#endsyntax#}
+
{#syntax#}@call(modifier: std.lang.CallModifier, function: anytype, args: anytype) anytype{#endsyntax#}

Calls a function, in the same way that invoking an expression with parentheses does:

@@ -4536,7 +4536,7 @@ comptime { {#syntax#}@call{#endsyntax#} allows more flexibility than normal function call syntax does. The {#syntax#}CallModifier{#endsyntax#} enum is reproduced here:

- {#code|builtin.CallModifier struct.zig#} + {#code|lang.CallModifier struct.zig#} {#header_close#} @@ -4576,7 +4576,7 @@ comptime { an integer, an enum, or a packed struct.

{#syntax#}@typeInfo(@TypeOf(ptr)).pointer.alignment{#endsyntax#} must be {#syntax#}>= @sizeOf(T).{#endsyntax#}

-

{#syntax#}AtomicOrder{#endsyntax#} can be found with {#syntax#}@import("std").builtin.AtomicOrder{#endsyntax#}.

+

{#syntax#}AtomicOrder{#endsyntax#} can be found with {#syntax#}@import("std").lang.AtomicOrder{#endsyntax#}.

{#see_also|@atomicStore|@atomicLoad|@atomicRmw|@cmpxchgWeak#} {#header_close#} @@ -4608,7 +4608,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val an integer, an enum, or a packed struct.

{#syntax#}@typeInfo(@TypeOf(ptr)).pointer.alignment{#endsyntax#} must be {#syntax#}>= @sizeOf(T).{#endsyntax#}

-

{#syntax#}AtomicOrder{#endsyntax#} can be found with {#syntax#}@import("std").builtin.AtomicOrder{#endsyntax#}.

+

{#syntax#}AtomicOrder{#endsyntax#} can be found with {#syntax#}@import("std").lang.AtomicOrder{#endsyntax#}.

{#see_also|@atomicStore|@atomicLoad|@atomicRmw|@cmpxchgStrong#} {#header_close#} @@ -4670,28 +4670,28 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val {#header_close#} {#header_open|@cVaArg#} -
{#syntax#}@cVaArg(operand: *std.builtin.VaList, comptime T: type) T{#endsyntax#}
+
{#syntax#}@cVaArg(operand: *std.lang.VaList, comptime T: type) T{#endsyntax#}

Implements the C macro {#syntax#}va_arg{#endsyntax#}.

{#see_also|@cVaCopy|@cVaEnd|@cVaStart#} {#header_close#} {#header_open|@cVaCopy#} -
{#syntax#}@cVaCopy(src: *std.builtin.VaList) std.builtin.VaList{#endsyntax#}
+
{#syntax#}@cVaCopy(src: *std.lang.VaList) std.lang.VaList{#endsyntax#}

Implements the C macro {#syntax#}va_copy{#endsyntax#}.

{#see_also|@cVaArg|@cVaEnd|@cVaStart#} {#header_close#} {#header_open|@cVaEnd#} -
{#syntax#}@cVaEnd(src: *std.builtin.VaList) void{#endsyntax#}
+
{#syntax#}@cVaEnd(src: *std.lang.VaList) void{#endsyntax#}

Implements the C macro {#syntax#}va_end{#endsyntax#}.

{#see_also|@cVaArg|@cVaCopy|@cVaStart#} {#header_close#} {#header_open|@cVaStart#} -
{#syntax#}@cVaStart() std.builtin.VaList{#endsyntax#}
+
{#syntax#}@cVaStart() std.lang.VaList{#endsyntax#}

Implements the C macro {#syntax#}va_start{#endsyntax#}. Only valid inside a variadic function.

@@ -4800,7 +4800,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val {#header_close#} {#header_open|@errorReturnTrace#} -
{#syntax#}@errorReturnTrace() ?*builtin.StackTrace{#endsyntax#}
+
{#syntax#}@errorReturnTrace() ?*std.lang.StackTrace{#endsyntax#}

If the binary is built with error return tracing, and this function is invoked in a function that calls a function with an error or error union return type, returns a @@ -4818,7 +4818,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val {#header_close#} {#header_open|@export#} -

{#syntax#}@export(comptime ptr: *const anyopaque, comptime options: std.builtin.ExportOptions) void{#endsyntax#}
+
{#syntax#}@export(comptime ptr: *const anyopaque, comptime options: std.lang.ExportOptions) void{#endsyntax#}

Creates a symbol in the output object file which refers to the target of ptr.

ptr must point to a global variable or a comptime-known constant.

@@ -4844,7 +4844,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val {#header_close#} {#header_open|@extern#} -

{#syntax#}@extern(T: type, comptime options: std.builtin.ExternOptions) T{#endsyntax#}
+
{#syntax#}@extern(T: type, comptime options: std.lang.ExternOptions) T{#endsyntax#}

Creates a reference to an external symbol in the output object file. T must be a pointer type. @@ -5165,8 +5165,8 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val

Invokes the panic handler function. By default the panic handler function calls the public {#syntax#}panic{#endsyntax#} function exposed in the root source file, or - if there is not one specified, the {#syntax#}std.builtin.default_panic{#endsyntax#} - function from {#syntax#}std/builtin.zig{#endsyntax#}. + if there is not one specified, the {#syntax#}std.lang.default_panic{#endsyntax#} + function from {#syntax#}std/lang.zig{#endsyntax#}.

Generally it is better to use {#syntax#}@import("std").debug.panic{#endsyntax#}. However, {#syntax#}@panic{#endsyntax#} can be useful for 2 scenarios: @@ -5205,7 +5205,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val address to prefetch. This function does not dereference the pointer, it is perfectly legal to pass a pointer to invalid memory to this function and no Illegal Behavior will result.

-

{#syntax#}PrefetchOptions{#endsyntax#} can be found with {#syntax#}@import("std").builtin.PrefetchOptions{#endsyntax#}.

+

{#syntax#}PrefetchOptions{#endsyntax#} can be found with {#syntax#}@import("std").lang.PrefetchOptions{#endsyntax#}.

{#header_close#} {#header_open|@ptrCast#} @@ -5328,7 +5328,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val The floating point mode is inherited by child scopes, and can be overridden in any scope. You can set the floating point mode in a struct or module scope by using a comptime block.

-

{#syntax#}FloatMode{#endsyntax#} can be found with {#syntax#}@import("std").builtin.FloatMode{#endsyntax#}.

+

{#syntax#}FloatMode{#endsyntax#} can be found with {#syntax#}@import("std").lang.FloatMode{#endsyntax#}.

{#see_also|Floating Point Operations#} {#header_close#} @@ -5464,7 +5464,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val {#header_close#} {#header_open|@reduce#} -
{#syntax#}@reduce(comptime op: std.builtin.ReduceOp, value: anytype) E{#endsyntax#}
+
{#syntax#}@reduce(comptime op: std.lang.ReduceOp, value: anytype) E{#endsyntax#}

Transforms a {#link|vector|Vectors#} into a scalar value (of type E) by performing a sequential horizontal reduction of its elements using the @@ -5494,7 +5494,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val {#header_close#} {#header_open|@src#} -

{#syntax#}@src() std.builtin.SourceLocation{#endsyntax#}
+
{#syntax#}@src() std.lang.SourceLocation{#endsyntax#}

Returns a {#syntax#}SourceLocation{#endsyntax#} struct representing the function's name and location in the source code. This must be called in a function.

@@ -5721,7 +5721,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val {#header_close#} {#header_open|@Int#} -
{#syntax#}@Int(comptime signedness: std.builtin.Signedness, comptime bits: u16) type{#endsyntax#}
+
{#syntax#}@Int(comptime signedness: std.lang.Signedness, comptime bits: u16) type{#endsyntax#}

Returns an integer type with the given signedness and bit width.

For instance, {#syntax#}@Int(.unsigned, 18){#endsyntax#} returns the type {#syntax#}u18{#endsyntax#}.

{#header_close#} @@ -5733,8 +5733,8 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val {#header_open|@Pointer#}
{#syntax#}@Pointer(
-    comptime size: std.builtin.Type.Pointer.Size,
-    comptime attrs: std.builtin.Type.Pointer.Attributes,
+    comptime size: std.lang.Type.Pointer.Size,
+    comptime attrs: std.lang.Type.Pointer.Attributes,
     comptime Element: type,
     comptime sentinel: ?Element,
 ) type{#endsyntax#}
@@ -5744,32 +5744,32 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val {#header_open|@Fn#}
{#syntax#}@Fn(
     comptime param_types: []const type,
-    comptime param_attrs: *const [param_types.len]std.builtin.Type.Fn.Param.Attributes,
+    comptime param_attrs: *const [param_types.len]std.lang.Type.Fn.Param.Attributes,
     comptime ReturnType: type,
-    comptime attrs: std.builtin.Type.Fn.Attributes,
+    comptime attrs: std.lang.Type.Fn.Attributes,
 ) type{#endsyntax#}

Returns a {#link|function|Functions#} type with the properties specified by the arguments.

{#header_close#} {#header_open|@Struct#}
{#syntax#}@Struct(
-    comptime layout: std.builtin.Type.ContainerLayout,
+    comptime layout: std.lang.Type.ContainerLayout,
     comptime BackingInt: ?type,
     comptime field_names: []const []const u8,
     comptime field_types: *const [field_names.len]type,
-    comptime field_attrs: *const [field_names.len]std.builtin.Type.StructField.Attributes,
+    comptime field_attrs: *const [field_names.len]std.lang.Type.StructField.Attributes,
 ) type{#endsyntax#}

Returns a {#link|struct#} type with the properties specified by the arguments.

{#header_close#} {#header_open|@Union#}
{#syntax#}@Union(
-    comptime layout: std.builtin.Type.ContainerLayout,
+    comptime layout: std.lang.Type.ContainerLayout,
     /// Either the integer tag type, or the integer backing type, depending on `layout`.
     comptime ArgType: ?type,
     comptime field_names: []const []const u8,
     comptime field_types: *const [field_names.len]type,
-    comptime field_attrs: *const [field_names.len]std.builtin.Type.UnionField.Attributes,
+    comptime field_attrs: *const [field_names.len]std.lang.Type.UnionField.Attributes,
 ) type{#endsyntax#}

Returns a {#link|union#} type with the properties specified by the arguments.

{#header_close#} @@ -5777,7 +5777,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val {#header_open|@Enum#}
{#syntax#}@Enum(
     comptime TagInt: type,
-    comptime mode: std.builtin.Type.Enum.Mode,
+    comptime mode: std.lang.Type.Enum.Mode,
     comptime field_names: []const []const u8,
     comptime field_values: *const [field_names.len]TagInt,
 ) type{#endsyntax#}
@@ -5785,7 +5785,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val {#header_close#} {#header_open|@typeInfo#} -
{#syntax#}@typeInfo(comptime T: type) std.builtin.Type{#endsyntax#}
+
{#syntax#}@typeInfo(comptime T: type) std.lang.Type{#endsyntax#}

Provides type reflection.

diff --git a/doc/langref/builtin.CallModifier struct.zig b/doc/langref/lang.CallModifier struct.zig similarity index 100% rename from doc/langref/builtin.CallModifier struct.zig rename to doc/langref/lang.CallModifier struct.zig diff --git a/doc/langref/test_noreturn_from_exit.zig b/doc/langref/test_noreturn_from_exit.zig index 22ea8b4f491f5f01342af8ddb8a8324684a24384..ce7d5122ec49edbb888e235142f38035a82d736b 100644 --- a/doc/langref/test_noreturn_from_exit.zig +++ b/doc/langref/test_noreturn_from_exit.zig @@ -1,10 +1,7 @@ const std = @import("std"); -const builtin = @import("builtin"); -const native_arch = builtin.cpu.arch; const expectEqual = std.testing.expectEqual; -const WINAPI: std.builtin.CallingConvention = if (native_arch == .x86) .{ .x86_stdcall = .{} } else .c; -extern "kernel32" fn ExitProcess(exit_code: c_uint) callconv(WINAPI) noreturn; +extern "kernel32" fn ExitProcess(exit_code: c_uint) callconv(.winapi) noreturn; test "foo" { const value = bar() catch ExitProcess(1); -- 2.54.0