diff options
| author | Isaac Freund <isaac.freund@coil.com> | 2021-12-07 19:34:44 +0100 |
|---|---|---|
| committer | Isaac Freund <mail@isaacfreund.com> | 2021-12-10 23:09:02 +0100 |
| commit | 175463d75dbde1e8e4c5a55159ab4e9446fd211c (patch) | |
| tree | 523bb9e42429e97c288838ab42ee59e18edbaca0 /lib | |
| parent | 47c309c34a23bcec9b3d72dade688965893614a4 (diff) | |
| download | zig-175463d75dbde1e8e4c5a55159ab4e9446fd211c.tar.gz zig-175463d75dbde1e8e4c5a55159ab4e9446fd211c.zip | |
AstGen: implement @prefetch() builtin
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/std/builtin.zig | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/std/builtin.zig b/lib/std/builtin.zig index 9ce8c1c38e..2ffbdaa5ad 100644 --- a/lib/std/builtin.zig +++ b/lib/std/builtin.zig @@ -653,6 +653,31 @@ pub const CallOptions = struct { /// This data structure is used by the Zig language code generation and /// therefore must be kept in sync with the compiler implementation. +pub const PrefetchOptions = struct { + /// Whether the prefetch should prepare for a read or a write. + rw: Rw = .read, + /// 0 means no temporal locality. That is, the data can be immediately + /// dropped from the cache after it is accessed. + /// + /// 3 means high temporal locality. That is, the data should be kept in + /// the cache as it is likely to be accessed again soon. + locality: u2 = 3, + /// The cache that the prefetch should be preformed on. + cache: Cache = .data, + + pub const Rw = enum { + read, + write, + }; + + pub const Cache = enum { + instruction, + data, + }; +}; + +/// This data structure is used by the Zig language code generation and +/// therefore must be kept in sync with the compiler implementation. pub const ExportOptions = struct { name: []const u8, linkage: GlobalLinkage = .Strong, |
