pub struct MirFuncBuilder<'module, 'ctx> { /* private fields */ }Expand description
The currently building MIR function.
There can only be at most one unfinished function for each MirContext inside one unfinished
module. It is strongly advised to explicitly call MirFuncBuilder::finish to finish the
current function for clarity and observe any error outside drop impl.
MirFuncBuilder will automatically finish it on drop.
Implementations§
Source§impl<'ctx> MirFuncBuilder<'_, 'ctx>
impl<'ctx> MirFuncBuilder<'_, 'ctx>
Sourcepub fn finish(self) -> FuncItemRef<'ctx>
pub fn finish(self) -> FuncItemRef<'ctx>
Explicitly finish the function and return the function reference.
§Panics
Panic from C if the function content is malformed.
Sourcepub fn get_reg(&self, name: &CStr) -> Reg
pub fn get_reg(&self, name: &CStr) -> Reg
Get the virtual register or given name.
Function parameters are represented as pre-defined virtual registers of same names.
Sourcepub fn new_local_reg(&self, name: &CStr, ty: Ty) -> Reg
pub fn new_local_reg(&self, name: &CStr, ty: Ty) -> Reg
Create a new virtual register.
Sourcepub fn new_label(&self) -> Label<'_>
pub fn new_label(&self) -> Label<'_>
Create a new unbound label.
The label must be inserted later via InsnBuilder::label.
Sourcepub fn ins(&self) -> FuncInstBuilder<'_, 'ctx>
pub fn ins(&self) -> FuncInstBuilder<'_, 'ctx>
Append a new instruction to the function.
Trait Implementations§
Source§impl<'module, 'ctx> Debug for MirFuncBuilder<'module, 'ctx>
impl<'module, 'ctx> Debug for MirFuncBuilder<'module, 'ctx>
Auto Trait Implementations§
impl<'module, 'ctx> Freeze for MirFuncBuilder<'module, 'ctx>
impl<'module, 'ctx> !RefUnwindSafe for MirFuncBuilder<'module, 'ctx>
impl<'module, 'ctx> !Send for MirFuncBuilder<'module, 'ctx>
impl<'module, 'ctx> !Sync for MirFuncBuilder<'module, 'ctx>
impl<'module, 'ctx> Unpin for MirFuncBuilder<'module, 'ctx>
impl<'module, 'ctx> !UnwindSafe for MirFuncBuilder<'module, 'ctx>
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
Mutably borrows from an owned value. Read more