aboutsummaryrefslogtreecommitdiff
path: root/asm.peg
diff options
context:
space:
mode:
authorAndrew Chambers <[email protected]>2021-10-07 20:41:13 +1300
committerAndrew Chambers <[email protected]>2021-10-07 20:41:13 +1300
commit34c94563338da7c2ba7ca3a3e41cd14a10a1ad2f (patch)
tree441d1b0ae06a6bab90c4dc1c46ec8d716c690a88 /asm.peg
parent0e32e456f40a4069c626f941e02d4fc305a5388a (diff)
Add lea.
Diffstat (limited to 'asm.peg')
-rw-r--r--asm.peg10
1 files changed, 9 insertions, 1 deletions
diff --git a/asm.peg b/asm.peg
index aed5fad..76918fd 100644
--- a/asm.peg
+++ b/asm.peg
@@ -35,10 +35,18 @@ instr =
| i:xchg { $$ = i; }
| i:add { $$ = i; }
| i:and { $$ = i; }
+ | i:lea { $$ = i; }
| i:or { $$ = i; }
| i:sub { $$ = i; }
| i:xor { $$ = i; }
-
+
+lea =
+ 'lea' (
+ 'w'? ws s:m ws? ',' ws? d:r16 { $$ = INSTR(0, s, d); }
+ | 'l'? ws s:m ws? ',' ws? d:r32 { $$ = INSTR(1, s, d); }
+ | 'q'? ws s:m ws? ',' ws? d:r64 { $$ = INSTR(2, s, d); }
+ ) { $$.instr.kind = ASM_LEA; }
+
xchg =
'xchg' (
'w'? ws s:ax ws? ',' ws? d:r16 { $$ = INSTR(0, s, d); }