aboutsummaryrefslogtreecommitdiff
path: root/lib/std/builtin.zig
diff options
context:
space:
mode:
authorAlex Rønne Petersen <alex@alexrp.com>2025-01-24 01:58:31 +0100
committerAlex Rønne Petersen <alex@alexrp.com>2025-02-17 19:17:56 +0100
commit00481668671a8719627922a05a1c143f9d0409ed (patch)
treec4433588297c002fe6424bacb48f2b6c15e10a48 /lib/std/builtin.zig
parentaa4ac2f85fc145dafcd4de18065bdfa28f17cea0 (diff)
downloadzig-00481668671a8719627922a05a1c143f9d0409ed.tar.gz
zig-00481668671a8719627922a05a1c143f9d0409ed.zip
std.Target: Make Cpu.Arch.supportsAddressSpace() take an optional context.
Allows deduplicating the code in Sema.
Diffstat (limited to 'lib/std/builtin.zig')
-rw-r--r--lib/std/builtin.zig15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/std/builtin.zig b/lib/std/builtin.zig
index dfa8862456..19570c28b6 100644
--- a/lib/std/builtin.zig
+++ b/lib/std/builtin.zig
@@ -491,6 +491,21 @@ 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,