Struct cranelift_codegen::settings::Flags
source · [−]pub struct Flags { /* private fields */ }
Expand description
Flags group shared
.
Implementations
sourceimpl Flags
impl Flags
User-defined settings.
sourcepub fn predicate_view(&self) -> PredicateView<'_>
pub fn predicate_view(&self) -> PredicateView<'_>
Get a view of the boolean predicates.
sourcepub fn opt_level(&self) -> OptLevel
pub fn opt_level(&self) -> OptLevel
Optimization level for generated code.
Supported levels:
none
: Minimise compile time by disabling most optimizations.speed
: Generate the fastest possible codespeed_and_size
: like “speed”, but also perform transformations aimed at reducing code size.
sourcepub fn libcall_call_conv(&self) -> LibcallCallConv
pub fn libcall_call_conv(&self) -> LibcallCallConv
Defines the calling convention to use for LibCalls call expansion.
This may be different from the ISA default calling convention.
The default value is to use the same calling convention as the ISA default calling convention.
This list should be kept in sync with the list of calling conventions available in isa/call_conv.rs.
sourcepub fn baldrdash_prologue_words(&self) -> u8
pub fn baldrdash_prologue_words(&self) -> u8
Number of pointer-sized words pushed by the baldrdash prologue.
Functions with the baldrdash
calling convention don’t generate their
own prologue and epilogue. They depend on externally generated code
that pushes a fixed number of words in the prologue and restores them
in the epilogue.
This setting configures the number of pointer-sized words pushed on the stack when the Cranelift-generated code is entered. This includes the pushed return address on x86.
sourcepub fn probestack_size_log2(&self) -> u8
pub fn probestack_size_log2(&self) -> u8
The log2 of the size of the stack guard region.
Stack frames larger than this size will have stack overflow checked by calling the probestack function.
The default is 12, which translates to a size of 4096.
sourcepub fn regalloc_checker(&self) -> bool
pub fn regalloc_checker(&self) -> bool
Enable the symbolic checker for register allocation.
This performs a verification that the register allocator preserves equivalent dataflow with respect to the original (pre-regalloc) program. This analysis is somewhat expensive. However, if it succeeds, it provides independent evidence (by a carefully-reviewed, from-first-principles analysis) that no regalloc bugs were triggered for the particular compilations performed. This is a valuable assurance to have as regalloc bugs can be very dangerous and difficult to debug.
sourcepub fn enable_alias_analysis(&self) -> bool
pub fn enable_alias_analysis(&self) -> bool
Do redundant-load optimizations with alias analysis.
This enables the use of a simple alias analysis to optimize away redundant loads.
Only effective when opt_level
is speed
or speed_and_size
.
sourcepub fn enable_verifier(&self) -> bool
pub fn enable_verifier(&self) -> bool
Run the Cranelift IR verifier at strategic times during compilation.
This makes compilation slower but catches many bugs. The verifier is always enabled by default, which is useful during development.
sourcepub fn use_colocated_libcalls(&self) -> bool
pub fn use_colocated_libcalls(&self) -> bool
Use colocated libcalls.
Generate code that assumes that libcalls can be declared “colocated”, meaning they will be defined along with the current function, such that they can use more efficient addressing.
sourcepub fn avoid_div_traps(&self) -> bool
pub fn avoid_div_traps(&self) -> bool
Generate explicit checks around native division instructions to avoid their trapping.
This is primarily used by SpiderMonkey which doesn’t install a signal handler for SIGFPE, but expects a SIGILL trap for division by zero.
On ISAs like ARM where the native division instructions don’t trap, this setting has no effect - explicit checks are always inserted.
sourcepub fn enable_float(&self) -> bool
pub fn enable_float(&self) -> bool
Enable the use of floating-point instructions.
Disabling use of floating-point instructions is not yet implemented.
sourcepub fn enable_nan_canonicalization(&self) -> bool
pub fn enable_nan_canonicalization(&self) -> bool
Enable NaN canonicalization.
This replaces NaNs with a single canonical value, for users requiring entirely deterministic WebAssembly computation. This is not required by the WebAssembly spec, so it is not enabled by default.
sourcepub fn enable_pinned_reg(&self) -> bool
pub fn enable_pinned_reg(&self) -> bool
Enable the use of the pinned register.
This register is excluded from register allocation, and is completely under the control of the end-user. It is possible to read it via the get_pinned_reg instruction, and to set it with the set_pinned_reg instruction.
sourcepub fn use_pinned_reg_as_heap_base(&self) -> bool
pub fn use_pinned_reg_as_heap_base(&self) -> bool
Use the pinned register as the heap base.
Enabling this requires the enable_pinned_reg setting to be set to true. It enables a custom
legalization of the heap_addr
instruction so it will use the pinned register as the heap
base, instead of fetching it from a global value.
Warning! Enabling this means that the pinned register must be maintained to contain the heap base address at all times, during the lifetime of a function. Using the pinned register for other purposes when this is set is very likely to cause crashes.
sourcepub fn enable_simd(&self) -> bool
pub fn enable_simd(&self) -> bool
Enable the use of SIMD instructions.
sourcepub fn enable_atomics(&self) -> bool
pub fn enable_atomics(&self) -> bool
Enable the use of atomic instructions
sourcepub fn enable_safepoints(&self) -> bool
pub fn enable_safepoints(&self) -> bool
Enable safepoint instruction insertions.
This will allow the emit_stack_maps() function to insert the safepoint instruction on top of calls and interrupt traps in order to display the live reference values at that point in the program.
sourcepub fn enable_llvm_abi_extensions(&self) -> bool
pub fn enable_llvm_abi_extensions(&self) -> bool
Enable various ABI extensions defined by LLVM’s behavior.
In some cases, LLVM’s implementation of an ABI (calling convention) goes beyond a standard and supports additional argument types or behavior. This option instructs Cranelift codegen to follow LLVM’s behavior where applicable.
Currently, this applies only to Windows Fastcall on x86-64, and
allows an i128
argument to be spread across two 64-bit integer
registers. The Fastcall implementation otherwise does not support
i128
arguments, and will panic if they are present and this
option is not set.
sourcepub fn unwind_info(&self) -> bool
pub fn unwind_info(&self) -> bool
Generate unwind information.
This increases metadata size and compile time, but allows for the debugger to trace frames, is needed for GC tracing that relies on libunwind (such as in Wasmtime), and is unconditionally needed on certain platforms (such as Windows) that must always be able to unwind.
sourcepub fn machine_code_cfg_info(&self) -> bool
pub fn machine_code_cfg_info(&self) -> bool
Generate CFG metadata for machine code.
This increases metadata size and compile time, but allows for the embedder to more easily post-process or analyze the generated machine code. It provides code offsets for the start of each basic block in the generated machine code, and a list of CFG edges (with blocks identified by start offsets) between them. This is useful for, e.g., machine-code analyses that verify certain properties of the generated code.
sourcepub fn emit_all_ones_funcaddrs(&self) -> bool
pub fn emit_all_ones_funcaddrs(&self) -> bool
Emit not-yet-relocated function addresses as all-ones bit patterns.
sourcepub fn enable_probestack(&self) -> bool
pub fn enable_probestack(&self) -> bool
Enable the use of stack probes for supported calling conventions.
sourcepub fn probestack_func_adjusts_sp(&self) -> bool
pub fn probestack_func_adjusts_sp(&self) -> bool
Enable if the stack probe adjusts the stack pointer.
sourcepub fn enable_jump_tables(&self) -> bool
pub fn enable_jump_tables(&self) -> bool
Enable the use of jump tables in generated machine code.
sourcepub fn enable_heap_access_spectre_mitigation(&self) -> bool
pub fn enable_heap_access_spectre_mitigation(&self) -> bool
Enable Spectre mitigation on heap bounds checks.
This is a no-op for any heap that needs no bounds checks; e.g., if the limit is static and the guard region is large enough that the index cannot reach past it.
This option is enabled by default because it is highly recommended for secure sandboxing. The embedder should consider the security implications carefully before disabling this option.
sourcepub fn enable_table_access_spectre_mitigation(&self) -> bool
pub fn enable_table_access_spectre_mitigation(&self) -> bool
Enable Spectre mitigation on table bounds checks.
This option uses a conditional move to ensure that when a table access index is bounds-checked and a conditional branch is used for the out-of-bounds case, a misspeculation of that conditional branch (falsely predicted in-bounds) will select an in-bounds index to load on the speculative path.
This option is enabled by default because it is highly recommended for secure sandboxing. The embedder should consider the security implications carefully before disabling this option.
Trait Implementations
sourceimpl<'a> From<&'a Flags> for FlagsOrIsa<'a>
impl<'a> From<&'a Flags> for FlagsOrIsa<'a>
sourcefn from(flags: &'a Flags) -> FlagsOrIsa<'_>
fn from(flags: &'a Flags) -> FlagsOrIsa<'_>
Converts to this type from the input type.
Auto Trait Implementations
impl RefUnwindSafe for Flags
impl Send for Flags
impl Sync for Flags
impl Unpin for Flags
impl UnwindSafe for Flags
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more