summaryrefslogtreecommitdiff
path: root/src/modules/ast/assembly-tree.scm
blob: 3f0f1b152217a0bf3d566fc2cacc674041d41012 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
(define-module (modules ast assembly-tree)
  #:use-module (srfi srfi-9)
  #:export (make-subroutine
            subroutine?
            subroutine-label
            subroutine-instructions
            subroutine-frame-size

            make-instruction
            instruction?
            instruction-destination
            set-instruction-destination
            instruction-operator
            instruction-src-1
            instruction-src-2

            make-register
            register?
            register-name
            ))

(define-record-type <subroutine>
  (make-subroutine label instrs f-size)
  subroutine?
  (label subroutine-label)
  (instrs subroutine-instructions)
  (f-size subroutine-frame-size))

(define-record-type <instruction>
  (make-instruction dest op src1 src2)
  instruction?
  (dest instruction-destination set-instruction-destination)
  (op instruction-operator)
  (src1 instruction-src-1)
  (src2 instruction-src-2))

(define-record-type <register>
  (make-register name)
  register?
  (name register-name))