fixed invalid code generation of (movl k0 (disp k1 k2)) which is

invalid in X86_64.
This commit is contained in:
Abdulaziz Ghuloum 2009-09-12 22:20:07 +03:00
parent 12f41f4a8a
commit 4c2b13ebe0
5 changed files with 19 additions and 26 deletions

View File

@ -2337,28 +2337,20 @@
(E (make-asm-instr 'move u b)) (E (make-asm-instr 'move u b))
(E (make-asm-instr op a u))))] (E (make-asm-instr op a u))))]
[else [else
(let ([s1 (disp-s0 a)] [s2 (disp-s1 a)]) (check-disp a
(cond (lambda (a)
[(and (mem? s1) (mem? s2)) (let ([s0 (disp-s0 a)] [s1 (disp-s1 a)])
(let ([u (mku)]) (cond
(make-seq [(and (constant? s0) (constant? s1))
(make-seq (let ([u (mku)])
(E (make-asm-instr 'move u s1)) (make-seq
(E (make-asm-instr 'int+ u s2))) (make-seq
(make-asm-instr op (E (make-asm-instr 'move u s0))
(make-disp u (make-constant 0)) (E (make-asm-instr 'int+ u s1)))
b)))] (make-asm-instr op
[(mem? s1) (make-disp u (make-constant 0))
(let ([u (mku)]) b)))]
(make-seq [else (make-asm-instr op a b)]))))])]
(E (make-asm-instr 'move u s1))
(E (make-asm-instr op (make-disp u s2) b))))]
[(mem? s2)
(let ([u (mku)])
(make-seq
(E (make-asm-instr 'move u s2))
(E (make-asm-instr op (make-disp u s1) b))))]
[else x]))])]
[(fl:load fl:store fl:add! fl:sub! fl:mul! fl:div! [(fl:load fl:store fl:add! fl:sub! fl:mul! fl:div!
fl:load-single fl:store-single) fl:load-single fl:store-single)
(check-disp-arg a (check-disp-arg a

View File

@ -554,8 +554,8 @@
(CODE c0 (CODE c1 (IMM32 i32 ac)))) (CODE c0 (CODE c1 (IMM32 i32 ac))))
(define (dotrace orig ls) (define (dotrace instr orig ls)
(printf "TRACE: ~s\n" (printf "TRACE: ~s ~s\n" instr
(let f ([ls ls]) (let f ([ls ls])
(if (eq? ls orig) (if (eq? ls orig)
'() '()

View File

@ -139,6 +139,7 @@
open-directory-stream directory-stream? open-directory-stream directory-stream?
read-directory-stream close-directory-stream read-directory-stream close-directory-stream
process*
)) ))
;(define-syntax assert* (identifier-syntax assert)) ;(define-syntax assert* (identifier-syntax assert))

View File

@ -1 +1 @@
1853 1855

View File

@ -50,7 +50,7 @@
(put-u8 p b)) (put-u8 p b))
(append stub1 (mkstub2 (length ls)) stub3 ls)) (append stub1 (mkstub2 (length ls)) stub3 ls))
(close-output-port p)) (close-output-port p))
(system "otool64 -tv tmp.o")) (system "otool -tv tmp.o"))
(printf "Trying a simple sequence ...\n") (printf "Trying a simple sequence ...\n")