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 op a u))))]
[else
(let ([s1 (disp-s0 a)] [s2 (disp-s1 a)])
(cond
[(and (mem? s1) (mem? s2))
(let ([u (mku)])
(make-seq
(make-seq
(E (make-asm-instr 'move u s1))
(E (make-asm-instr 'int+ u s2)))
(make-asm-instr op
(make-disp u (make-constant 0))
b)))]
[(mem? s1)
(let ([u (mku)])
(make-seq
(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]))])]
(check-disp a
(lambda (a)
(let ([s0 (disp-s0 a)] [s1 (disp-s1 a)])
(cond
[(and (constant? s0) (constant? s1))
(let ([u (mku)])
(make-seq
(make-seq
(E (make-asm-instr 'move u s0))
(E (make-asm-instr 'int+ u s1)))
(make-asm-instr op
(make-disp u (make-constant 0))
b)))]
[else (make-asm-instr op a b)]))))])]
[(fl:load fl:store fl:add! fl:sub! fl:mul! fl:div!
fl:load-single fl:store-single)
(check-disp-arg a

View File

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

View File

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

View File

@ -1 +1 @@
1853
1855

View File

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