mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-23 20:15:05 +02:00
Support alloca for all literals
This commit is contained in:
parent
e63349b830
commit
1f1b032641
1 changed files with 5 additions and 4 deletions
|
@ -416,11 +416,14 @@
|
|||
|
||||
(define (c-compile-scalars args use-alloca)
|
||||
(letrec (
|
||||
(addr-op (if use-alloca "" "&"))
|
||||
;(deref-op (if use-alloca "->" "."))
|
||||
(c-make-macro (if use-alloca "alloca_pair" "make_pair"))
|
||||
(num-args 0)
|
||||
(create-cons
|
||||
(lambda (cvar a b)
|
||||
(c-code/vars
|
||||
(string-append "make_pair(" cvar "," (c:body a) "," (c:body b) ");")
|
||||
(string-append c-make-macro "(" cvar "," (c:body a) "," (c:body b) ");")
|
||||
(append (c:allocs a) (c:allocs b))))
|
||||
)
|
||||
(_c-compile-scalars
|
||||
|
@ -438,8 +441,7 @@
|
|||
(_c-compile-scalars (cdr args)))))
|
||||
(set! num-args (+ 1 num-args))
|
||||
(c-code/vars
|
||||
;;cvar-name ;; Not needed with alloca - (string-append "&" cvar-name)
|
||||
(string-append "&" cvar-name)
|
||||
(string-append addr-op cvar-name)
|
||||
(append
|
||||
(c:allocs cell)
|
||||
(list (c:body cell))))))))))
|
||||
|
@ -590,7 +592,6 @@
|
|||
((null? exp)
|
||||
(c-code "NULL"))
|
||||
((pair? exp)
|
||||
;; TODO: use-alloc support
|
||||
(c-compile-scalars exp use-alloca))
|
||||
((vector? exp)
|
||||
(c-compile-vector exp use-alloca))
|
||||
|
|
Loading…
Add table
Reference in a new issue