summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2018-03-15 06:09:26 -0700
committerKaz Kylheku <kaz@kylheku.com>2018-03-15 06:09:26 -0700
commit07019db7ceff2bf62fcd5e7ea5b0a011b359b73a (patch)
tree161dadb62323263c6c92f3cc563481487232249b /share
parente6c37abe560ef78b8ba052fdd2d5034a5c57977d (diff)
downloadtxr-07019db7ceff2bf62fcd5e7ea5b0a011b359b73a.tar.gz
txr-07019db7ceff2bf62fcd5e7ea5b0a011b359b73a.tar.bz2
txr-07019db7ceff2bf62fcd5e7ea5b0a011b359b73a.zip
asm/vm: add ifq and ifql instructions.
* share/txr/stdlib/asm.tl (op-ifq, op-ifql): New opcode types. * vm.c (vm_ifq, vm_ifql): New static functions. (vm_execute): Handle IFQ and IFQL opcodes. * vmop.h (vm_op_t): Regenerated.
Diffstat (limited to 'share')
-rw-r--r--share/txr/stdlib/asm.tl17
1 files changed, 17 insertions, 0 deletions
diff --git a/share/txr/stdlib/asm.tl b/share/txr/stdlib/asm.tl
index a82ce156..2fc8b6fd 100644
--- a/share/txr/stdlib/asm.tl
+++ b/share/txr/stdlib/asm.tl
@@ -438,6 +438,23 @@
(reg (cadr asm.(get-pair))))
^(,me.symbol ,(operand-to-sym reg) ,dst))))
+(defopcode op-ifq ifq auto
+ (:method asm (me asm syntax)
+ me.(chk-arg-count 3 syntax)
+ (tree-bind (lreg rreg dst) asm.(parse-args me syntax '(r r l))
+ asm.(put-insn me.code (ash dst -16) (logtrunc dst 16))
+ asm.(put-pair lreg rreg)))
+
+ (:method backpatch (me asm at dst)
+ asm.(put-insn me.code (ash dst -16) (logtrunc dst 16)))
+
+ (:method dis (me asm high16 low16)
+ (let ((dst (logior (ash high16 16) low16)))
+ (tree-bind (lreg rreg) asm.(get-pair)
+ ^(,me.symbol ,(operand-to-sym lreg) ,(operand-to-sym rreg) ,dst)))))
+
+(defopcode-derived op-ifql ifql auto op-ifq)
+
(defopcode-derived op-uwprot uwprot auto op-jmp)
(defopcode op-block block auto