Changeset 14897
- Timestamp:
- Jul 21, 2011, 3:17:53 AM (13 years ago)
- Location:
- trunk/source/compiler/ARM
- Files:
-
- 2 edited
-
arm-asm.lisp (modified) (27 diffs)
-
arm-disassemble.lisp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/compiler/ARM/arm-asm.lisp
r14772 r14897 81 81 (arm-constant-index quoted)))) 82 82 (progn 83 (unless (and (consp form) (eq ( keywordize (car form)) :$))83 (unless (and (consp form) (eq (car form) :$)) 84 84 (error "Invalid constant syntax in ~s" form)) 85 85 (destructuring-bind (val) (cdr form) … … 124 124 :fpux 125 125 :imm16 126 :srcount ;single register count 127 :drcount 126 128 )) 127 129 … … 787 789 #x0f300f00 788 790 ()) 791 (define-arm-instruction fstmdbs (:sd :rnw :srcount) 792 #x0d200a00 793 #x0fb00f00 794 ()) 795 (define-arm-instruction fstmdbd (:dd :rnw :drcount) 796 #x0d200b00 797 #x0fb00f00 798 ()) 789 799 (define-arm-instruction fldd (:dd :fpaddr) 790 800 #x0d100b00 … … 795 805 #x0f300f00 796 806 ()) 807 (define-arm-instruction fldmias (:sd :rnw :srcount) 808 #x0cb00a00 809 #x0fb00f00 810 ()) 811 (define-arm-instruction fldmiad (:dd :rnw :srcount) 812 #x0cb00b00 813 #x0fb00f00 814 ()) 797 815 (define-arm-instruction ftosid (:sd :dm) 798 816 #x0ebd0b40 … … 873 891 (values nil nil nil))))) 874 892 875 (defun keywordize (name) 876 (if (typep name 'keyword) 877 name 878 (intern (string-upcase (string name)) "KEYWORD"))) 893 879 894 880 895 (defun arm-rotate-left (u32 nbits) … … 1112 1127 (if (ccl::quoted-form-p form) 1113 1128 (insert-shifter-constant (need-constant form) instruction) 1114 (let* ((op ( keywordize (car form))))1129 (let* ((op (car form))) 1115 1130 (ecase op 1116 1131 (:$ (destructuring-bind (value) (cdr form) … … 1128 1143 (ash (encode-arm-shift-type op) 5) 1129 1144 (ash (need-arm-gpr count) 8))) 1130 (ecase ( keywordize (car count))1145 (ecase (car count) 1131 1146 (:$ (destructuring-bind (countval) (cdr count) 1132 1147 (set-field-value instruction (byte 12 0) … … 1197 1212 (if (atom form) 1198 1213 (error "Invalid memory operand ~s" form) 1199 (let* ((mode ( keywordize (car form))))1214 (let* ((mode (car form))) 1200 1215 (if (eq mode :=) 1201 1216 (destructuring-bind (label) (cdr form) … … 1211 1226 (set-field-value instruction (byte 4 16) (need-arm-gpr rn)) 1212 1227 (let* ((quoted (ccl::quoted-form-p index)) 1213 (index-op (if quoted :quote (and (consp index) ( keywordize (car index)))))1228 (index-op (if quoted :quote (and (consp index) (car index)))) 1214 1229 (constant-index (or quoted (eq index-op :$)))) 1215 1230 (cond (constant-index … … 1238 1253 (destructuring-bind (rm shift-expr) (cdr index) 1239 1254 (unless (and (consp shift-expr) 1240 (eq ( keywordize (car shift-expr)) :$))1255 (eq (car shift-expr) :$)) 1241 1256 (error "Shift count must be immediate : ~s" shift-expr)) 1242 1257 (destructuring-bind (count-expr) (cdr shift-expr) … … 1263 1278 (if (atom form) 1264 1279 (set-field-value instruction (byte 4 16) (need-arm-gpr form)) 1265 (if (eq ( keywordize (car form)) :!)1280 (if (eq (car form) :!) 1266 1281 (destructuring-bind (rn) (cdr form) 1267 1282 (set-field-value instruction (byte 1 21) 1) … … 1284 1299 (let* ((regno (if (typep form '(unsigned-byte 4)) 1285 1300 form 1286 (ecase (keywordize form)1301 (ecase form 1287 1302 (:fpsid 0) 1288 1303 (:fpscr 1) … … 1292 1307 (defun parse-imm16-operand (form instruction) 1293 1308 (unless (and (consp form) 1294 (eq ( keywordize (car form)) :$)1309 (eq (car form) :$) 1295 1310 (consp (cdr form)) 1296 1311 (null (cddr form))) … … 1300 1315 (set-field-value instruction (byte 4 16) (ldb (byte 4 12) val)))) 1301 1316 1317 (defun parse-srcount-operand (form instruction) 1318 (let* ((val (eval form))) 1319 (unless (and (typep val 'fixnum) 1320 (> (the fixnum val) 0) 1321 (< (the fixnum val) 33)) 1322 (ccl::report-bad-arg form `(integer (0) (33)))) 1323 (set-field-value instruction (byte 8 0) val))) 1324 1325 (defun parse-drcount-operand (form instruction) 1326 (let* ((val (eval form))) 1327 (unless (and (typep val 'fixnum) 1328 (> (the fixnum val) 0) 1329 (< (the fixnum val) 33)) 1330 (ccl::report-bad-arg form `(integer (0) (33)))) 1331 (set-field-value instruction (byte 7 1) val))) 1302 1332 1303 1333 (defun parse-rm-operand (form instruction) … … 1326 1356 (if (atom form) 1327 1357 (error "Invalid memory operand ~s." form) 1328 (let* ((mode ( keywordize (car form)))1358 (let* ((mode (car form)) 1329 1359 (constant-index nil)) 1330 1360 (destructuring-bind (rn index) (cdr form) … … 1332 1362 (cond ((atom index) 1333 1363 (set-field-value instruction (byte 4 0) (need-arm-gpr index))) 1334 (t (unless (eq ( keywordize (car index)) :$)1364 (t (unless (eq (car index) :$) 1335 1365 (error "Invalid index: ~s." index)) 1336 1366 (destructuring-bind (val) (cdr index) … … 1382 1412 (error "Invalid FP address: ~s" form) 1383 1413 (destructuring-bind (op rn offset) form 1384 (unless (eq (keywordize op):@)1414 (unless (eq op :@) 1385 1415 (error "Invalid FP addressing mode ~s in ~s." op form)) 1386 1416 (set-field-value instruction (byte 4 16) (need-arm-gpr rn)) 1387 (unless (and (consp offset) (eq ( keywordize (car offset)) :$))1417 (unless (and (consp offset) (eq (car offset) :$)) 1388 1418 (error "Invalid FP address offset ~s in ~s." offset form)) 1389 1419 (destructuring-bind (offset-form) (cdr offset) … … 1398 1428 (defun parse-@rn-operand (form instruction) 1399 1429 (when (or (atom form) 1400 (not (eq ( keywordize (car form)) :@)))1430 (not (eq (car form) :@))) 1401 1431 (error "Invalid register indirect operand: ~s" form)) 1402 1432 (destructuring-bind (rn) (cdr form) … … 1430 1460 parse-fpux-operand 1431 1461 parse-imm16-operand 1462 parse-srcount-operand 1463 parse-drcount-operand 1432 1464 )) 1433 1465 … … 1464 1496 (error "Unknown ARM instruction - ~s" form)) 1465 1497 (let* ((cond-indicator (and (consp (car opvals)) 1466 ( keywordize (caar opvals)))))1498 (caar opvals)))) 1467 1499 (when (or (eq cond-indicator :?) 1468 1500 (eq cond-indicator :~)) … … 1724 1756 :uuoC 1725 1757 :imm16 1758 :srcount 1759 :drcount 1726 1760 ))) 1727 1761 … … 1757 1791 vinsn-parse-fpux-operand 1758 1792 vinsn-parse-imm16-operand 1793 vinsn-parse-srcount-operand 1794 vinsn-parse-drcount-operand 1759 1795 )) 1760 1796 … … 1952 1988 (let* ((regno (if (typep value '(unsigned-byte 4)) 1953 1989 value 1954 (ecase (keywordize value)1990 (ecase value 1955 1991 (:fpsid 0) 1956 1992 (:fpscr 1) … … 2077 2113 (set-avi-opcode-field avi (byte 4 16) (ldb (byte 4 12) val))))) 2078 2114 2115 (defun vinsn-parse-srcount-operand (avi value vinsn-params) 2116 (let* ((val (vinsn-arg-or-constant avi value vinsn-params (encode-vinsn-field-type :srcount) nil))) 2117 (when val 2118 (check-type val (integer 1 32)) 2119 (set-avi-opcode-field avi (byte 8 0) val)))) 2120 2121 (defun vinsn-parse-drcount-operand (avi value vinsn-params) 2122 (let* ((val (vinsn-arg-or-constant avi value vinsn-params (encode-vinsn-field-type :drcount) nil))) 2123 (when val 2124 (check-type val (integer 1 32)) 2125 (set-avi-opcode-field avi (byte 7 1) val)))) 2079 2126 2080 2127 (defun vinsn-simplify-instruction (form vinsn-params) … … 2090 2137 (error "Unknown ARM instruction - ~s" form)) 2091 2138 (let* ((cond-indicator (and (consp (car opvals)) 2092 ( keywordize (caar opvals))))2139 (caar opvals))) 2093 2140 (avi (make-arm-vinsn-instruction (arm-instruction-template-val template)))) 2094 2141 (when (or (eq cond-indicator :?) … … 2155 2202 vinsn-insert-uuoc-operand 2156 2203 vinsn-insert-imm16-operand 2204 vinsn-insert-srcount-operand 2205 vinsn-insert-drcount-operand 2157 2206 )) 2158 2207 … … 2269 2318 (set-field-value instruction (byte 4 16) (ldb (byte 4 12) value))) 2270 2319 2320 (defun vinsn-insert-srcount-operand (instruction value) 2321 (set-field-value instruction (byte 8 0) value)) 2322 2323 (defun vinsn-insert-drcount-operand (instruction value) 2324 (set-field-value instruction (byte 7 1) value)) 2325 2271 2326 2272 2327 -
trunk/source/compiler/ARM/arm-disassemble.lisp
r14843 r14897 287 287 (ldb (byte 1 7) opcode))))) 288 288 289 (defun extract-arm-srcount-operand (opcodes i) 290 (let* ((opcode (adi-opcode (svref opcodes i)))) 291 (ldb (byte 8 0) opcode))) 292 293 (defun extract-arm-drcount-operand (opcodes i) 294 (let* ((opcode (adi-opcode (svref opcodes i)))) 295 (ldb (byte 7 1) opcode))) 289 296 290 297 (defparameter *arm-operand-extract-functions* … … 315 322 extract-arm-fpux-operand 316 323 extract-arm-imm16-operand 324 extract-arm-srcount-operand 325 extract-arm-drcount-operand 317 326 )) 318 327
Note:
See TracChangeset
for help on using the changeset viewer.
