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 "")))
(tdata-comma (if (> (string-length tdata) 0) "," ""))
(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-type (mangle (gensym 'local)))
(else "")))
(tptr-decl
(cond
((and tptr-type use-alloca?) (string-append "object " tptr " = alloca(sizeof(" tptr-type ")); "))
(tptr-type (string-append tptr-type " " tptr "; "))
(else "")))
(c-var-assign