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
signature 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 {
22282228 };
22292229}
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
22312246/// Returns whether this target supports `address_space`. If `context` is `null`, this
22322247/// function simply answers the general question of whether the target has any concept
22332248/// of `address_space`; if non-`null`, the function additionally checks whether
......@@ -2235,7 +2250,7 @@ pub fn requiresLibC(target: *const Target) bool {
22352250pub fn supportsAddressSpace(
22362251 target: Target,
22372252 address_space: std.builtin.AddressSpace,
2238 context: ?std.builtin.AddressSpace.Context,
2253 context: ?AddressSpaceContext,
22392254) bool {
22402255 const arch = target.cpu.arch;
22412256
lib/std/builtin.zig-15
......@@ -517,21 +517,6 @@ pub const CallingConvention = union(enum(u8)) {
517517/// This data structure is used by the Zig language code generation and
518518/// therefore must be kept in sync with the compiler implementation.
519519pub 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
535520 // CPU address spaces.
536521 generic,
537522 gs,
src/Sema.zig+3-3
......@@ -36517,7 +36517,7 @@ fn resolveAddressSpace(
3651736517 block: *Block,
3651836518 src: LazySrcLoc,
3651936519 zir_ref: Zir.Inst.Ref,
36520 ctx: std.builtin.AddressSpace.Context,
36520 ctx: std.Target.AddressSpaceContext,
3652136521) !std.builtin.AddressSpace {
3652236522 const air_ref = try sema.resolveInst(zir_ref);
3652336523 return sema.analyzeAsAddressSpace(block, src, air_ref, ctx);
......@@ -36528,7 +36528,7 @@ pub fn analyzeAsAddressSpace(
3652836528 block: *Block,
3652936529 src: LazySrcLoc,
3653036530 air_ref: Air.Inst.Ref,
36531 ctx: std.builtin.AddressSpace.Context,
36531 ctx: std.Target.AddressSpaceContext,
3653236532) !std.builtin.AddressSpace {
3653336533 const pt = sema.pt;
3653436534 const addrspace_ty = try sema.getBuiltinType(src, .AddressSpace);
......@@ -37653,7 +37653,7 @@ pub fn resolveNavPtrModifiers(
3765337653 };
3765437654
3765537655 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) {
3765737657 .@"var" => .variable,
3765837658 else => switch (nav_ty.zigTypeTag(zcu)) {
3765937659 .@"fn" => .function,