aboutsummaryrefslogtreecommitdiff
path: root/src/target.zig
diff options
context:
space:
mode:
authorRobin Voetter <robin@voetter.nl>2021-09-06 00:29:04 +0200
committerRobin Voetter <robin@voetter.nl>2021-09-20 02:29:04 +0200
commit95e83afa98c5af89c6e5f40d559eb54c6c31a54e (patch)
treef1616f0a6a546a0ff7434b56b6efd1d0a3213c0f /src/target.zig
parent5a142dfa5651ec21792de211a6e9341c31ab4dbb (diff)
downloadzig-95e83afa98c5af89c6e5f40d559eb54c6c31a54e.tar.gz
zig-95e83afa98c5af89c6e5f40d559eb54c6c31a54e.zip
Address Spaces: Yeet address space on function prototypes
This is a property which solely belongs to pointers to functions, not to the functions themselves. This cannot be properly represented by stage 2 at the moment, as type with zigTypeTag() == .Fn is overloaded for for function pointers and function prototypes.
Diffstat (limited to 'src/target.zig')
-rw-r--r--src/target.zig18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/target.zig b/src/target.zig
index c9d7e1742b..09e65ff909 100644
--- a/src/target.zig
+++ b/src/target.zig
@@ -544,3 +544,21 @@ pub fn largestAtomicBits(target: std.Target) u32 {
.x86_64 => 128,
};
}
+
+pub fn defaultAddressSpace(
+ target: std.Target,
+ context: enum {
+ /// Query the default address space for global constant values.
+ global_constant,
+ /// Query the default address space for global mutable values.
+ global_mutable,
+ /// Query the default address space for function-local values.
+ local,
+ /// Query the default address space for functions themselves.
+ function,
+ },
+) std.builtin.AddressSpace {
+ _ = target;
+ _ = context;
+ return .generic;
+}