From 36e0219af39b89cd2fa54439f82c5fb0b003fe63 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Mon, 12 Jun 2017 22:11:19 +0200 Subject: [PATCH] mescc: Remove jump calculation, use labels: and, or. * module/language/c99/compiler.mes (expr->accu): Refactor (and ...), (or ...). --- module/language/c99/compiler.mes | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/module/language/c99/compiler.mes b/module/language/c99/compiler.mes index 24563c87..3458b22d 100644 --- a/module/language/c99/compiler.mes +++ b/module/language/c99/compiler.mes @@ -738,27 +738,27 @@ ((lt ,a ,b) ((binop->accu info) b a (i386:base-sub))) ((or ,a ,b) - (let* ((empty (clone info #:text '())) - (b-length (length (append (i386:Xjump-nz 0) - (i386:accu-test)))) + (let* ((here (number->string (length (.text info)))) + (skip-b-label (string-append (.function info) "_skip_b_" here)) (info ((expr->accu info) a)) (info (append-text info (wrap-as (i386:accu-test)))) - (info (append-text info (wrap-as (append (i386:Xjump-nz (- b-length 1)) - (i386:accu-test))))) + (info (append-text info (wrap-as (i386:jump-label-nz `(#:local ,skip-b-label))))) + (info (append-text info (wrap-as (i386:accu-test)))) (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)) ((and ,a ,b) - (let* ((empty (clone info #:text '())) - (b-length (length (append (i386:Xjump-z 0) - (i386:accu-test)))) + (let* ((here (number->string (length (.text info)))) + (skip-b-label (string-append (.function info) "_skip_b_" here)) (info ((expr->accu info) a)) (info (append-text info (wrap-as (i386:accu-test)))) - (info (append-text info (wrap-as (append (i386:Xjump-z (- b-length 1)) - (i386:accu-test))))) + (info (append-text info (wrap-as (i386:jump-label-z `(#:local ,skip-b-label))))) + (info (append-text info (wrap-as (i386:accu-test)))) (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)) ((cast ,cast ,o)