Changeset 16143


Ignore:
Timestamp:
Jul 27, 2014, 10:12:30 PM (7 years ago)
Author:
gb
Message:

Add a few platform-independent acode-walking functions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/pinsn/source/compiler/nx2.lisp

    r16111 r16143  
    516516                          (t '*))))))))
    517517
    518            
     518(defun acode-trivial-p (form)
     519  (let* ((op (acode-operator form)))
     520    (if (eql op (%nx1-operator typed-form))
     521      (destructuring-bind (subform &optional check) (cdr (acode-operands form))
     522        (unless check (acode-trivial-p subform)))
     523      (or (eql op (%nx1-operator nil))
     524          (eql op (%nx1-operator t))
     525          (eql op (%nx1-operator simple-function))
     526          (eql op (%nx1-operator fixnum))
     527          (eql op (%nx1-operator immediate))
     528          (and (or (eql op (%nx1-operator lexical-reference))
     529                   (eql op (%nx1-operator inherited-arg)))
     530               (not (logbitp $vbitsetq (nx-var-bits (car (acode-operands form))))))))))
     531
     532(defun acode-single-valued-form-p (form)
     533  (setq form (acode-unwrapped-form-value form))
     534  (or (nx-null form)
     535      (nx-t form)
     536      (if (acode-p form)
     537        (let ((op (acode-operator form)))
     538          (or (%ilogbitp operator-single-valued-bit op)
     539              (and (eql op (%nx1-operator values))
     540                   (let ((values (car (acode-operands form))))
     541                     (and values (null (cdr values)))))
     542              nil                       ; Learn about functions someday
     543              )))))
     544             
     545
Note: See TracChangeset for help on using the changeset viewer.