Struct cranelift_codegen::ir::MemFlags [−][src]
pub struct MemFlags { /* fields omitted */ }
Expand description
Flags for memory operations like load/store.
Each of these flags introduce a limited form of undefined behavior. The flags each enable certain optimizations that need to make additional assumptions. Generally, the semantics of a program does not change when a flag is removed, but adding a flag will.
In addition, the flags determine the endianness of the memory access. By default, any memory access uses the native endianness determined by the target ISA. This can be overridden for individual accesses by explicitly specifying little- or big-endian semantics via the flags.
Implementations
Create a set of flags representing an access from a “trusted” address, meaning it’s known to be aligned and non-trapping.
Set a flag bit by name.
Returns true if the flag was found and set, false for an unknown flag name. Will also return false when trying to set inconsistent endianness flags.
Return endianness of the memory access. This will return the endianness explicitly specified by the flags if any, and will default to the native endianness otherwise. The native endianness has to be provided by the caller since it is not explicitly encoded in CLIF IR – this allows a front end to create IR without having to know the target endianness.
Set endianness of the memory access.
Test if the notrap
flag is set.
Normally, trapping is part of the semantics of a load/store operation. If the platform would cause a trap when accessing the effective address, the Cranelift memory operation is also required to trap.
The notrap
flag tells Cranelift that the memory is accessible, which means that
accesses will not trap. This makes it possible to delete an unused load or a dead store
instruction.
Set the notrap
flag.
Test if the aligned
flag is set.
By default, Cranelift memory instructions work with any unaligned effective address. If the
aligned
flag is set, the instruction is permitted to trap or return a wrong result if the
effective address is misaligned.
Set the aligned
flag.
Test if the readonly
flag is set.
Loads with this flag have no memory dependencies. This results in undefined behavior if the dereferenced memory is mutated at any time between when the function is called and when it is exited.
Set the readonly
flag.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for MemFlags
impl UnwindSafe for MemFlags
Blanket Implementations
Mutably borrows from an owned value. Read more
Compare self to key
and return true
if they are equal.