-
Notifications
You must be signed in to change notification settings - Fork 0
/
abstract.cc
executable file
·123 lines (104 loc) · 3.76 KB
/
abstract.cc
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
122
/*--------------------------------------------------------------------------- *
* srtl implementation in c++ *
* *
* This file contains class header definitions abstract pattern class and *
* supporting class. *
* *
* *
* Change History *
* -------------------------------------------------------------------------- *
* Name Date Change Description *
* Sheweta 14-Aug-13 Initial Version *
* *
*--------------------------------------------------------------------------- */
#include "abstract.hh"
#include "node.hh"
#include "srtl-driver.hh"
std::string AbstPattern::getPatName ()
{
return pname;
}
void AbstPattern::setPatName (std::string V)
{
pname=V;
}
void AbstPattern::addStmt(ModeStmt s)
{
sList.push_back(s);
}
void AbstPattern::setSList (std::vector<ModeStmt>* s)
{
sList= * s;
}
void AbstPattern::setExtName (std::string V)
{
extname=V;
}
std::string AbstPattern::getExtName ()
{
return extname;
}
void AbstPattern:: setError()
{
error = true;
}
bool AbstPattern::inError()
{
return error;
}
void AbstPattern::setPatType(Type t){
type = t;
}
void AbstPattern::setParentPattern(Pattern* p){
AbstPattern* ab = static_cast <AbstPattern*> (p);
std::vector<ModeStmt>* msv = ab->getStmts ();
sList.insert (sList.begin (), msv->begin(), msv->end ());
}
Pattern* AbstPattern::getParentPattern () {
return NULL;
}
void AbstPattern::createPattern(){
//cerr<<"ABSTRACT"<<endl;
std::vector<ModeStmt>* ms = this->getStmts ();
if (type != regCons) {
for (unsigned int i = 0; i < ms->size (); i++) {
if(ms->at (i).getType () == ModeStmt::root) {
if (i == 0) {
int children = srtl_driver::findRtlOperandSymTabEntry (
ms->at (i).getPatternName ());
if (children < 0) {
srtl_driver::debugS (srtl_driver::err,
"For Abst Pattern: " + this->getPatName ());
srtl_driver::debugS (srtl_driver::err,
"Invalid RTL Operand: " +
ms->at (i).getPatternName ());
return;
}
tree = new Node (ms->at (i).getPatternName (), false);
} else {
Node* iNode = new Node (ms->at (i).
getPatternName (), false);
int children = srtl_driver::findRtlOperandSymTabEntry (
ms->at (i).getPatternName ());
if (children < 0) {
srtl_driver::debugS (srtl_driver::err,
"For Abst Pattern: " + this->getPatName ());
srtl_driver::debugS (srtl_driver::err,
"Invalid RTL Operand: " +
ms->at (i).getPatternName ());
delete iNode;
delete tree;
return;
}
tree->replaceNode (iNode, ms->at (i).getAccessTree ());
}
}
}
this->resolved = true;
}
}
AbstPattern::~AbstPattern () {
}
AbstPattern::AbstPattern () {
initialized=false;
}