pub struct PrefetchHint {
pub write: bool,
pub locality: u8,
}Expand description
What a crate::Opcode::Prefetch says about the access it is a hint for.
Two facts, both of them out of __builtin_prefetch’s own arguments, and neither of them a
promise. A prefetch that says the wrong thing, or a target that ignores it, changes how long
the program takes and nothing else, so nothing downstream may read either of these as a fact
about what the program will do.
Fields§
§write: boolWhether the access being prepared for will write, which is the second argument.
It matters on a machine that has separate instructions for the two, because a line fetched
for writing is fetched in a state that does not have to be asked for again when the write
happens. x86-64 has one for it, prefetchw, and only on a processor that says it has it,
so this reaches the back end and the back end decides.
locality: u8How much of the data will still be wanted after the access, from zero for none of it to three for all of it, which is the third argument.
Three is the default and is what a program that writes the one argument form means. Zero is
the one that is a different instruction rather than a different cache level on x86-64: it
says the line is wanted once, so prefetchnta fetches it in a way that does not push
anything else out.
Implementations§
Source§impl PrefetchHint
impl PrefetchHint
Sourcepub const MOST: u8 = 3
pub const MOST: u8 = 3
The highest locality, which is the one the one argument form of the builtin means.
Sourcepub const fn read() -> Self
pub const fn read() -> Self
The hint a call that said nothing beyond the address means, which is a read that will want all of the data afterwards.
Sourcepub const fn access(self) -> &'static str
pub const fn access(self) -> &'static str
The word for which half of the access this is about, which is how it prints.
Sourcepub const fn is_valid(self) -> bool
pub const fn is_valid(self) -> bool
Whether the locality is one of the four the builtin has.
Asked by the verifier. Nothing here clamps an out of range one, because a number this did
not come from __builtin_prefetch’s third argument is a bug in whoever built the
instruction rather than something a program wrote.
Trait Implementations§
Source§impl Clone for PrefetchHint
impl Clone for PrefetchHint
Source§fn clone(&self) -> PrefetchHint
fn clone(&self) -> PrefetchHint
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more