From 0cda461eaaf3518460693f5ea7d3a1b44d5f56e8 Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Fri, 18 Oct 2024 20:25:58 +0200 Subject: [PATCH] asm: add forms to call and exec macros --- src/isa/macros.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/isa/macros.rs b/src/isa/macros.rs index 462aa20..555b493 100644 --- a/src/isa/macros.rs +++ b/src/isa/macros.rs @@ -23,8 +23,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -use crate::isa::ControlFlowOp; - /// Macro compiler for AluVM assembler. /// /// # Example @@ -186,12 +184,24 @@ macro_rules! instr { (routine $offset:ident) => { Instr::ControlFlow(ControlFlowOp::Routine($offset)) }; + (call $offset:literal @ $lib:ident) => { + Instr::ControlFlow(ControlFlowOp::Call(LibSite::with( + $offset, + $lib + ))) + }; (call $offset:literal @ $lib:literal) => { Instr::ControlFlow(ControlFlowOp::Call(LibSite::with( $offset, $lib.parse().expect("wrong library reference"), ))) }; + (exec $offset:literal @ $lib:ident) => { + Instr::ControlFlow(ControlFlowOp::Exec(LibSite::with( + $offset, + $lib + ))) + }; (call $offset:ident @ $lib:ident) => { Instr::ControlFlow(ControlFlowOp::Call(LibSite::with( $offset,