Changeset 13764
- Timestamp:
- Jun 1, 2010, 4:23:54 AM (14 years ago)
- File:
-
- 1 edited
-
branches/arm/compiler/ARM/arm-disassemble.lisp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/arm/compiler/ARM/arm-disassemble.lisp
r13751 r13764 192 192 (defun extract-arm-m8-operand (opcodes i) 193 193 (let* ((opcode (adi-opcode (svref opcodes i)))) 194 (let* ((immediate ( not (logbitp 25 opcode)))194 (let* ((immediate (logbitp 22 opcode)) 195 195 (disp (dpb (ldb (byte 4 8) opcode) 196 196 (byte 4 4) … … 319 319 (defun disassemble-arm-xfunction (xfunction &optional (stream *debug-io*)) 320 320 (let* ((adi-vector (process-adi-vector (make-adi-vector (uvref xfunction 1))))) 321 (dotimes (i (length adi-vector)) 322 (let* ((info (svref adi-vector i))) 323 (when (adi-labeled info) 324 (format stream "~&L~d~&" (ash i 2))) 325 (let* ((name (adi-mnemonic info))) 321 (labels ((format-spname (name stream) 322 (let* ((string (string name)) 323 (n (length string)) 324 (copy (make-string n))) 325 (declare (dynamic-extent copy)) 326 (dotimes (i n (format stream "~a" copy)) 327 (let* ((ch (char string i))) 328 (setf (schar copy i) 329 (if (< i 3) 330 ch 331 (char-downcase ch)))))))) 332 (do* ((j (1- (length adi-vector)) (1- j))) 333 ((< j 0)) 334 (let* ((info (svref adi-vector j)) 335 (name (adi-mnemonic info))) 326 336 (when name 327 (let* ((condition-name (or (adi-condition-name info) ""))) 337 (unless (equal name ":word") 338 (unless (equal name "ba") 339 (return)) 340 (unless (eq (adi-labeled info) t) 341 (return)) 342 (setf (adi-labeled info) 343 (concatenate 'string "L" 344 (with-output-to-string (s) 345 (format-spname (cadr (car (adi-operands info))) s)))))))) 346 (dotimes (i (length adi-vector)) 347 (let* ((info (svref adi-vector i)) 348 (labeled (adi-labeled info))) 349 (when labeled 350 (if (eq t labeled) 351 (format stream "~&L~d~&" (ash i 2)) 352 (format stream "~&~a~&" labeled))) 353 (let* ((name (adi-mnemonic info))) 354 (when name 355 (let* ((condition-name (or (adi-condition-name info) ""))) 328 356 (format stream "~& (~a~a" name condition-name)) 329 (labels ((format-operand (operand) 330 (write-char #\space stream) 331 (if (atom operand) 332 (if (and (typep operand 'integer) 333 (> (abs operand) 100)) 334 (format stream "#x~x" operand) 335 (format stream "~d" operand)) 336 (ecase (car operand) 337 (:= (format stream "(:=") 338 (format-operand (cadr operand)) 339 (write-char #\) stream)) 340 (:label (format stream "L~d" (ash (cadr operand) 2))) 341 (:constant (format stream "~s" (list 'quote (uvref xfunction (cadr operand))))) 342 ((:lsl :lsr :asr :ror :rrx) 343 (format stream "(:~a" (string-downcase (car operand))) 344 (dolist (sub (cdr operand)) 345 (format-operand sub)) 346 (write-char #\) stream)) 347 (:spname 348 (let* ((string (string (cadr operand))) 349 (n (length string)) 350 (copy (make-string n))) 351 (declare (dynamic-extent copy)) 352 (dotimes (i n (format stream "~a" copy)) 353 (let* ((ch (char string i))) 354 (setf (schar copy i) 355 (if (< i 3) 356 ch 357 (char-downcase ch))))))) 358 (:$ (format stream "(:$") 359 (format-operand (cadr operand)) 360 (write-char #\) stream)) 361 (:? (format stream "(:? ~a)" (cadr operand))) 362 (:gpr (format stream "~a" (svref *arm-gpr-names* (cadr operand)))) 363 (:single (format stream "s~d" (cadr operand))) 364 (:double (format stream "d~d" (cadr operand))) 365 (:reglist (format stream "~a" 366 (mapcar (lambda (r) 367 (svref *arm-gpr-names* r)) 368 (cadr operand)))) 369 ((:@ :@! :+@ :+@! :-@ :-@! :@+ :@-) 370 (format stream "(~s" (car operand)) 371 (dolist (sub (cdr operand)) 372 (format-operand sub)) 373 (write-char #\) stream)) 374 (:! 375 (format stream "(:!") 376 (format-operand (cadr operand)) 377 (write-char #\) stream)))))) 378 (dolist (op (adi-operands info)) 379 (format-operand op)) 380 (write-char #\) stream)))))))) 357 (labels ((format-operand (operand) 358 (write-char #\space stream) 359 (if (atom operand) 360 (if (and (typep operand 'integer) 361 (> (abs operand) 100)) 362 (format stream "#x~x" operand) 363 (format stream "~d" operand)) 364 (ecase (car operand) 365 (:= (format stream "(:=") 366 (format-operand (cadr operand)) 367 (write-char #\) stream)) 368 (:label 369 (let* ((target (if (< (cadr operand) (length adi-vector)) 370 (svref adi-vector (cadr operand)))) 371 (target-labeled (and target (adi-labeled target))) 372 (target-label (and (not (eq target-labeled t)) 373 target-labeled))) 374 (if target-label 375 (format stream "~a" target-label) 376 (format stream "L~d" (ash (cadr operand) 2))))) 377 (:constant (format stream "~s" (list 'quote (uvref xfunction (cadr operand))))) 378 ((:lsl :lsr :asr :ror :rrx) 379 (format stream "(:~a" (string-downcase (car operand))) 380 (dolist (sub (cdr operand)) 381 (format-operand sub)) 382 (write-char #\) stream)) 383 (:spname 384 (format-spname (cadr operand) stream)) 385 (:$ 386 (if (eql (cadr operand) arm::nil-value) 387 (format stream "'nil") 388 (progn 389 (format stream "(:$") 390 (format-operand (cadr operand)) 391 (write-char #\) stream)))) 392 (:? (format stream "(:? ~a)" (cadr operand))) 393 (:gpr (format stream "~a" (svref *arm-gpr-names* (cadr operand)))) 394 (:single (format stream "s~d" (cadr operand))) 395 (:double (format stream "d~d" (cadr operand))) 396 (:reglist (format stream "~a" 397 (mapcar (lambda (r) 398 (svref *arm-gpr-names* r)) 399 (cadr operand)))) 400 ((:@ :@! :+@ :+@! :-@ :-@! :@+ :@-) 401 (format stream "(~s" (car operand)) 402 (dolist (sub (cdr operand)) 403 (format-operand sub)) 404 (write-char #\) stream)) 405 (:! 406 (format stream "(:!") 407 (format-operand (cadr operand)) 408 (write-char #\) stream)))))) 409 (dolist (op (adi-operands info)) 410 (format-operand op)) 411 (write-char #\) stream))))))))) 381 412 382 413
Note:
See TracChangeset
for help on using the changeset viewer.
