summaryrefslogtreecommitdiff
path: root/src/modules/generator/expansion.scm
blob: 3beb6db80cd10c111739f54ce252ce7e562bcf11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
(define-module (modules generator expansion)
  #:use-module (modules ast ir)
  #:use-module (modules utils merge-instructions)
  #:export (instrs
            not
            neg
            ret))


(define (instrs lst)
  #f
  (list 'instrs (cons 'list (merge-instr lst))))

(define (not dst src) (unary 'not dst src))
(define (neg dst src) (unary 'neg dst src))

(define (ret src)
  (list (list 'mov (list 'reg "eax") src)
        (list 'ret)))

(define (unary op dst src)
  (list (list 'mov dst src)
        (list op dst)))