-
Notifications
You must be signed in to change notification settings - Fork 0
/
optimize.h
41 lines (30 loc) · 728 Bytes
/
optimize.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
#ifndef COMPILER_OPTIMIZE_H
#define COMPILER_OPTIMIZE_H
#include "stdafx.h"
#include "midCode.h"
#include "tempVarTable.h"
#include "symbolTable.h"
typedef struct {
int regNumber;
std::string var;
std::string varAddr;
SyntaxType syntaxType;
bool isGlobal;
bool isNew;
}Reg;
class Optimize {
public:
Optimize(TempVarTable *tempVarTable);
~Optimize();
void initReg();
Reg getReg();
void updateReg(const Reg ®);
void updateReg(int regNumber);
std::vector<Reg>& getRegUse();
private:
TempVarTable *tempVarTable;
std::vector<Reg> regs;
std::vector<Reg> regUse;
int regNum = 23;
};
#endif //COMPILER_OPTIMIZE_H