summaryrefslogtreecommitdiff
path: root/src/semantic/frame.rs
blob: ddfc3309ca2de47f0f5567997faa39f788692431 (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
41
42
43
44
use super::temp;

pub enum Location {
    InFrame {
        offset: usize,
    },
    Register(temp::TempName),
}

pub enum Escape {
    No,
    Yes,
}

pub trait Frame {
    fn new(name: temp::TempLabel, formals: Vec<Escape>) -> Self;
    fn name(&self) -> temp::TempLabel;
    fn formals(&self) -> &[Location];
    fn alloc_local(&mut self, escapes: Escape) -> Location;
}

pub struct Amd64Frame {
    name: temp::TempLabel,
}

impl Frame for Amd64Frame {
    fn new(name: temp::TempLabel, formals: Vec<Escape>) -> Self {
        Amd64Frame {
            name,
        }
    }

    fn name(&self) -> temp::TempLabel {
        self.name
    }

    fn formals(&self) -> &[Location] {
        unimplemented!();
    }

    fn alloc_local(&mut self, escapes: Escape) -> Location {
        unimplemented!();
    }
}