Skip to content

Commit

Permalink
asm: add forms to call and exec macros
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Oct 18, 2024
1 parent e49f7f7 commit 0cda461
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/isa/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 0cda461

Please sign in to comment.