diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-12-10 18:54:56 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-12-10 18:54:56 -0800 |
| commit | 97c0373fa7ee125d2d4e73f9b1dc8ea0e2c2e86a (patch) | |
| tree | d2aa342a53aef95f88456a63fa7874f3c51ba3b8 /lib/std/builtin.zig | |
| parent | 75f3e7a4a05db7ea805e581f78117a41768945ae (diff) | |
| parent | 516945d7d9b4d8b969d037076799d4ed29cecdda (diff) | |
| download | zig-97c0373fa7ee125d2d4e73f9b1dc8ea0e2c2e86a.tar.gz zig-97c0373fa7ee125d2d4e73f9b1dc8ea0e2c2e86a.zip | |
Merge pull request #10295 from ifreund/prefetch
Implement @prefetch()
Diffstat (limited to 'lib/std/builtin.zig')
| -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, |
