authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-10-20 21:33:24+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-10-23 09:27:17+02:00
log340d6ce1bf30556089bdefa60abf50f81617ceb2
tree6b85feb49f4fd016e7679b2d15a800925a8d498b
parentaf1d777b27641e2dedb70d19e3e4f5b04fa62a6e
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

std.builtin: move AddressSpace.Context to std.Target.AddressSpaceContext

This type has nothing to do with the language.

3 files changed, 19 insertions(+), 19 deletions(-)

lib/std/Target.zig+16-1
...@@ -2228,6 +2228,21 @@ pub fn requiresLibC(target: *const Target) bool {...@@ -2228,6 +2228,21 @@ pub fn requiresLibC(target: *const Target) bool {
2228 };2228 };
2229}2229}
22302230
2231/// The places where a user can specify an address space attribute
2232pub const AddressSpaceContext = enum {
2233 /// A function is specified to be placed in a certain address space.
2234 function,
2235 /// A (global) variable is specified to be placed in a certain address space. In contrast to
2236 /// `.constant`, these values (and thus the address space they will be placed in) are required
2237 /// to be mutable.
2238 variable,
2239 /// A (global) constant value is specified to be placed in a certain address space. In contrast
2240 /// to `.variable`, values placed in this address space are not required to be mutable.
2241 constant,
2242 /// A pointer is ascripted to point into a certain address space.
2243 pointer,
2244};
2245
2231/// Returns whether this target supports `address_space`. If `context` is `null`, this2246/// Returns whether this target supports `address_space`. If `context` is `null`, this
2232/// function simply answers the general question of whether the target has any concept2247/// function simply answers the general question of whether the target has any concept
2233/// of `address_space`; if non-`null`, the function additionally checks whether2248/// of `address_space`; if non-`null`, the function additionally checks whether
...@@ -2235,7 +2250,7 @@ pub fn requiresLibC(target: *const Target) bool {...@@ -2235,7 +2250,7 @@ pub fn requiresLibC(target: *const Target) bool {
2235pub fn supportsAddressSpace(2250pub fn supportsAddressSpace(
2236 target: Target,2251 target: Target,
2237 address_space: std.builtin.AddressSpace,2252 address_space: std.builtin.AddressSpace,
2238 context: ?std.builtin.AddressSpace.Context,2253 context: ?AddressSpaceContext,
2239) bool {2254) bool {
2240 const arch = target.cpu.arch;2255 const arch = target.cpu.arch;
22412256
lib/std/builtin.zig-15
...@@ -517,21 +517,6 @@ pub const CallingConvention = union(enum(u8)) {...@@ -517,21 +517,6 @@ pub const CallingConvention = union(enum(u8)) {
517/// This data structure is used by the Zig language code generation and517/// This data structure is used by the Zig language code generation and
518/// therefore must be kept in sync with the compiler implementation.518/// therefore must be kept in sync with the compiler implementation.
519pub const AddressSpace = enum(u5) {519pub const AddressSpace = enum(u5) {
520 /// The places where a user can specify an address space attribute
521 pub const Context = enum {
522 /// A function is specified to be placed in a certain address space.
523 function,
524 /// A (global) variable is specified to be placed in a certain address space.
525 /// In contrast to .constant, these values (and thus the address space they will be
526 /// placed in) are required to be mutable.
527 variable,
528 /// A (global) constant value is specified to be placed in a certain address space.
529 /// In contrast to .variable, values placed in this address space are not required to be mutable.
530 constant,
531 /// A pointer is ascripted to point into a certain address space.
532 pointer,
533 };
534
535 // CPU address spaces.520 // CPU address spaces.
536 generic,521 generic,
537 gs,522 gs,
src/Sema.zig+3-3
...@@ -36517,7 +36517,7 @@ fn resolveAddressSpace(...@@ -36517,7 +36517,7 @@ fn resolveAddressSpace(
36517 block: *Block,36517 block: *Block,
36518 src: LazySrcLoc,36518 src: LazySrcLoc,
36519 zir_ref: Zir.Inst.Ref,36519 zir_ref: Zir.Inst.Ref,
36520 ctx: std.builtin.AddressSpace.Context,36520 ctx: std.Target.AddressSpaceContext,
36521) !std.builtin.AddressSpace {36521) !std.builtin.AddressSpace {
36522 const air_ref = try sema.resolveInst(zir_ref);36522 const air_ref = try sema.resolveInst(zir_ref);
36523 return sema.analyzeAsAddressSpace(block, src, air_ref, ctx);36523 return sema.analyzeAsAddressSpace(block, src, air_ref, ctx);
...@@ -36528,7 +36528,7 @@ pub fn analyzeAsAddressSpace(...@@ -36528,7 +36528,7 @@ pub fn analyzeAsAddressSpace(
36528 block: *Block,36528 block: *Block,
36529 src: LazySrcLoc,36529 src: LazySrcLoc,
36530 air_ref: Air.Inst.Ref,36530 air_ref: Air.Inst.Ref,
36531 ctx: std.builtin.AddressSpace.Context,36531 ctx: std.Target.AddressSpaceContext,
36532) !std.builtin.AddressSpace {36532) !std.builtin.AddressSpace {
36533 const pt = sema.pt;36533 const pt = sema.pt;
36534 const addrspace_ty = try sema.getBuiltinType(src, .AddressSpace);36534 const addrspace_ty = try sema.getBuiltinType(src, .AddressSpace);
...@@ -37653,7 +37653,7 @@ pub fn resolveNavPtrModifiers(...@@ -37653,7 +37653,7 @@ pub fn resolveNavPtrModifiers(
37653 };37653 };
3765437654
37655 const @"addrspace": std.builtin.AddressSpace = as: {37655 const @"addrspace": std.builtin.AddressSpace = as: {
37656 const addrspace_ctx: std.builtin.AddressSpace.Context = switch (zir_decl.kind) {37656 const addrspace_ctx: std.Target.AddressSpaceContext = switch (zir_decl.kind) {
37657 .@"var" => .variable,37657 .@"var" => .variable,
37658 else => switch (nav_ty.zigTypeTag(zcu)) {37658 else => switch (nav_ty.zigTypeTag(zcu)) {
37659 .@"fn" => .function,37659 .@"fn" => .function,