blob: c5d7c05cbd565ba085d3c422c6c2076d914b42c0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
(define-module (backend generator allocate)
#:use-module (backend utils assign-stack)
#:export (expansion->allocate))
(define (expansion->allocate ast)
(define (allocate n)
(cond
((null? n) n)
((eq? (car n) 'tmp-ir)
(list 'stack-ir (make-location (cadr n))))
((list? (car n))
(cons (allocate (car n)) (allocate (cdr n))))
(#t
(cons (car n) (allocate (cdr n))))))
(allocate ast))
|