-(defun prefilter-word-reg (value dstate)
- (declare (type (or full-reg list) value))
- (if (atom value)
- value
- (let ((reg (first value))
- (rex.wrxb (second value)))
- (declare (type (or null (unsigned-byte 4)) rex.wrxb)
- (type (unsigned-byte 3) reg))
- (setf (sb!disassem:dstate-get-prop dstate 'reg-width)
- (if (and rex.wrxb (plusp (logand rex.wrxb #b1000)))
- :qword
- +default-operand-size+))
- (if (plusp (logand rex.wrxb #b0100))
- (+ 8 reg)
- reg))))
-
+;;; This prefilter is used solely for its side effects, namely to put
+;;; the bits found in the REX prefix into the DSTATE for use by other
+;;; prefilters and by printers.
+(defun prefilter-wrxb (value dstate)
+ (declare (type (unsigned-byte 4) value)
+ (type sb!disassem:disassem-state dstate))
+ (sb!disassem:dstate-put-inst-prop dstate 'rex)
+ (when (plusp (logand value #b1000))
+ (sb!disassem:dstate-put-inst-prop dstate 'rex-w))
+ (when (plusp (logand value #b0100))
+ (sb!disassem:dstate-put-inst-prop dstate 'rex-r))
+ (when (plusp (logand value #b0010))
+ (sb!disassem:dstate-put-inst-prop dstate 'rex-x))
+ (when (plusp (logand value #b0001))
+ (sb!disassem:dstate-put-inst-prop dstate 'rex-b))
+ value)
+
+;;; This prefilter is used solely for its side effect, namely to put
+;;; the property OPERAND-SIZE-8 into the DSTATE if VALUE is 0.
+(defun prefilter-width (value dstate)
+ (declare (type bit value)
+ (type sb!disassem:disassem-state dstate))
+ (when (zerop value)
+ (sb!disassem:dstate-put-inst-prop dstate 'operand-size-8))
+ value)
+
+;;; A register field that can be extended by REX.R.
+(defun prefilter-reg-r (value dstate)
+ (declare (type reg value)
+ (type sb!disassem:disassem-state dstate))
+ (if (sb!disassem::dstate-get-inst-prop dstate 'rex-r)
+ (+ value 8)
+ value))
+
+;;; A register field that can be extended by REX.B.
+(defun prefilter-reg-b (value dstate)
+ (declare (type reg value)
+ (type sb!disassem:disassem-state dstate))
+ (if (sb!disassem::dstate-get-inst-prop dstate 'rex-b)
+ (+ value 8)
+ value))
+