pub struct MirBuilder { /* private fields */ }Expand description
Builder for constructing a MIR function from AST.
Implementations§
Source§impl MirBuilder
impl MirBuilder
pub fn new(name: String, span: Span) -> Self
Sourcepub fn alloc_local(&mut self, name: String, type_info: LocalTypeInfo) -> SlotId
pub fn alloc_local(&mut self, name: String, type_info: LocalTypeInfo) -> SlotId
Allocate a new local variable slot.
Sourcepub fn alloc_temp(&mut self, type_info: LocalTypeInfo) -> SlotId
pub fn alloc_temp(&mut self, type_info: LocalTypeInfo) -> SlotId
Allocate a temporary local slot that should not participate in name resolution.
Sourcepub fn lookup_local(&self, name: &str) -> Option<SlotId>
pub fn lookup_local(&self, name: &str) -> Option<SlotId>
Look up the current slot for a named local.
pub fn visible_named_locals(&self) -> Vec<String>
Sourcepub fn field_idx(&mut self, property: &str) -> FieldIdx
pub fn field_idx(&mut self, property: &str) -> FieldIdx
Get or allocate a stable field index for a property name.
pub fn return_slot(&self) -> SlotId
pub fn set_exit_block(&mut self, block: BasicBlockId)
pub fn exit_block(&self) -> BasicBlockId
pub fn push_scope(&mut self)
pub fn pop_scope(&mut self)
pub fn mark_fallback(&mut self)
pub fn mark_fallback_at(&mut self, span: Span)
pub fn had_fallbacks(&self) -> bool
pub fn push_loop( &mut self, break_block: BasicBlockId, continue_block: BasicBlockId, break_value_slot: Option<SlotId>, )
pub fn pop_loop(&mut self)
pub fn push_task_boundary_capture_scope(&mut self)
pub fn pop_task_boundary_capture_scope(&mut self) -> Vec<Operand>
pub fn record_task_boundary_operand(&mut self, operand: Operand)
pub fn record_task_boundary_reference_capture( &mut self, reference_slot: SlotId, borrowed_place: &Place, )
Sourcepub fn next_point(&mut self) -> Point
pub fn next_point(&mut self) -> Point
Allocate a new program point.
Sourcepub fn new_block(&mut self) -> BasicBlockId
pub fn new_block(&mut self) -> BasicBlockId
Create a new basic block and return its ID.
Sourcepub fn push_stmt(&mut self, kind: StatementKind, span: Span) -> Point
pub fn push_stmt(&mut self, kind: StatementKind, span: Span) -> Point
Push a statement into the current block.
pub fn record_binding_initialization(&mut self, slot: SlotId, point: Point)
Sourcepub fn finish_block(&mut self, terminator_kind: TerminatorKind, span: Span)
pub fn finish_block(&mut self, terminator_kind: TerminatorKind, span: Span)
Finish the current block with a terminator and switch to a new block.
Sourcepub fn start_block(&mut self, id: BasicBlockId)
pub fn start_block(&mut self, id: BasicBlockId)
Start building a new block (after finishing the previous one).
Sourcepub fn emit_call(
&mut self,
func: Operand,
args: Vec<Operand>,
destination: Place,
span: Span,
)
pub fn emit_call( &mut self, func: Operand, args: Vec<Operand>, destination: Place, span: Span, )
Emit a function call as a block terminator. Finishes current block with TerminatorKind::Call and starts a continuation block.
Sourcepub fn build(self) -> MirLoweringResult
pub fn build(self) -> MirLoweringResult
Finalize and produce the MIR function.
Auto Trait Implementations§
impl Freeze for MirBuilder
impl RefUnwindSafe for MirBuilder
impl Send for MirBuilder
impl Sync for MirBuilder
impl Unpin for MirBuilder
impl UnsafeUnpin for MirBuilder
impl UnwindSafe for MirBuilder
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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