diff --git a/module/language/c99/compiler.mes b/module/language/c99/compiler.mes index 51edc307..62c7ee57 100644 --- a/module/language/c99/compiler.mes +++ b/module/language/c99/compiler.mes @@ -523,6 +523,7 @@ (locals (cons (make-local name type pointer id) locals))) locals)) (pmatch o + ((expr) info) ((p-expr (string ,string)) (let* ((globals (append globals (list (string->global string)))) (info (clone info #:globals globals))) @@ -558,12 +559,24 @@ ((ref-to (array-ref ,index (p-expr (ident ,array)))) ((expr->accu* info) `(array-ref ,index (p-expr (ident ,array))))) + ((sizeof-expr (p-expr (ident ,name))) + (let* ((type (ident->type info name)) + (fields (or (type->description info type) '())) + (size (type->size info type))) + (append-text info (wrap-as (i386:value->accu size))))) + + ((sizeof-type (type-name (decl-spec-list (type-spec (fixed-type ,name))))) + (let* ((type name) + (fields (or (type->description info type) '())) + (size (type->size info type))) + (append-text info (wrap-as (i386:value->accu size))))) + ((sizeof-type (type-name (decl-spec-list (type-spec (struct-ref (ident ,name)))))) (let* ((type (list "struct" name)) (fields (or (type->description info type) '())) (size (type->size info type))) (append-text info (wrap-as (i386:value->accu size))))) - + ;; c+p expr->arg ;; g_cells[] ((array-ref ,index (p-expr (ident ,array))) @@ -1453,9 +1466,6 @@ (list (lambda (f g ta t d) (jump (- (label-offset (.function info) label f) offset)))))))) - ((return (expr)) - (append-text info (append (wrap-as (i386:ret))))) - ((return ,expr) (let ((info ((expr->accu info) expr))) (append-text info (append (wrap-as (i386:ret))))))