pub struct IRBuilder {
pub module: IRModule,
/* private fields */
}Expand description
IR builder for constructing IR from AST
Fields§
§module: IRModuleCurrent module being built
Implementations§
Source§impl IRBuilder
impl IRBuilder
pub fn new(name: String, version: String, requires: Vec<String>) -> Self
Sourcepub fn fresh_label(&mut self) -> String
pub fn fresh_label(&mut self) -> String
Generate a fresh block label
Sourcepub fn start_function(
&mut self,
name: String,
params: Vec<String>,
is_async: bool,
)
pub fn start_function( &mut self, name: String, params: Vec<String>, is_async: bool, )
Start building a new function
Sourcepub fn emit(&mut self, inst: IRInstruction)
pub fn emit(&mut self, inst: IRInstruction)
Add an instruction to the current block
Sourcepub fn terminate(&mut self, term: IRTerminator)
pub fn terminate(&mut self, term: IRTerminator)
Set the terminator for the current block
Sourcepub fn is_terminated(&self) -> bool
pub fn is_terminated(&self) -> bool
Check if the current block is already terminated
Auto Trait Implementations§
impl Freeze for IRBuilder
impl RefUnwindSafe for IRBuilder
impl Send for IRBuilder
impl Sync for IRBuilder
impl Unpin for IRBuilder
impl UnwindSafe for IRBuilder
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