pub struct Flags(/* private fields */);Expand description
The flags on one instruction.
A bitset rather than a struct of bools, because it rides along in the instruction table
and two bytes there is two bytes per instruction in every function in the program.
Implementations§
Source§impl Flags
impl Flags
Sourcepub const NONE: Self
pub const NONE: Self
No flags, which is what -O0 and -fwrapv and a plain unsigned addition all produce.
Sourcepub const NSW: Self
pub const NSW: Self
No signed wrap. Signed overflow is undefined, so the optimizer may assume it does not
happen. -fwrapv stops the frontend setting this and nothing else changes.
Sourcepub const NUW: Self
pub const NUW: Self
No unsigned wrap. Set only where the frontend knows it from the source, since C’s unsigned arithmetic wraps by definition and most unsigned arithmetic does not get this.
Sourcepub const EXACT: Self
pub const EXACT: Self
The shift or division is exact, so no bits are discarded and no remainder is dropped.
Sourcepub const REASSOC: Self
pub const REASSOC: Self
The operation may be reassociated, which is the one that changes results the most.
Sourcepub const VOLATILE: Self
pub const VOLATILE: Self
The access is volatile, so it happens exactly once and is never moved or merged.
Sourcepub const NOALIAS: Self
pub const NOALIAS: Self
The result does not alias anything else reachable, which is what restrict gives.
Sourcepub const fn bits(self) -> u16
pub const fn bits(self) -> u16
The underlying bits, for the printer and for hashing an instruction.
Sourcepub const fn intersection(self, other: Self) -> Self
pub const fn intersection(self, other: Self) -> Self
The flags in both sets.
This is what a rewrite does when it replaces two instructions with one: a licence granted on one of them and not the other is not a licence over the result.
Sourcepub const fn legal_on(opcode: Opcode) -> Self
pub const fn legal_on(opcode: Opcode) -> Self
The flags that mean anything on that opcode.
Anything outside this is a verifier failure rather than something ignored, because a flag on an instruction that does not read it is a flag somebody meant to put somewhere else.
Trait Implementations§
Source§impl BitOrAssign for Flags
impl BitOrAssign for Flags
Source§fn bitor_assign(&mut self, other: Self)
fn bitor_assign(&mut self, other: Self)
|= operation. Read more