From 175463d75dbde1e8e4c5a55159ab4e9446fd211c Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Tue, 7 Dec 2021 19:34:44 +0100 Subject: AstGen: implement @prefetch() builtin --- lib/std/builtin.zig | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'lib/std') 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 @@ -651,6 +651,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 { -- cgit v1.2.3