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

This type has nothing to do with the language.
This commit is contained in:
Alex Rønne Petersen 2025-10-20 21:33:24 +02:00
parent af1d777b27
commit 340d6ce1bf
No known key found for this signature in database
3 changed files with 19 additions and 19 deletions

View File

@ -2228,6 +2228,21 @@ pub fn requiresLibC(target: *const Target) bool {
};
}
/// The places where a user can specify an address space attribute
pub const AddressSpaceContext = enum {
/// A function is specified to be placed in a certain address space.
function,
/// A (global) variable is specified to be placed in a certain address space. In contrast to
/// `.constant`, these values (and thus the address space they will be placed in) are required
/// to be mutable.
variable,
/// A (global) constant value is specified to be placed in a certain address space. In contrast
/// to `.variable`, values placed in this address space are not required to be mutable.
constant,
/// A pointer is ascripted to point into a certain address space.
pointer,
};
/// Returns whether this target supports `address_space`. If `context` is `null`, this
/// function simply answers the general question of whether the target has any concept
/// of `address_space`; if non-`null`, the function additionally checks whether
@ -2235,7 +2250,7 @@ pub fn requiresLibC(target: *const Target) bool {
pub fn supportsAddressSpace(
target: Target,
address_space: std.builtin.AddressSpace,
context: ?std.builtin.AddressSpace.Context,
context: ?AddressSpaceContext,
) bool {
const arch = target.cpu.arch;

View File

@ -517,21 +517,6 @@ pub const CallingConvention = union(enum(u8)) {
/// This data structure is used by the Zig language code generation and
/// therefore must be kept in sync with the compiler implementation.
pub const AddressSpace = enum(u5) {
/// The places where a user can specify an address space attribute
pub const Context = enum {
/// A function is specified to be placed in a certain address space.
function,
/// A (global) variable is specified to be placed in a certain address space.
/// In contrast to .constant, these values (and thus the address space they will be
/// placed in) are required to be mutable.
variable,
/// A (global) constant value is specified to be placed in a certain address space.
/// In contrast to .variable, values placed in this address space are not required to be mutable.
constant,
/// A pointer is ascripted to point into a certain address space.
pointer,
};
// CPU address spaces.
generic,
gs,

View File

@ -36517,7 +36517,7 @@ fn resolveAddressSpace(
block: *Block,
src: LazySrcLoc,
zir_ref: Zir.Inst.Ref,
ctx: std.builtin.AddressSpace.Context,
ctx: std.Target.AddressSpaceContext,
) !std.builtin.AddressSpace {
const air_ref = try sema.resolveInst(zir_ref);
return sema.analyzeAsAddressSpace(block, src, air_ref, ctx);
@ -36528,7 +36528,7 @@ pub fn analyzeAsAddressSpace(
block: *Block,
src: LazySrcLoc,
air_ref: Air.Inst.Ref,
ctx: std.builtin.AddressSpace.Context,
ctx: std.Target.AddressSpaceContext,
) !std.builtin.AddressSpace {
const pt = sema.pt;
const addrspace_ty = try sema.getBuiltinType(src, .AddressSpace);
@ -37653,7 +37653,7 @@ pub fn resolveNavPtrModifiers(
};
const @"addrspace": std.builtin.AddressSpace = as: {
const addrspace_ctx: std.builtin.AddressSpace.Context = switch (zir_decl.kind) {
const addrspace_ctx: std.Target.AddressSpaceContext = switch (zir_decl.kind) {
.@"var" => .variable,
else => switch (nav_ty.zigTypeTag(zcu)) {
.@"fn" => .function,