-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathem.h
121 lines (106 loc) · 2.47 KB
/
em.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#ifndef __EM_H
#define __EM_H
#include "sm.h"
#include "lm.h"
/* Helper classes */
class EParam
{
public:
Variable * variable;
std::string val;
EParam() {};
std::string getStr();
};
struct EEqual
{
bool operator()(const EParam * p1, const EParam * p2) const
{
if(!p1->variable || !p2->variable)
{
return false;
}
return (p1->variable->properties["name"] < p2->variable->properties["name"]);
}
};
/* Execution Nodes */
class ENode
{
public:
ENode() {};
virtual void dumpStmts(int tab, std::stringstream & ss);
};
class EPipeAndFilter;
class ESemanticModel : public ENode
{
public:
EPipeAndFilter * body;
/*virtual*/ void dumpStmts(int tab, std::stringstream & ss);
};
class EFunctionDef : public ENode
{
public:
EPipeAndFilter * body;
/*virtual*/ void dumpStmts(int tab, std::stringstream & ss);
};
class EIterator : public ENode
{
public:
int ub;
EPipeAndFilter * body;
/*virtual*/ void dumpStmts(int tab, std::stringstream & ss);
};
class EPipeAndFilter : public ENode
{
public:
std::vector<ENode *> stmts;
/*virtual*/ void dumpStmts(int tab, std::stringstream & ss);
};
class EWhile : public ENode
{
public:
EParam * test;
EPipeAndFilter * body;
/*virtual*/ void dumpStmts(int tab, std::stringstream & ss);
};
static int estmt_count = 0;
class EStmt : public ENode
{
public:
int id;
std::string label;
std::vector<EParam *> sources;
std::vector<EParam *> sinks;
std::string element_string;
PlatformLevel * p;
EStmt() {id = estmt_count++; p = NULL;};
EStmt(std::string label) : label(label) {id = estmt_count++; p=NULL;};
EStmt(std::string label, Level * level, LaunchPartition partition);
/*virtual*/ void dumpStmts(int tab, std::stringstream & ss);
void addSource(Operand* sourceOperand);
void addSink(Operand * sinkOperand);
std::string getStr();
};
class EReturn : public EStmt
{
public:
EParam * retparam;
/*virtual*/ void dumpStmts(int tab, std::stringstream & ss);
};
class EBasicBlock;
class EBasicBlock : public ENode
{
public:
std::vector<EStmt*> stmts;
std::set<EBasicBlock*> preds;
std::set<EBasicBlock*> succs;
int id;
PlatformLevel * p;
std::vector<cl_event> events;
EBasicBlock(int id);
void addStmt(EStmt * s);
void addSuccessor(EBasicBlock *BB);
size_t numStmts();
void dumpGraph(std::string &s);
/*virtual*/ void dumpStmts(int tab, std::stringstream & ss);
};
#endif