From dcce4bae8a8172e807e2006d9c5364f211fae1ba Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Sun, 23 Jul 2017 09:18:36 +0200 Subject: [PATCH] mescc: Tinycc support: generalize neg. * module/language/c99/compiler.mes (expr->accu): Generalize neg. --- module/language/c99/compiler.mes | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/module/language/c99/compiler.mes b/module/language/c99/compiler.mes index c7dec6a0..348081ea 100644 --- a/module/language/c99/compiler.mes +++ b/module/language/c99/compiler.mes @@ -765,13 +765,10 @@ (wrap-as (i386:accu-negate))) #:globals (.globals test-info)))) - ((neg (p-expr (fixed ,value))) - (append-text info (value->accu (- (cstring->number value))))) - - ((neg (p-expr (ident ,name))) - (append-text info (append ((ident->base info) name) - (wrap-as (i386:value->accu 0)) - (wrap-as (i386:sub-base))))) + ((neg ,expr) + (let ((info ((expr->base info) expr))) + (append-text info (append (wrap-as (i386:value->accu 0)) + (wrap-as (i386:sub-base)))))) ((eq ,a ,b) ((binop->accu info) a b (append (i386:sub-base) (i386:z->accu)))) ((ge ,a ,b) ((binop->accu info) b a (i386:sub-base)))