pub enum FuncDecl<'a> {
Import(Signature, String),
Lazy(Signature, String, FunctionBody<'a>),
Body(Signature, String, FunctionBody),
Compiled(Signature, String, Vec<u8>),
None,
}
Expand description
FuncDecl
represents the various forms in which we can hold a
function body: not yet parsed, parsed into full IR, recompiled
into new bytecode, or an import (none of the above).
Variants§
Import(Signature, String)
An imported function.
Lazy(Signature, String, FunctionBody<'a>)
An un-expanded body that can be lazily expanded if needed.
Body(Signature, String, FunctionBody)
A modified or new function body that requires compilation.
Compiled(Signature, String, Vec<u8>)
A compiled function body (was IR, has been collapsed back to bytecode).
None
A placeholder.
Implementations§
Source§impl<'a> FuncDecl<'a>
impl<'a> FuncDecl<'a>
Sourcepub fn parse(&mut self, module: &Module<'_>) -> Result<()>
pub fn parse(&mut self, module: &Module<'_>) -> Result<()>
If this function is not yet parsed to IR, do so, mutating in place.
Sourcepub fn optimize(&mut self, opts: &OptOptions)
pub fn optimize(&mut self, opts: &OptOptions)
Run the specified optimization passes on the function.
Sourcepub fn convert_to_max_ssa(&mut self, cut_blocks: Option<HashSet<Block>>)
pub fn convert_to_max_ssa(&mut self, cut_blocks: Option<HashSet<Block>>)
Convert the function to “maximal SSA” with respect to the
given cut-set of blocks, or all blocks if None
.
After this returns, the function will have no live values across the entries to cut-blocks except for the blockparams of those blocks. This eases some control-flow mutations: if control flow will be reconnected somehow at certain points in the CFG, making those points (the blocks that receive new predecessor edges) cut-blocks in a max-SSA transform beforehand will ensure that simply connecting blockparams appropriately will reconnect all SSA.
Sourcepub fn body(&self) -> Option<&FunctionBody>
pub fn body(&self) -> Option<&FunctionBody>
Return the function body, if it exists.
Sourcepub fn body_mut(&mut self) -> Option<&mut FunctionBody>
pub fn body_mut(&mut self) -> Option<&mut FunctionBody>
Return the function body, if it exists, in mutable form.
Trait Implementations§
Source§impl<'de, 'a> Deserialize<'de> for FuncDecl<'a>
impl<'de, 'a> Deserialize<'de> for FuncDecl<'a>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl<'a> Freeze for FuncDecl<'a>
impl<'a> RefUnwindSafe for FuncDecl<'a>
impl<'a> Send for FuncDecl<'a>
impl<'a> Sync for FuncDecl<'a>
impl<'a> Unpin for FuncDecl<'a>
impl<'a> UnwindSafe for FuncDecl<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more