mescc: Refactor ret.

* module/mes/libc-i386.mes (i386:ret): Refactor.
* module/language/c99/compiler.mes (ast->info): Use it.
This commit is contained in:
Jan Nieuwenhuizen 2017-03-19 10:27:18 +01:00
parent a010203f0d
commit 124352e087
2 changed files with 4 additions and 14 deletions

View File

@ -1697,7 +1697,7 @@ _)))))
((return ,expr)
(let ((accu ((expr->accu info) expr)))
(clone accu #:text
(append (.text accu) (list (i386:ret (lambda _ '())))))))
(append (.text accu) (list (lambda (f g ta t d) (i386:ret)))))))
;; int i;
((decl (decl-spec-list (type-spec (fixed-type ,type))) (init-declr-list (init-declr (ident ,name))))

View File

@ -71,19 +71,9 @@
(define (i386:push-base)
'(#x52)) ; push %eax
(define (i386:ret . rest)
(lambda (f g ta t d)
`(
,@(cond ((null? rest) '())
((number? (car rest))
`(#xb8 ; mov $<>,%eaxx
,@(int->bv32 (car rest))))
((pair? (car rest)) (car rest))
((procedure? (car rest))
((car rest) f g ta t d)))
#xc9 ; leave
#xc3 ; ret
)))
(define (i386:ret)
'(#xc9 ; leave
#xc3)) ; ret
(define (i386:accu->base)
'(#x89 #xc2)) ; mov %eax,%edx