summaryrefslogtreecommitdiff
path: root/module/system/vm/assembler.scm
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2015-11-20 16:14:32 +0100
committerAndy Wingo <wingo@pobox.com>2015-12-01 11:30:55 +0100
commitf34688ad25c8e4cb1ebc97734f255d36518d763f (patch)
tree338ffb1a0828b06532b7ba3167b2819137b12ef5 /module/system/vm/assembler.scm
parentbdfa1c1b424fc6d408c55e7db17cb3ed7117606a (diff)
downloadguile-f34688ad25c8e4cb1ebc97734f255d36518d763f.tar.gz
New instructions load-f64, load-u64
* libguile/instructions.c (FOR_EACH_INSTRUCTION_WORD_TYPE): Add word types for immediate f64 and u64 values. (TYPE_WIDTH): Bump up by a bit, now that we have 32 word types. (NOP, parse_instruction): Use 64-bit meta type. * libguile/vm-engine.c (load-f64, load-u64): New instructions. * module/language/bytecode.scm (compute-instruction-arity): Add parser for new instruction word types. * module/language/cps/compile-bytecode.scm (compile-function): Add special-cased assemblers for new instructions, and also for scm->u64 and u64->scm which I missed before. * module/language/cps/effects-analysis.scm (load-f64, load-u64): New instructions. * module/language/cps/slot-allocation.scm (compute-needs-slot): load-f64 and load-u64 don't need slots. (compute-var-representations): Update for new instructions. * module/language/cps/specialize-primcalls.scm (specialize-primcalls): Specialize scm->f64 and scm->u64 to make-f64 and make-u64. * module/language/cps/types.scm (load-f64, load-u64): Wire up to type inference, though currently type inference only runs before specialization. * module/language/cps/utils.scm (compute-defining-expressions): For some reason I don't understand, it's possible to see two definitions that are equal but not equal? here. Allow for now. (compute-constant-values): Punch through type conversions to get constant u64/f64 values. * module/system/vm/assembler.scm (assembler): Support for new word types. Export the new assemblers.
Diffstat (limited to 'module/system/vm/assembler.scm')
-rw-r--r--module/system/vm/assembler.scm13
1 files changed, 13 insertions, 0 deletions
diff --git a/module/system/vm/assembler.scm b/module/system/vm/assembler.scm
index 07333112f..bbd4e5d3a 100644
--- a/module/system/vm/assembler.scm
+++ b/module/system/vm/assembler.scm
@@ -168,7 +168,11 @@
(emit-class-of* . emit-class-of)
emit-make-array
(emit-scm->f64* . emit-scm->f64)
+ emit-load-f64
(emit-f64->scm* . emit-f64->scm)
+ (emit-scm->u64* . emit-scm->u64)
+ emit-load-u64
+ (emit-u64->scm* . emit-u64->scm)
(emit-bv-length* . emit-bv-length)
(emit-bv-u8-ref* . emit-bv-u8-ref)
(emit-bv-s8-ref* . emit-bv-s8-ref)
@@ -568,7 +572,16 @@ later by the linker."
(error "make-long-immediate unavailable for this target"))
(emit asm (ash (object-address imm) -32))
(emit asm (logand (object-address imm) (1- (ash 1 32)))))
+ ((AF32 f64)
+ (let ((u64 (u64vector-ref (f64vector f64) 0)))
+ (emit asm (ash u64 -32))
+ (emit asm (logand u64 (1- (ash 1 32))))))
+ ((AU32 u64)
+ (emit asm (ash u64 -32))
+ (emit asm (logand u64 (1- (ash 1 32)))))
((B32))
+ ((BU32))
+ ((BF32))
((N32 label)
(record-far-label-reference asm label)
(emit asm 0))