-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathframe.sig
58 lines (43 loc) · 1.61 KB
/
frame.sig
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
signature FRAME =
sig
type frame
type access
val newFrame : {name: Temp.label, formals: bool list} -> frame
val name : frame -> Temp.label
val formals : frame -> access list
val allocLocal : frame -> bool -> access
type register = string
val registers : register list
val tempMap : register Temp.Table.table
val SP : Temp.temp
val FP : Temp.temp
val RV : Temp.temp
val ZERO : Temp.temp
(* Registers "trashed" by call. *)
val calldefs : Temp.temp list
val wordSize : int
datatype frag = PROC of {frame: frame, body: Tree.stm}
| STRING of Temp.label * string
(* Returns a Tree expression for an access.
* The Tree.exp argument is the frame pointer for the relevant frame.
*)
val expOfAccess : access -> Tree.exp -> Tree.exp
val externalCall : string * Tree.exp list -> Tree.exp
(* Returns the correct position (register or memory) for the ith argument
* before a call.
*)
val argPos : int -> Tree.exp
(* View shift *)
val procEntryExit1 : frame * Tree.stm -> Tree.stm
(* Appends a "sink" instruction to the function body to tell the register
* allocator that certain registers are live at procedure exit.
*)
val procEntryExit2 : frame * Assem.instr list -> Assem.instr list
val procEntryExit3 : frame * Assem.instr list -> {prolog: string,
body: Assem.instr list,
epilog: string}
(* Returns a string containing the assembly-language instructions required to
* define a string literal.
*)
val string : Temp.label * string -> string
end