Skip to content

Commit

Permalink
isa: macro asm support constant ident in put argument
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Apr 20, 2024
1 parent 6eabff9 commit 60ba25d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/isa/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ macro_rules! aluasm_inner {
$code.push($crate::instr!{ $op $arg [ $idx ] , $arglit });
$crate::aluasm_inner! { $code => $( $tt )* }
};
{ $code:ident => $op:ident $arg:ident [ $idx:literal ] , $arglit:ident ; $($tt:tt)* } => {
$code.push($crate::instr!{ $op $arg [ $idx ] , $arglit });
$crate::aluasm_inner! { $code => $( $tt )* }
};
{ $code:ident => $op:ident . $flag:ident $arg:ident [ $idx:literal ], $arglit:expr ; $($tt:tt)* } => {
$code.push($crate::instr!{ $op . $flag $arg [ $idx ], $arglit });
$crate::aluasm_inner! { $code => $( $tt )* }
Expand Down Expand Up @@ -221,6 +225,9 @@ macro_rules! instr {
$crate::_reg_idx16!($offset_idx),
))
};
(put s16[$idx:literal], $val:ident) => {{
Instr::Bytes(BytesOp::Put(RegS::from($idx), Box::new(ByteStr::with(&$val)), false))
}};
(put s16[$idx:literal], $val:literal) => {{
Instr::Bytes(BytesOp::Put(RegS::from($idx), Box::new(ByteStr::with(&$val)), false))
}};
Expand Down

0 comments on commit 60ba25d

Please sign in to comment.