-
Notifications
You must be signed in to change notification settings - Fork 2
/
MidCodeFramework.h
38 lines (34 loc) · 1.1 KB
/
MidCodeFramework.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
#pragma once
#include"MidCodeContainer.h"
#include"FlowGraph.h"
#include"MipsTranslator.h"
using namespace std;
struct ReturnBundle;
class MidCodeFramework {
public :
MidCodeFramework(MipsTranslator& _mips);
~MidCodeFramework();
vector<MidCodeContainer>functionContainer;
MidCodeContainer container;
void functionStart(string name);
void functionEnd();
int midCodeInsert(MidCodeOp op, int target,
int operand1, bool isImmediate1,
int operand2, bool isImmediate2,
int label);
void midCodeInsert(vector<MidCode>& tmp);
int getIndex();//返回新的一条指令将会被填入的位置的下标
vector<MidCode>::iterator getIterator(int index);//返回指定位置的迭代器
void erase(int start, int end);//擦除从start-end的指令
friend ostream& operator<<(ostream&out, MidCodeFramework& frame);
void optimize();
void generateMips();
void removeNops();
void dumpNewMidCode(ostream& out);
vector<MidCode> inlinedSimpleFunction(string functionName
, vector<ReturnBundle>parameters, int returnVar);
private:
vector<FlowGraph>graph;
MipsTranslator& mips;
map<int,vector<int>>report;
};