mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-03-11 07:20:29 -07:00
cmpc: constant optimizers: don't create an intermediate location
We use now constant optimizers to update existing VV and there is no need to box them in a location node.
This commit is contained in:
parent
2e732782ac
commit
7e63354631
2 changed files with 10 additions and 17 deletions
|
|
@ -19,30 +19,23 @@
|
|||
(defun make-single-constant-optimizer (name c-value)
|
||||
(cond ((symbolp name)
|
||||
(let* ((value (symbol-value name))
|
||||
(type (lisp-type->rep-type (type-of value)))
|
||||
(location (make-vv :location c-value :value value :rep-type type)))
|
||||
(cons value (make-c1form* 'LOCATION :type type :args location))))
|
||||
(rep-type (lisp-type->rep-type (type-of value)))
|
||||
(location (make-vv :location c-value :value value :rep-type rep-type)))
|
||||
(cons value location)))
|
||||
((floatp name)
|
||||
(let* ((value name)
|
||||
(type (type-of value))
|
||||
#+ (or) ;; FIXME see WT-TO-OBJECT-CONVERSION
|
||||
(loc-type (case type
|
||||
(cl:single-float :float)
|
||||
(cl:double-float :double)
|
||||
(cl:long-float ':long-double)
|
||||
(si:complex-single-float :csfloat)
|
||||
(si:complex-double-float :cdfloat)
|
||||
(si:complex-long-float :clfloat)))
|
||||
(location (make-vv :location c-value :value value :rep-type :object)))
|
||||
(cons value (make-c1form* 'LOCATION :type type :args location))))
|
||||
(cons value location)))
|
||||
(t
|
||||
(cons name (make-c1form* 'LOCATION :type (type-of name)
|
||||
:args (make-vv :location c-value :value name))))))
|
||||
(cons name (make-vv :location c-value :value name)))))
|
||||
|
||||
(defun make-optimizable-constants (machine)
|
||||
(loop for (value name) in (optimizable-constants-list machine)
|
||||
collect (make-single-constant-optimizer value name)))
|
||||
|
||||
;;; FIXME this is messy - numbers are lisp objects and symbols are native
|
||||
;;; types. We should provide both alternatives for different expected types.
|
||||
;;; See WT-TO-OBJECT-CONVERSION
|
||||
(defun optimizable-constants-list (machine)
|
||||
(append
|
||||
;; Constants that appear everywhere
|
||||
|
|
|
|||
|
|
@ -271,14 +271,14 @@
|
|||
(when (typep value '(or float (complex float)))
|
||||
(pushnew "#include <float.h>" *clines-string-list*)
|
||||
(pushnew "#include <complex.h>" *clines-string-list*))
|
||||
(c1form-arg 0 (cdr x))))
|
||||
(cdr x)))
|
||||
|
||||
(defun try-const-c-inliner (var)
|
||||
(check-type var var)
|
||||
(let ((name (var-name var)))
|
||||
(when (constant-variable-p name)
|
||||
(ext:when-let ((x (assoc name *optimizable-constants*)))
|
||||
(c1form-arg 0 (cdr x))))))
|
||||
(cdr x)))))
|
||||
|
||||
(defun try-inline-core-sym (object)
|
||||
(when (symbolp object)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue