mescc: Struct by value assignment fixes.
[mes.git] / module / language / c99 / compiler.mes
index 28a4a80c9f6466e82848a59c5e7f117639574bb6..9c3424a7de75780d4578cb23feee15f0a35526d6 100644 (file)
@@ -2117,18 +2117,25 @@ _)))))
                                   (i386:accu+base)))
                          (list (lambda (f g ta t d)
                                  (i386:pop-base)))
-                         (cond ((equal? array "g_functions") ;; FIXME
-                                (list (lambda (f g ta t d)
-                                        (append
-                                         (i386:base-address->accu-address)
-                                         (i386:accu+n 4)
-                                         (i386:base+n 4)
-                                         (i386:base-address->accu-address)
-                                         (i386:accu+n 4)
-                                         (i386:base+n 4)
-                                         (i386:base-address->accu-address)))))
-                               (else (list (lambda (f g ta t d)
-                                             (i386:base->accu-address)))))))))
+                         (if (eq? size 1) (list (lambda (f g ta t d)
+                                                  (i386:byte-base->accu-address)))
+                             (append
+                              (list (lambda (f g ta t d)
+                                      (i386:base-address->accu-address)))
+                              (if (> size 4)
+                                  (list (lambda (f g ta t d)
+                                          (append
+                                           (i386:accu+n 4)
+                                           (i386:base+n 4)
+                                           (i386:base-address->accu-address))))
+                                  '())
+                              (if (> size 8)
+                                  (list (lambda (f g ta t d)
+                                          (append
+                                           (i386:accu+n 4)
+                                           (i386:base+n 4)
+                                           (i386:base-address->accu-address))))
+                                  '())))))))
 
         ;; g_cells[i] = c;
         ((expr-stmt (assn-expr (array-ref (p-expr (ident ,index)) (p-expr (ident ,array))) (op ,op) ,b))
@@ -2161,18 +2168,25 @@ _)))))
                                   (i386:accu+base)))
                          (list (lambda (f g ta t d)
                                  (i386:pop-base)))
-                         (cond ((equal? array "g_functions") ;; FIXME
-                                (list (lambda (f g ta t d)
-                                        (append
-                                         (i386:base-address->accu-address)
-                                         (i386:accu+n 4)
-                                         (i386:base+n 4)
-                                         (i386:base-address->accu-address)
-                                         (i386:accu+n 4)
-                                         (i386:base+n 4)
-                                         (i386:base-address->accu-address)))))
-                               (else (list (lambda (f g ta t d)
-                                             (i386:base->accu-address)))))))))
+                         (if (eq? size 1) (list (lambda (f g ta t d)
+                                                  (i386:byte-base->accu-address)))
+                             (append
+                              (list (lambda (f g ta t d)
+                                      (i386:base-address->accu-address)))
+                              (if (> size 4)
+                                  (list (lambda (f g ta t d)
+                                          (append
+                                           (i386:accu+n 4)
+                                           (i386:base+n 4)
+                                           (i386:base-address->accu-address))))
+                                  '())
+                              (if (> size 8)
+                                  (list (lambda (f g ta t d)
+                                          (append
+                                           (i386:accu+n 4)
+                                           (i386:base+n 4)
+                                           (i386:base-address->accu-address))))
+                                  '())))))))
 
         ;; g_functions[g_function++] = g_foo;
         ((expr-stmt (assn-expr (array-ref (post-inc (p-expr (ident ,index))) (p-expr (ident ,array))) (op ,op) ,b))
@@ -2204,19 +2218,25 @@ _)))))
                                   (i386:accu+base)))
                          (list (lambda (f g ta t d)
                                  (i386:pop-base)))
-                         ;; FIXME
-                         (cond ((equal? array "g_functions") ;; FIXME
-                                (list (lambda (f g ta t d)
-                                        (append
-                                         (i386:base-address->accu-address)
-                                         (i386:accu+n 4)
-                                         (i386:base+n 4)
-                                         (i386:base-address->accu-address)
-                                         (i386:accu+n 4)
-                                         (i386:base+n 4)
-                                         (i386:base-address->accu-address)))))
-                               (else (list (lambda (f g ta t d)
-                                             (i386:base->accu-address)))))
+                         (if (eq? size 1) (list (lambda (f g ta t d)
+                                                  (i386:byte-base->accu-address)))
+                             (append
+                              (list (lambda (f g ta t d)
+                                      (i386:base-address->accu-address)))
+                              (if (> size 4)
+                                  (list (lambda (f g ta t d)
+                                          (append
+                                           (i386:accu+n 4)
+                                           (i386:base+n 4)
+                                           (i386:base-address->accu-address))))
+                                  '())
+                              (if (> size 8)
+                                  (list (lambda (f g ta t d)
+                                          (append
+                                           (i386:accu+n 4)
+                                           (i386:base+n 4)
+                                           (i386:base-address->accu-address))))
+                                  '())))
                          ((ident-add info) index 1)))))
 
         ;; DECL