summaryrefslogtreecommitdiff
path: root/module/system/vm/disassembler.scm
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2017-11-14 10:41:24 +0100
committerAndy Wingo <wingo@pobox.com>2017-11-15 14:18:39 +0100
commit294dbaad35e139427ecbfffa7b02f0a2ee037b9b (patch)
tree33147ae03d436aab390dbb0314694f809c717a48 /module/system/vm/disassembler.scm
parent4a0a930f1c6f3d34bbd5bd9877042de368b9c196 (diff)
downloadguile-294dbaad35e139427ecbfffa7b02f0a2ee037b9b.tar.gz
Add support for comparisons against integer immediates
* libguile/vm-engine.c (s64-imm=?, u64-imm<?, imm-u64<?, s64-imm<?) (imm-s64<?): New instructions. * libguile/instructions.c (FOR_EACH_INSTRUCTION_WORD_TYPE): Add new X8_S12_Z12 word type used by the new S64/immediate instructions. A Z12 is a 12-bit signed integer immediate. * module/system/vm/assembler.scm: Export new instructions, and add X8_S12_Z12 support. Also, add missing shufflers for X8_S12_C12. * module/language/bytecode.scm (compute-instruction-arity): * module/system/vm/disassembler.scm (unpack-s12, disassembler): Add support for X8_S12_Z12. * module/language/cps/types.scm (define-predicate-inferrer/param): New helper. (u64-=, u64-<, s64-<): Remove type checkers; this procedure does not cause &type-check. (u64-imm=?, s64-imm=?, u64-imm<?, imm-u64<?, s64-imm<?, imm-s64<?): New type inferrers. * module/language/cps/type-fold.scm (define-unary-branch-folder*): New helper. (u64-imm=?, s64-imm=?, u64-imm<?, imm-u64<?, s64-imm<?, imm-s64<?): New branch folders. * module/language/cps/reify-primitives.scm (reify-primitives): Reify constants for new immediate branching primcalls if values out of range. * module/language/cps/effects-analysis.scm: Add support for new primcalls. * module/language/cps/compile-bytecode.scm (compile-function): Add support for new primcalls and instructions. Compile u64-imm-= to s64-imm=?.
Diffstat (limited to 'module/system/vm/disassembler.scm')
-rw-r--r--module/system/vm/disassembler.scm8
1 files changed, 8 insertions, 0 deletions
diff --git a/module/system/vm/disassembler.scm b/module/system/vm/disassembler.scm
index 89acf6090..cb6447901 100644
--- a/module/system/vm/disassembler.scm
+++ b/module/system/vm/disassembler.scm
@@ -72,6 +72,11 @@
s
(- s (ash 1 24))))
+(define (unpack-s12 s)
+ (if (zero? (logand s (ash 1 11)))
+ s
+ (- s (ash 1 12))))
+
(define (unpack-s32 s)
(if (zero? (logand s (ash 1 31)))
s
@@ -97,6 +102,9 @@
X8_F12_F12)
#'((logand (ash word -8) #xfff)
(ash word -20)))
+ ((X8_S12_Z12)
+ #'((logand (ash word -8) #xfff)
+ (unpack-s12 (ash word -20))))
((X8_S8_S8_S8
X8_S8_S8_C8
X8_S8_C8_S8)