-
Notifications
You must be signed in to change notification settings - Fork 0
/
assem.h
69 lines (56 loc) · 1.72 KB
/
assem.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
/*
* assem.h - Function prototypes to translate to Assem-instructions
* using Maximal Munch.
*/
#ifndef ASSEM_H
#define ASSEM_H
#include "temp.h"
typedef struct {
Temp_labelList labels;
} * AS_targets;
AS_targets AS_Targets(Temp_labelList labels);
typedef struct AS_instr_ *AS_instr;
struct AS_instr_ {
enum { I_OPER, I_LABEL, I_MOVE } kind;
union {
struct {
string assem;
Temp_tempList dst, src;
AS_targets jumps;
} OPER;
struct {
string assem;
Temp_label label;
} LABEL;
struct {
string assem;
Temp_tempList dst, src;
} MOVE;
} u;
};
AS_instr AS_Oper(string a, Temp_tempList d, Temp_tempList s, AS_targets j);
AS_instr AS_Label(string a, Temp_label label);
AS_instr AS_Move(string a, Temp_tempList d, Temp_tempList s);
void AS_print(FILE *out, AS_instr i, Temp_map m);
typedef struct AS_instrList_ *AS_instrList;
struct AS_instrList_ {
AS_instr head;
AS_instrList tail;
};
AS_instrList AS_InstrList(AS_instr head, AS_instrList tail);
AS_instrList AS_splice(AS_instrList a, AS_instrList b);
void AS_printInstrList(FILE *out, AS_instrList iList, Temp_map m);
typedef struct AS_proc_ *AS_proc;
struct AS_proc_ {
string prolog;
AS_instrList body;
string epilog;
};
AS_proc AS_Proc(string p, AS_instrList b, string e);
// TA's implementation. Just for reference.
AS_instrList AS_rewrite(AS_instrList iList, Temp_map m);
typedef struct F_frame_ *F_frame;
AS_instrList AS_rewriteSpill(F_frame f, AS_instrList il, Temp_tempList spills);
void AS_print2(FILE *, AS_instr);
void printCfgInfo(void *p);
#endif