From 1f1b03264123be46f9e5c9e5d7e887c067b37491 Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Wed, 21 Nov 2018 19:19:00 -0500 Subject: [PATCH] Support alloca for all literals --- scheme/cyclone/cgen.sld | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scheme/cyclone/cgen.sld b/scheme/cyclone/cgen.sld index 62b415f3..b96c8b07 100644 --- a/scheme/cyclone/cgen.sld +++ b/scheme/cyclone/cgen.sld @@ -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))