mirror of
https://github.com/ziglang/zig.git
synced 2025-12-16 03:03:09 +00:00
std.builtin: move AddressSpace.Context to std.Target.AddressSpaceContext
This type has nothing to do with the language.
This commit is contained in:
parent
af1d777b27
commit
340d6ce1bf
@ -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
|
/// 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
|
/// function simply answers the general question of whether the target has any concept
|
||||||
/// of `address_space`; if non-`null`, the function additionally checks whether
|
/// 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(
|
pub fn supportsAddressSpace(
|
||||||
target: Target,
|
target: Target,
|
||||||
address_space: std.builtin.AddressSpace,
|
address_space: std.builtin.AddressSpace,
|
||||||
context: ?std.builtin.AddressSpace.Context,
|
context: ?AddressSpaceContext,
|
||||||
) bool {
|
) bool {
|
||||||
const arch = target.cpu.arch;
|
const arch = target.cpu.arch;
|
||||||
|
|
||||||
|
|||||||
@ -517,21 +517,6 @@ pub const CallingConvention = union(enum(u8)) {
|
|||||||
/// This data structure is used by the Zig language code generation and
|
/// This data structure is used by the Zig language code generation and
|
||||||
/// therefore must be kept in sync with the compiler implementation.
|
/// therefore must be kept in sync with the compiler implementation.
|
||||||
pub const AddressSpace = enum(u5) {
|
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.
|
// CPU address spaces.
|
||||||
generic,
|
generic,
|
||||||
gs,
|
gs,
|
||||||
|
|||||||
@ -36517,7 +36517,7 @@ fn resolveAddressSpace(
|
|||||||
block: *Block,
|
block: *Block,
|
||||||
src: LazySrcLoc,
|
src: LazySrcLoc,
|
||||||
zir_ref: Zir.Inst.Ref,
|
zir_ref: Zir.Inst.Ref,
|
||||||
ctx: std.builtin.AddressSpace.Context,
|
ctx: std.Target.AddressSpaceContext,
|
||||||
) !std.builtin.AddressSpace {
|
) !std.builtin.AddressSpace {
|
||||||
const air_ref = try sema.resolveInst(zir_ref);
|
const air_ref = try sema.resolveInst(zir_ref);
|
||||||
return sema.analyzeAsAddressSpace(block, src, air_ref, ctx);
|
return sema.analyzeAsAddressSpace(block, src, air_ref, ctx);
|
||||||
@ -36528,7 +36528,7 @@ pub fn analyzeAsAddressSpace(
|
|||||||
block: *Block,
|
block: *Block,
|
||||||
src: LazySrcLoc,
|
src: LazySrcLoc,
|
||||||
air_ref: Air.Inst.Ref,
|
air_ref: Air.Inst.Ref,
|
||||||
ctx: std.builtin.AddressSpace.Context,
|
ctx: std.Target.AddressSpaceContext,
|
||||||
) !std.builtin.AddressSpace {
|
) !std.builtin.AddressSpace {
|
||||||
const pt = sema.pt;
|
const pt = sema.pt;
|
||||||
const addrspace_ty = try sema.getBuiltinType(src, .AddressSpace);
|
const addrspace_ty = try sema.getBuiltinType(src, .AddressSpace);
|
||||||
@ -37653,7 +37653,7 @@ pub fn resolveNavPtrModifiers(
|
|||||||
};
|
};
|
||||||
|
|
||||||
const @"addrspace": std.builtin.AddressSpace = as: {
|
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,
|
.@"var" => .variable,
|
||||||
else => switch (nav_ty.zigTypeTag(zcu)) {
|
else => switch (nav_ty.zigTypeTag(zcu)) {
|
||||||
.@"fn" => .function,
|
.@"fn" => .function,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user