Changeset 13249


Ignore:
Timestamp:
Dec 3, 2009, 10:44:12 AM (10 years ago)
Author:
gb
Message:

NX2-CONSTANT-INDEX-OK-FOR-TYPE-KEYWORD: returns T iff a fixnum constant
is a valid uvector index for a uvector of the type described by
a type keyword. (On x86, that mostly means that the scaled index fits
in 31 bits.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/compiler/nx2.lisp

    r13143 r13249  
    242242      (cadr x)
    243243      (compiler-bug "not an immediate: ~s" x))))
     244
     245(defun nx2-constant-index-ok-for-type-keyword (idx keyword)
     246  (when (>= idx 0)
     247    (let* ((arch (backend-target-arch *target-backend*))
     248           (limit
     249            (case keyword
     250              ((:bignum
     251                :single-float
     252                :double-float
     253                :xcode-vector
     254                :signed-32-bit-vector
     255                :unsigned-32-bit-vector
     256                :single-float-vector
     257                :simple-string)
     258               (arch::target-max-32-bit-constant-index arch))
     259              (:bit-vector (arch::target-max-1-bit-constant-index arch))
     260              ((:signed-8-bit-vector :unsigned-8-bit-vector)
     261               (arch::target-max-8-bit-constant-index arch))
     262              ((:signed-16-bit-vector :unsigned-16-bit-vector)
     263               (arch::target-max-16-bit-constant-index arch))
     264              ((:signed-64-bit-vector
     265                :unsigned-64-bit-vector
     266                :double-float-vector)
     267               (arch::target-max-64-bit-constant-index arch))
     268              (t
     269               ;; :fixnum or node
     270               (target-word-size-case
     271                (32 (arch::target-max-32-bit-constant-index arch))
     272                (64 (arch::target-max-64-bit-constant-index arch)))))))
     273      (and limit (< idx limit)))))
Note: See TracChangeset for help on using the changeset viewer.