Struct sway_core::asm_generation::MidenVMAsmBuilder
source · pub struct MidenVMAsmBuilder<'ir> { /* private fields */ }
Expand description
MidenVM Asm is built in the following way: Function bodies are abstracted into [Procedures] Arguments to functions are evaluated before the exec.proc is issued
Implementations§
source§impl<'ir> MidenVMAsmBuilder<'ir>
impl<'ir> MidenVMAsmBuilder<'ir>
pub fn new(program_kind: ProgramKind, context: &'ir Context) -> Self
pub fn finalize(&self) -> AsmBuilderResult
pub fn finalize_inner(&self) -> AsmBuilderResult
pub fn compile_function(&mut self, function: Function) -> CompileResult<()>
sourcepub fn compile_return(&mut self, ret_val: &Value, ty: &Type)
pub fn compile_return(&mut self, ret_val: &Value, ty: &Type)
Compiles a return instruction. https://0xpolygonmiden.github.io/miden-vm/design/stack/main.html#operand-stack By the end of program execution, exactly 16 items must remain on the stack (again, all of them could be 0’s). These items comprise the output of the program. all we have to do here is make sure the returned value is on top of the stack this works in both internal procedure returns and external main returns
Trait Implementations§
source§impl<'ir> AsmBuilder for MidenVMAsmBuilder<'ir>
impl<'ir> AsmBuilder for MidenVMAsmBuilder<'ir>
fn compile_function(&mut self, function: Function) -> CompileResult<()>
fn finalize(&self) -> AsmBuilderResult
fn func_to_labels(&mut self, func: &Function) -> (Label, Label)
Auto Trait Implementations§
impl<'ir> RefUnwindSafe for MidenVMAsmBuilder<'ir>
impl<'ir> !Send for MidenVMAsmBuilder<'ir>
impl<'ir> !Sync for MidenVMAsmBuilder<'ir>
impl<'ir> Unpin for MidenVMAsmBuilder<'ir>
impl<'ir> UnwindSafe for MidenVMAsmBuilder<'ir>
Blanket Implementations§
source§impl<T> AnyDebug for Twhere
T: Any + Debug,
impl<T> AnyDebug for Twhere T: Any + Debug,
source§fn as_any_ref(&self) -> &(dyn Any + 'static)
fn as_any_ref(&self) -> &(dyn Any + 'static)
Returns a reference to the underlying type as
Any
.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.