aboutsummaryrefslogtreecommitdiff
path: root/src/inst.h
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2023-10-22 17:01:15 +0100
committerAryadev Chavali <aryadev@aryadevchavali.com>2023-10-22 17:34:30 +0100
commit47c7d6baf7d39da5e2683edc3674494fcd3874ba (patch)
treeda2e739db9dc9c4ab70656dc005c8a5747bb2b41 /src/inst.h
parent95723f36d2aa7e1bcd343b2e072c0bcf28a3b1b5 (diff)
downloadovm-47c7d6baf7d39da5e2683edc3674494fcd3874ba.tar.gz
ovm-47c7d6baf7d39da5e2683edc3674494fcd3874ba.tar.bz2
ovm-47c7d6baf7d39da5e2683edc3674494fcd3874ba.zip
Store the result of OP_POP in the last register as a word
Instead of making routines to handle data in the `ret` register, just store the result of POP into the last word register. This means we are no longer using vm_pop_* or POP_ROUTINES for the vm_execute script on OP_POP: instead we'll just use vm_mov_* which automatically pops the datum for us, while moving the datum to the last register.
Diffstat (limited to 'src/inst.h')
-rw-r--r--src/inst.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/inst.h b/src/inst.h
index df4e2e1..d510118 100644
--- a/src/inst.h
+++ b/src/inst.h
@@ -69,6 +69,11 @@ const char *opcode_as_cstr(opcode_t);
#define OPCODE_IS_TYPE(OPCODE, OP_TYPE) \
(((OPCODE) >= OP_TYPE##_BYTE) && ((OPCODE) <= OP_TYPE##_WORD))
+#define OPCODE_DATA_TYPE(OPCODE, OP_TYPE) \
+ ((OPCODE) == OP_TYPE##_BYTE ? DATA_TYPE_BYTE \
+ : ((OPCODE) == OP_TYPE##_HWORD) ? DATA_TYPE_HWORD \
+ : DATA_TYPE_WORD)
+
typedef struct
{
opcode_t opcode;