From 161491beb0440bd63d9c956d1e0a6ef4a4c0c675 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 1 Oct 2020 06:24:32 -0700 Subject: vm: deprecate move-immediate instructions. The movrsi, movrmi and movrbi (move immediate {small, medium, big} to register) instructions are becoming deprecated. The reasoning is that character and fixnum operands can just go into a VM descriptor's data vector (D registers). Then they can be referenced directly without wastefully issuing an extra instruction. * genvmop.txr: Add a deprecated comment next to the enum constants of deprecated opcodes. * share/txr/stdlib/asm.tl (oc-base): Add Boolean property which indicates that an opcode is deprecated. This is a static class variable, defaulting to nil in the base class. (op-movrsi, op-movsmi, op-movrbi): Override base class deprecated property with a true value. * vmop.h: Regenerated. --- genvmop.txr | 3 ++- share/txr/stdlib/asm.tl | 5 +++++ vmop.h | 6 +++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/genvmop.txr b/genvmop.txr index a9d46165..73864d08 100644 --- a/genvmop.txr +++ b/genvmop.txr @@ -12,7 +12,8 @@ typedef enum vm_op { @ (repeat) - @{oc.symbol :filter :upcase} = @{oc.code}, + @{oc.symbol :filter :upcase} = @{oc.code},@(if oc.deprecated + " /* deprecated */") @ (end) } vm_op_t; @(end) diff --git a/share/txr/stdlib/asm.tl b/share/txr/stdlib/asm.tl index 8dd64ec4..9ded42c0 100644 --- a/share/txr/stdlib/asm.tl +++ b/share/txr/stdlib/asm.tl @@ -27,6 +27,7 @@ (load "vm-param") (defstruct oc-base nil + (:static deprecated nil) (:method synerr (me fmt . args) (error `opcode @{me.symbol}: @fmt` . args)) @@ -484,6 +485,7 @@ real.(asm asm syntax))))) (defopcode op-movrsi movrsi auto + (:static deprecated t) (:method asm (me asm syntax) me.(chk-arg-count 2 syntax) (tree-bind (dst imm) asm.(parse-args me syntax '(d si)) @@ -493,6 +495,7 @@ ^(,me.symbol ,(operand-to-sym dst) ,(bits-to-obj imm 10)))) (defopcode op-movsmi movsmi auto + (:static deprecated t) (:method asm (me asm syntax) me.(chk-arg-count 2 syntax) (tree-bind (dst imm) asm.(parse-args me syntax '(ds mi)) @@ -503,6 +506,7 @@ ^(,me.symbol ,(small-op-to-sym dst) ,(bits-to-obj imm 16)))) (defopcode op-movrbi movrbi auto + (:static deprecated t) (:method asm (me asm syntax) me.(chk-arg-count 2 syntax) (tree-bind (dst imm) asm.(parse-args me syntax '(d bi)) @@ -514,6 +518,7 @@ ^(,me.symbol ,(operand-to-sym dst) ,(bits-to-obj imm 32))))) (defopcode op-movi-pseudo movi nil + (:static deprecated t) (:method asm (me asm syntax) (tree-bind (dst src) asm.(parse-args me syntax '(d bi)) (let ((real [%oc-hash% (cond diff --git a/vmop.h b/vmop.h index 7c2e6185..3f2c2f43 100644 --- a/vmop.h +++ b/vmop.h @@ -40,9 +40,9 @@ typedef enum vm_op { MOVRS = 11, MOVSR = 12, MOVRR = 13, - MOVRSI = 14, - MOVSMI = 15, - MOVRBI = 16, + MOVRSI = 14, /* deprecated */ + MOVSMI = 15, /* deprecated */ + MOVRBI = 16, /* deprecated */ JMP = 17, IF = 18, IFQ = 19, -- cgit v1.2.3