-
Notifications
You must be signed in to change notification settings - Fork 0
/
dfg.h
36 lines (34 loc) · 1.01 KB
/
dfg.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
#pragma once
#include "intercode.h"
#include "common.h"
class Block
{
~Block();
public:
Block(vector<Quaternion* > code, int id);
void printCode();
list<Quaternion* > blockCode; //基本块中间代码序列
list<Block* > preBlock; //块的前驱
list<Block* > nextBlock; //块的后继
vector<double > inVals; //in值集合
vector<double > outVals; //out值集合
bool visit;
bool isreach;
int id; //基本块的编号
};
class DFG
{
~DFG();
public:
DFG(InterCode& code);
vector<Quaternion* > intercode;
vector<Block* > blocks;
void createBlock(); //创建数据块
void linkBlock(); //链接数据块
void delBlock(Block* begin, Block* end); //删除数据块
void release(Block* block); //递归删除
bool reachable(Block* block); //判断是否可达
bool reach(Block* block);
void getCode(list<Quaternion*> &optcode); //获得优化后的代码
void getBlockInfo(); //打印数据块之间的关系
};