-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathframe.h
83 lines (66 loc) · 1.86 KB
/
frame.h
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*Lab5: This header file is not complete. Please finish it with more
* definition.*/
#ifndef FRAME_H
#define FRAME_H
#include "assem.h"
#include "tree.h"
typedef struct F_frame_* F_frame;
typedef struct F_access_* F_access;
Temp_map F_tempMap;
void F_initRegs();
/* declaration for fragments */
typedef struct F_frag_* F_frag;
struct F_frag_ {
enum { F_stringFrag, F_procFrag } kind;
union {
struct {
Temp_label label;
string str;
} stringg;
struct {
T_stm body;
F_frame frame;
} proc;
} u;
};
F_frag F_StringFrag(Temp_label label, string str);
F_frag F_ProcFrag(T_stm body, F_frame frame);
T_stm F_procEntryExit1(F_frame frame, T_stm stm);
typedef struct F_accessList_* F_accessList;
struct F_accessList_ {
F_access head;
F_accessList tail;
};
F_frame F_newFrame(Temp_label name, U_boolList formals);
Temp_label F_name(F_frame f);
F_accessList F_formals(F_frame f);
F_access F_allocLocal(F_frame f, bool escape);
typedef struct F_fragList_* F_fragList;
struct F_fragList_ {
F_frag head;
F_fragList tail;
};
F_fragList F_FragList(F_frag head, F_fragList tail);
/* --- IR --- */
Temp_temp F_FP(void);
extern const int F_wordSize;
T_exp F_Exp(F_access acc, T_exp framePtr);
T_exp F_externalCall(string, T_expList);
Temp_temp F_RV();
F_fragList F_getFragList();
// F_frag F_procEntryExit(F_frame frame, T_stm stm);
/* make it work */
Temp_tempList F_registers();
Temp_temp F_SP(void);
Temp_temp F_RA(void);
Temp_temp F_RV(void);
Temp_temp F_DIV(void);
Temp_tempList F_CallerSaves(void);
Temp_tempList F_CalleeSaves(void);
F_frag F_newProcFrag(T_stm body, F_frame frame);
T_stm F_procEntryExit2(AS_instrList body);
AS_proc F_procEntryExit3(F_frame frame, AS_instrList body);
F_frag F_string(Temp_label lab, string lit);
int F_frameOffset(F_access);
bool F_initParamEsc();
#endif