Support alloca of basic arithmetic operations

This commit is contained in:
Justin Ethier 2018-10-24 13:29:34 -04:00
parent be5a5f1c6b
commit c10d38e170

View file

@ -692,12 +692,17 @@
(else ""))) (else "")))
(tdata-comma (if (> (string-length tdata) 0) "," "")) (tdata-comma (if (> (string-length tdata) 0) "," ""))
(tptr-type (prim/c-var-pointer p)) (tptr-type (prim/c-var-pointer p))
(tptr-comma (if tptr-type ",&" "")) (tptr-comma
(cond
((and tptr-type use-alloca?) ",")
(tptr-type ",&")
(else "")))
(tptr (cond (tptr (cond
(tptr-type (mangle (gensym 'local))) (tptr-type (mangle (gensym 'local)))
(else ""))) (else "")))
(tptr-decl (tptr-decl
(cond (cond
((and tptr-type use-alloca?) (string-append "object " tptr " = alloca(sizeof(" tptr-type ")); "))
(tptr-type (string-append tptr-type " " tptr "; ")) (tptr-type (string-append tptr-type " " tptr "; "))
(else ""))) (else "")))
(c-var-assign (c-var-assign