-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathBlock.h
39 lines (37 loc) · 944 Bytes
/
Block.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
#pragma once
#include<vector>
#include<set>
#include"MidCode.h"
#include"DagMap.h"
#include"DeadCodeEliminator.h"
#include"BlockOptimization.h"
#include"PeepHoleOptimization.h"
using namespace std;
class Block {
public:
static int count;
int id;//每个block有唯一确定的id
int functionId;//所属函数id
vector<Block*>prev;
vector<Block*>next;
set<int>def;
set<int>use;
set<int>activeIn;
set<int>activeOut;
vector<MidCode>v;
Block(int _functionId);
void insert(MidCode c);
void addPrev(Block* b);
void addNext(Block* b);
void useDefScan();
bool activeVariableAnalyzeEpoch();
vector<vector<int>>conflictEdgeAnalyze();
friend ostream& operator<<(ostream& out, Block b);
static set<int> setUnion(set<int> a, set<int> b);
static set<int> setDifference(set<int> a, set<int> b);
void DAGoptimize();
void eliminateDeadCode();
void blockOptimize();
void activeVariableAnalyzePerLine();
void peepholeOptimize();
};