Struct wasmtime_jit::trampoline::Context [−][src]
Persistent data structures and compilation pipeline.
Fields
func: Function
The function we’re compiling.
cfg: ControlFlowGraph
The control flow graph of func
.
domtree: DominatorTree
Dominator tree for func
.
regalloc: Context
Register allocation context.
loop_analysis: LoopAnalysis
Loop analysis of func
.
redundant_reload_remover: RedundantReloadRemover
Redundant-reload remover context.
mach_compile_result: Option<MachCompileResult>
Result of MachBackend compilation, if computed.
want_disasm: bool
Flag: do we want a disassembly with the MachCompileResult?
Implementations
impl Context
[src]
pub fn new() -> Context
[src]
Allocate a new compilation context.
The returned instance should be reused for compiling multiple functions in order to avoid needless allocator thrashing.
pub fn for_function(func: Function) -> Context
[src]
Allocate a new compilation context with an existing Function.
The returned instance should be reused for compiling multiple functions in order to avoid needless allocator thrashing.
pub fn clear(&mut self)
[src]
Clear all data structures in this context.
pub fn set_disasm(&mut self, val: bool)
[src]
Set the flag to request a disassembly when compiling with a
MachBackend
backend.
pub fn compile_and_emit(
&mut self,
isa: &dyn TargetIsa,
mem: &mut Vec<u8, Global>,
relocs: &mut dyn RelocSink,
traps: &mut dyn TrapSink,
stack_maps: &mut dyn StackMapSink
) -> Result<CodeInfo, CodegenError>
[src]
&mut self,
isa: &dyn TargetIsa,
mem: &mut Vec<u8, Global>,
relocs: &mut dyn RelocSink,
traps: &mut dyn TrapSink,
stack_maps: &mut dyn StackMapSink
) -> Result<CodeInfo, CodegenError>
Compile the function, and emit machine code into a Vec<u8>
.
Run the function through all the passes necessary to generate code for the target ISA
represented by isa
, as well as the final step of emitting machine code into a
Vec<u8>
. The machine code is not relocated. Instead, any relocations are emitted
into relocs
.
This function calls compile
and emit_to_memory
, taking care to resize mem
as
needed, so it provides a safe interface.
Returns information about the function’s code and read-only data.
pub fn compile(&mut self, isa: &dyn TargetIsa) -> Result<CodeInfo, CodegenError>
[src]
Compile the function.
Run the function through all the passes necessary to generate code for the target ISA
represented by isa
. This does not include the final step of emitting machine code into a
code sink.
Returns information about the function’s code and read-only data.
pub unsafe fn emit_to_memory(
&self,
isa: &dyn TargetIsa,
mem: *mut u8,
relocs: &mut dyn RelocSink,
traps: &mut dyn TrapSink,
stack_maps: &mut dyn StackMapSink
) -> CodeInfo
[src]
&self,
isa: &dyn TargetIsa,
mem: *mut u8,
relocs: &mut dyn RelocSink,
traps: &mut dyn TrapSink,
stack_maps: &mut dyn StackMapSink
) -> CodeInfo
Emit machine code directly into raw memory.
Write all of the function’s machine code to the memory at mem
. The size of the machine
code is returned by compile
above.
The machine code is not relocated. Instead, any relocations are emitted into relocs
.
Safety
This function is unsafe since it does not perform bounds checking on the memory buffer,
and it can’t guarantee that the mem
pointer is valid.
Returns information about the emitted code and data.
pub fn create_unwind_info(
&self,
isa: &dyn TargetIsa
) -> Result<Option<UnwindInfo>, CodegenError>
[src]
&self,
isa: &dyn TargetIsa
) -> Result<Option<UnwindInfo>, CodegenError>
Creates unwind information for the function.
Returns None
if the function has no unwind information.
pub fn verify<'a, FOI>(&self, fisa: FOI) -> Result<(), VerifierErrors> where
FOI: Into<FlagsOrIsa<'a>>,
[src]
FOI: Into<FlagsOrIsa<'a>>,
Run the verifier on the function.
Also check that the dominator tree and control flow graph are consistent with the function.
pub fn verify_if<'a, FOI>(&self, fisa: FOI) -> Result<(), CodegenError> where
FOI: Into<FlagsOrIsa<'a>>,
[src]
FOI: Into<FlagsOrIsa<'a>>,
Run the verifier only if the enable_verifier
setting is true.
pub fn verify_locations(
&self,
isa: &dyn TargetIsa
) -> Result<(), VerifierErrors>
[src]
&self,
isa: &dyn TargetIsa
) -> Result<(), VerifierErrors>
Run the locations verifier on the function.
pub fn verify_locations_if(
&self,
isa: &dyn TargetIsa
) -> Result<(), CodegenError>
[src]
&self,
isa: &dyn TargetIsa
) -> Result<(), CodegenError>
Run the locations verifier only if the enable_verifier
setting is true.
pub fn dce<'a, FOI>(&mut self, fisa: FOI) -> Result<(), CodegenError> where
FOI: Into<FlagsOrIsa<'a>>,
[src]
FOI: Into<FlagsOrIsa<'a>>,
Perform dead-code elimination on the function.
pub fn remove_constant_phis<'a, FOI>(
&mut self,
fisa: FOI
) -> Result<(), CodegenError> where
FOI: Into<FlagsOrIsa<'a>>,
[src]
&mut self,
fisa: FOI
) -> Result<(), CodegenError> where
FOI: Into<FlagsOrIsa<'a>>,
Perform constant-phi removal on the function.
pub fn preopt(&mut self, isa: &dyn TargetIsa) -> Result<(), CodegenError>
[src]
Perform pre-legalization rewrites on the function.
pub fn canonicalize_nans(
&mut self,
isa: &dyn TargetIsa
) -> Result<(), CodegenError>
[src]
&mut self,
isa: &dyn TargetIsa
) -> Result<(), CodegenError>
Perform NaN canonicalizing rewrites on the function.
pub fn legalize(&mut self, isa: &dyn TargetIsa) -> Result<(), CodegenError>
[src]
Run the legalizer for isa
on the function.
pub fn postopt(&mut self, isa: &dyn TargetIsa) -> Result<(), CodegenError>
[src]
Perform post-legalization rewrites on the function.
pub fn compute_cfg(&mut self)
[src]
Compute the control flow graph.
pub fn compute_domtree(&mut self)
[src]
Compute dominator tree.
pub fn compute_loop_analysis(&mut self)
[src]
Compute the loop analysis.
pub fn flowgraph(&mut self)
[src]
Compute the control flow graph and dominator tree.
pub fn simple_gvn<'a, FOI>(&mut self, fisa: FOI) -> Result<(), CodegenError> where
FOI: Into<FlagsOrIsa<'a>>,
[src]
FOI: Into<FlagsOrIsa<'a>>,
Perform simple GVN on the function.
pub fn licm(&mut self, isa: &dyn TargetIsa) -> Result<(), CodegenError>
[src]
Perform LICM on the function.
pub fn eliminate_unreachable_code<'a, FOI>(
&mut self,
fisa: FOI
) -> Result<(), CodegenError> where
FOI: Into<FlagsOrIsa<'a>>,
[src]
&mut self,
fisa: FOI
) -> Result<(), CodegenError> where
FOI: Into<FlagsOrIsa<'a>>,
Perform unreachable code elimination.
pub fn regalloc(&mut self, isa: &dyn TargetIsa) -> Result<(), CodegenError>
[src]
Run the register allocator.
pub fn prologue_epilogue(
&mut self,
isa: &dyn TargetIsa
) -> Result<(), CodegenError>
[src]
&mut self,
isa: &dyn TargetIsa
) -> Result<(), CodegenError>
Insert prologue and epilogues after computing the stack frame layout.
pub fn redundant_reload_remover(
&mut self,
isa: &dyn TargetIsa
) -> Result<(), CodegenError>
[src]
&mut self,
isa: &dyn TargetIsa
) -> Result<(), CodegenError>
Do redundant-reload removal after allocation of both registers and stack slots.
pub fn shrink_instructions(
&mut self,
isa: &dyn TargetIsa
) -> Result<(), CodegenError>
[src]
&mut self,
isa: &dyn TargetIsa
) -> Result<(), CodegenError>
Run the instruction shrinking pass.
pub fn relax_branches(
&mut self,
isa: &dyn TargetIsa
) -> Result<CodeInfo, CodegenError>
[src]
&mut self,
isa: &dyn TargetIsa
) -> Result<CodeInfo, CodegenError>
Run the branch relaxation pass and return information about the function’s code and read-only data.
pub fn build_value_labels_ranges(
&self,
isa: &dyn TargetIsa
) -> Result<HashMap<ValueLabel, Vec<ValueLocRange, Global>, RandomState>, CodegenError>
[src]
&self,
isa: &dyn TargetIsa
) -> Result<HashMap<ValueLabel, Vec<ValueLocRange, Global>, RandomState>, CodegenError>
Builds ranges and location for specified value labels.
Auto Trait Implementations
impl RefUnwindSafe for Context
impl !Send for Context
impl !Sync for Context
impl Unpin for Context
impl UnwindSafe for Context
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
[src]
pub const ALIGN: usize
[src]
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
[src]
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
[src]
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
[src]
pub unsafe fn drop(ptr: usize)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,