From 092fae0666f1472c919b8ecf1a011d3869c0c6a5 Mon Sep 17 00:00:00 2001 From: Stas Boukarev Date: Mon, 24 Jun 2013 13:50:35 +0400 Subject: [PATCH] Simplify EMIT-GENERIC-VOP. Since there's only one kind of templates now, there's no need for indirection. Rename EMIT-GENERIC-VOP to EMIT-VOP, remove EMIT-FUNCTION slot from TEMPLATE, call EMIT-VOP directly. --- src/assembly/assemfile.lisp | 4 ++-- src/compiler/ir2opt.lisp | 6 +++--- src/compiler/meta-vmdef.lisp | 10 ++++------ src/compiler/tn.lisp | 12 ++++-------- src/compiler/vmdef.lisp | 19 ++++++++++++++----- src/compiler/vop.lisp | 17 ++--------------- 6 files changed, 29 insertions(+), 39 deletions(-) diff --git a/src/assembly/assemfile.lisp b/src/assembly/assemfile.lisp index 0e54b8c..424b3a2 100644 --- a/src/assembly/assemfile.lisp +++ b/src/assembly/assemfile.lisp @@ -116,7 +116,7 @@ ,@(unless (eq (reg-spec-kind reg) :res) `(:target ,(reg-spec-temp reg))))) -(defun emit-vop (name options vars) +(defun emit-assemble-vop (name options vars) (let* ((args (remove :arg vars :key #'reg-spec-kind :test #'neq)) (temps (remove :temp vars :key #'reg-spec-kind :test #'neq)) (results (remove :res vars :key #'reg-spec-kind :test #'neq)) @@ -190,4 +190,4 @@ (let ((regs (mapcar (lambda (var) (apply #'parse-reg-spec var)) vars))) (if *emit-assembly-code-not-vops-p* (emit-assemble name options regs code) - (emit-vop name options regs))))) + (emit-assemble-vop name options regs))))) diff --git a/src/compiler/ir2opt.lisp b/src/compiler/ir2opt.lisp index b664980..8705c4a 100644 --- a/src/compiler/ir2opt.lisp +++ b/src/compiler/ir2opt.lisp @@ -131,9 +131,9 @@ (let ((end (ir2-block-last-vop 2block)) (move (template-or-lose 'move))) (multiple-value-bind (first last) - (funcall (template-emit-function move) node 2block - move (reference-tn src nil) - (reference-tn dst t)) + (emit-vop node 2block move + (reference-tn src nil) + (reference-tn dst t)) (insert-vop-sequence first last 2block end)))))) (load-and-coerce arg-if value-if) (load-and-coerce arg-else value-else)) diff --git a/src/compiler/meta-vmdef.lisp b/src/compiler/meta-vmdef.lisp index 1242e96..44276fd 100644 --- a/src/compiler/meta-vmdef.lisp +++ b/src/compiler/meta-vmdef.lisp @@ -638,7 +638,7 @@ (let ((target (find-operand (operand-parse-target op) parse '(:temporary :result)))) ;; KLUDGE: These formulas must be consistent with those in - ;; %EMIT-GENERIC-VOP, and this is currently maintained by + ;; EMIT-VOP, and this is currently maintained by ;; hand. -- WHN 2002-01-30, paraphrasing APD (targets (+ (* index max-vop-tn-refs) (ecase (operand-parse-kind target) @@ -709,8 +709,7 @@ :element-type '(specializable ,te-type))))))))) (defun make-emit-function-and-friends (parse) - `(:emit-function #'emit-generic-vop - :temps ,(compute-temporaries-description parse) + `(:temps ,(compute-temporaries-description parse) ,@(compute-ref-ordering parse))) ;;;; generator functions @@ -1747,9 +1746,8 @@ (n-block block) (n-template template)) `(multiple-value-bind (,first ,last) - (funcall (template-emit-function ,n-template) - ,n-node ,n-block ,n-template ,args ,results - ,@(when info `(,info))) + (emit-vop ,n-node ,n-block ,n-template ,args ,results + ,@(when info `(,info))) (insert-vop-sequence ,first ,last ,n-block nil))))) ;;; VOP Name Node Block Arg* Info* Result* diff --git a/src/compiler/tn.lisp b/src/compiler/tn.lisp index a94c585..c75aebf 100644 --- a/src/compiler/tn.lisp +++ b/src/compiler/tn.lisp @@ -344,8 +344,7 @@ (let ((arg (reference-tn x nil)) (result (reference-tn y t))) (multiple-value-bind (first last) - (funcall (template-emit-function template) node block template arg - result) + (emit-vop node block template arg result) (insert-vop-sequence first last block before) last))) @@ -356,8 +355,7 @@ (let ((arg (reference-tn x nil)) (result (reference-tn y t))) (multiple-value-bind (first last) - (funcall (template-emit-function template) node block template arg - result info) + (emit-vop node block template arg result info) (insert-vop-sequence first last block before) last))) @@ -370,8 +368,7 @@ (y-ref (reference-tn y t))) (setf (tn-ref-across x-ref) f-ref) (multiple-value-bind (first last) - (funcall (template-emit-function template) node block template x-ref - y-ref) + (emit-vop node block template x-ref y-ref) (insert-vop-sequence first last block before) last))) @@ -381,8 +378,7 @@ (type template template) (type tn y)) (let ((y-ref (reference-tn y t))) (multiple-value-bind (first last) - (funcall (template-emit-function template) node block template nil - y-ref) + (emit-vop node block template nil y-ref) (insert-vop-sequence first last block before) last))) diff --git a/src/compiler/vmdef.lisp b/src/compiler/vmdef.lisp index 5501d1e..a52b0f7 100644 --- a/src/compiler/vmdef.lisp +++ b/src/compiler/vmdef.lisp @@ -97,7 +97,7 @@ ;;;; generation of emit functions (eval-when (:compile-toplevel :load-toplevel :execute) - ;; We need the EVAL-WHEN because %EMIT-GENERIC-VOP (below) + ;; We need the EVAL-WHEN because EMIT-VOP (below) ;; uses #.MAX-VOP-TN-REFS, not just MAX-VOP-TN-REFS. ;; -- AL 20010218 ;; @@ -114,10 +114,19 @@ (def!constant sc-bits (integer-length (1- sc-number-limit))) -(defun emit-generic-vop (node block template args results &optional info) - (%emit-generic-vop node block template args results info)) - -(defun %emit-generic-vop (node block template args results info) +;; a function that emits the VOPs for this template. Arguments: +;; 1] Node for source context. +;; 2] IR2-BLOCK that we place the VOP in. +;; 3] This structure. +;; 4] Head of argument TN-REF list. +;; 5] Head of result TN-REF list. +;; 6] If INFO-ARG-COUNT is non-zero, then a list of the magic +;; arguments. +;; +;; Two values are returned: the first and last VOP emitted. This vop +;; sequence must be linked into the VOP Next/Prev chain for the +;; block. At least one VOP is always emitted. +(defun emit-vop (node block template args results &optional info) (let* ((vop (make-vop block node template args results)) (num-args (vop-info-num-args template)) (last-arg (1- num-args)) diff --git a/src/compiler/vop.lisp b/src/compiler/vop.lisp index 49307e2..5e3504a 100644 --- a/src/compiler/vop.lisp +++ b/src/compiler/vop.lisp @@ -595,20 +595,7 @@ ;; the number of trailing arguments to VOP or %PRIMITIVE that we ;; bundle into a list and pass into the emit function. This provides ;; a way to pass uninterpreted stuff directly to the code generator. - (info-arg-count 0 :type index) - ;; a function that emits the VOPs for this template. Arguments: - ;; 1] Node for source context. - ;; 2] IR2-BLOCK that we place the VOP in. - ;; 3] This structure. - ;; 4] Head of argument TN-REF list. - ;; 5] Head of result TN-REF list. - ;; 6] If INFO-ARG-COUNT is non-zero, then a list of the magic - ;; arguments. - ;; - ;; Two values are returned: the first and last VOP emitted. This vop - ;; sequence must be linked into the VOP Next/Prev chain for the - ;; block. At least one VOP is always emitted. - (emit-function (missing-arg) :type function)) + (info-arg-count 0 :type index)) (defprinter (template) name arg-types @@ -695,7 +682,7 @@ ;; counts as one, and all the more args/results together count as 1. (num-args 0 :type index) (num-results 0 :type index) - ;; a vector of the temporaries the vop needs. See EMIT-GENERIC-VOP + ;; a vector of the temporaries the vop needs. See EMIT-VOP ;; in vmdef for information on how the temps are encoded. (temps nil :type (or null (specializable-vector (unsigned-byte 16)))) ;; the order all the refs for this vop should be put in. Each -- 1.7.10.4