mescc: Remove jump calculation, use labels: and, or.

* module/language/c99/compiler.mes (expr->accu): Refactor (and
  ...), (or ...).
This commit is contained in:
Jan Nieuwenhuizen 2017-06-12 22:11:19 +02:00
parent 0a94b499fa
commit 36e0219af3

View file

@ -738,27 +738,27 @@
((lt ,a ,b) ((binop->accu info) b a (i386:base-sub))) ((lt ,a ,b) ((binop->accu info) b a (i386:base-sub)))
((or ,a ,b) ((or ,a ,b)
(let* ((empty (clone info #:text '())) (let* ((here (number->string (length (.text info))))
(b-length (length (append (i386:Xjump-nz 0) (skip-b-label (string-append (.function info) "_skip_b_" here))
(i386:accu-test))))
(info ((expr->accu info) a)) (info ((expr->accu info) a))
(info (append-text info (wrap-as (i386:accu-test)))) (info (append-text info (wrap-as (i386:accu-test))))
(info (append-text info (wrap-as (append (i386:Xjump-nz (- b-length 1)) (info (append-text info (wrap-as (i386:jump-label-nz `(#:local ,skip-b-label)))))
(i386:accu-test))))) (info (append-text info (wrap-as (i386:accu-test))))
(info ((expr->accu info) b)) (info ((expr->accu info) b))
(info (append-text info (wrap-as (i386:accu-test))))) (info (append-text info (wrap-as (i386:accu-test))))
(info (append-text info (wrap-as `(#:label ,skip-b-label)))))
info)) info))
((and ,a ,b) ((and ,a ,b)
(let* ((empty (clone info #:text '())) (let* ((here (number->string (length (.text info))))
(b-length (length (append (i386:Xjump-z 0) (skip-b-label (string-append (.function info) "_skip_b_" here))
(i386:accu-test))))
(info ((expr->accu info) a)) (info ((expr->accu info) a))
(info (append-text info (wrap-as (i386:accu-test)))) (info (append-text info (wrap-as (i386:accu-test))))
(info (append-text info (wrap-as (append (i386:Xjump-z (- b-length 1)) (info (append-text info (wrap-as (i386:jump-label-z `(#:local ,skip-b-label)))))
(i386:accu-test))))) (info (append-text info (wrap-as (i386:accu-test))))
(info ((expr->accu info) b)) (info ((expr->accu info) b))
(info (append-text info (wrap-as (i386:accu-test))))) (info (append-text info (wrap-as (i386:accu-test))))
(info (append-text info (wrap-as `(#:label ,skip-b-label)))))
info)) info))
((cast ,cast ,o) ((cast ,cast ,o)