-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcfg_type.h
62 lines (39 loc) · 1.39 KB
/
cfg_type.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
#ifndef _H_CFG_TYPE
#define _H_CFG_TYPE
#include <map>
#include <vector>
#include <list>
class Instruction;
typedef std::vector<Instruction*> edge_type;
// this class is a wrapper that represents the cfg. There is a mapping
// for every (Stmt) node to all the nodes that can follow (or precede)
// in the control flow graph.
class cfg_type {
private:
static edge_type empty_edges;
//std::map<Instruction*,edge_type> _in_edges;
//std::map<Instruction*,edge_type> _out_edges;
Instruction* _first_instruction;
Instruction* _last_instruction;
protected:
std::list<Instruction*>* _instructions;
public:
std::map<int, std::list<Instruction*> > basic_block;
std::map<int, std::list<int> > in_edges;
std::map<int, std::list<int> > out_edges;
//cfg_type(std::list<Instruction*>* code);
cfg_type();
void first_instruction(Instruction* first);
Instruction* first_instruction();
void last_instruction(Instruction* last);
Instruction* last_instruction();
void reverse_cfg();
//edge_type& in_edges(Instruction* stmt);
//edge_type& out_edges(Instruction* stmt);
//void add_in_edge(Instruction* from, Instruction* to);
//void add_out_edge(Instruction* from, Instruction* to);
void add_basic_block(int id, std::list<Instruction*> graph);
void add_in_edge(int id, std::list<int> i_edges);
void add_out_edge(int id, std::list<int> o_edges);
};
#endif