[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sbcl-commits
Subject:    [Sbcl-commits] master: Allow composing instruction emitters
From:       Douglas Katzman via Sbcl-commits <sbcl-commits () lists ! sourceforge ! net>
Date:       2021-01-30 17:30:08
Message-ID: 1612027808.989926.4141 () sfp-scm-1 ! v30 ! lw ! sourceforge ! com
[Download RAW message or body]

The branch "master" has been updated in SBCL:
       via  95c03039806c959b83be156a8e753639a1b68e8f (commit)
      from  c642a0bcc700688718b05ca8377b10afac519af5 (commit)

- Log -----------------------------------------------------------------
commit 95c03039806c959b83be156a8e753639a1b68e8f
Author: Douglas Katzman <dougk@google.com>
Date:   Sat Jan 30 12:28:50 2021 -0500

    Allow composing instruction emitters
    
    (not used yet, but will be)
---
 src/compiler/assem.lisp | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/compiler/assem.lisp b/src/compiler/assem.lisp
index 4a27c66a3..d4fb5ba6d 100644
--- a/src/compiler/assem.lisp
+++ b/src/compiler/assem.lisp
@@ -1600,9 +1600,20 @@
 ;;; As such, we must detect that we are emitting directly to machine code.
 ;;;
 (defun inst* (mnemonic &rest operands)
-  (declare (symbol mnemonic))
-  (let ((action (gethash mnemonic *inst-encoder*))
-        (dest *current-destination*))
+  (let ((dest
+         (etypecase mnemonic
+           (symbol
+            ;; If called by a vop, the first argument is a mnemonic.
+            *current-destination*)
+           (segment
+            ;; If called by an instruction encoder to encode other instructions,
+            ;; the first argument is a SEGMENT. This facilitates a different kind of
+            ;; macro-instruction, one which decides only at encoding time what other
+            ;; instructions to emit. Similar results could be achievedy by factoring
+            ;; out other emitters into callable functions, though the INST macro
+            ;; tends to be a more convenient interface.
+            (prog1 mnemonic (setq mnemonic (the symbol (pop operands)))))))
+        (action (gethash mnemonic *inst-encoder*)))
     (unless action ; try canonicalizing again
       (setq mnemonic (find-symbol (string mnemonic)
                                   *backend-instruction-set-package*)

-----------------------------------------------------------------------


hooks/post-receive
-- 
SBCL


_______________________________________________
Sbcl-commits mailing list
Sbcl-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sbcl-commits
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic