systemc-clang 2.0.0
Parsing SystemC constructs
Loading...
Searching...
No Matches
EntryFunctionContainer.cpp
Go to the documentation of this file.
2#include "NotifyContainer.h"
3
4using namespace systemc_clang;
5
7 // DO NOT free anything.
8}
9
11 : entry_name_("NONE"),
12 process_type_(PROCESS_TYPE::NONE),
13 entry_method_decl_(nullptr) {}
14
16 clang::CXXMethodDecl *d, clang::Stmt *s)
17 : entry_name_(n), process_type_(p), entry_method_decl_(d) {}
18
30
32
34 std::pair<std::string, const clang::Expr *> reset_signal) {
35 reset_signal_ = reset_signal;
36}
37
39 std::pair<std::string, const clang::Expr *> reset_edge) {
40 reset_edge_ = reset_edge;
41}
42
44 reset_type_async_ = reset_type;
45}
46
47
48const std::pair<std::string, const clang::Expr *> EntryFunctionContainer::getResetEdge()
49 const {
50 return reset_edge_;
51}
52
53const std::pair<std::string, const clang::Expr *>
57
59
61
65
67 return entry_method_decl_;
68}
69
74
79
81
85
91
93
94void EntryFunctionContainer::setEntryMethod(clang::CXXMethodDecl *d) {
96}
97
101
104 for (FindWait::waitListType::iterator it = wcalls.begin(), eit = wcalls.end();
105 it != eit; it++) {
106 // 'it' points to CXXMembercallExpr type.
107 WaitContainer *wc{
108 new WaitContainer(f.getEntryMethod(), (*it)->getASTNode())};
109 _waitCalls.push_back(wc);
110 }
111 //_processWaitEventMap = f.getProcessWaitEventMap();
112}
113
115#ifdef USE_SAUTO
116 _susCFG = s.getSusCFG();
117 _susAuto = s.getSauto();
118
119 /*
120 if (_instanceSusCFGMap.find(numInstance) == _instanceSusCFGMap.end() &&
121 _instanceSautoMap.find(numInstance) == _instanceSautoMap.end()) {
122
123 _instanceSusCFGMap.insert(instanceSusCFGPairType(numInstance,
124 s.getSusCFG())); _instanceSautoMap.insert(instanceSautoPairType(numInstance,
125 s.getSauto()));
126 }
127 */
128#endif
129}
130
133 for (FindNotify::NotifyCallListType::iterator it = ncalls.begin(),
134 eit = ncalls.end();
135 it != eit; it++) {
136 // 'it' points to CXXMembercallExpr type.
138 _notifyCalls.push_back(nc);
139 }
140 //_processWaitEventMap = f.getProcessWaitEventMap();
141}
142
145 os << "\n#############################################";
146#ifdef USE_SAUTO
148
149 for (unsigned int i = 0; i < susCFGVector.size(); i++) {
150 os << "\n Block ID : " << susCFGVector.at(i)->getBlockID();
151 os << "\n Is Wait Block : " << susCFGVector.at(i)->isWaitBlock();
152 if (susCFGVector.at(i)->getParentBlockID()) {
153 os << "\n Parent ID : " << susCFGVector.at(i)->getParentBlockID();
154 SusCFG *parentBlock = susCFGVector.at(i)->getParentSusCFGBlock();
155
156 os << "\n Parent Block ID : " << parentBlock->getBlockID();
157 os << "\n Size of Children : " << parentBlock->getChildBlockList().size();
158 }
159 vector<SusCFG *> predBlocks = susCFGVector.at(i)->getPredBlocks();
160 vector<SusCFG *> succBlocks = susCFGVector.at(i)->getSuccBlocks();
161 os << "\n Predecessor Blocks : ";
162 for (unsigned int j = 0; j < predBlocks.size(); j++) {
163 if (predBlocks.at(j)) {
164 os << predBlocks.at(j)->getBlockID() << " ";
165 }
166 }
167 os << "\n Successor Blocks : ";
168 for (unsigned int j = 0; j < succBlocks.size(); j++) {
169 if (succBlocks.at(j)) {
170 os << succBlocks.at(j)->getBlockID() << " ";
171 }
172 }
173 }
174#endif
175}
176
178#ifdef USE_SAUTO
179 vector<Transition *> transitionVector = _susAuto;
180 os << "\n Size of transitionVector : " << transitionVector.size();
181 for (unsigned int i = 0; i < transitionVector.size(); i++) {
182 Transition *t = transitionVector.at(i);
183 t->dump(os);
184 }
185#endif
186}
187
188void EntryFunctionContainer::dump(llvm::raw_ostream &os = llvm::dbgs()) {
189 os << "\n";
190
191 os << "EntryFunctionContainer '" << getName() << "' processType '";
192 switch (getProcessType()) {
194 os << "SC_THREAD' ";
195 break;
197 os << "SC_METHOD' ";
198 break;
200 os << "SC_CTHREAD' ";
201 break;
202 default:
203 os << "NONE' ";
204 break;
205 }
206
207 // Print the sensitivity map.
208 // for (auto const &sense : _senseMap) {
209 // os << "sensitivity_signal: " << sense.first << ", "
210 // << "edge: " << get<0>(sense.second)
211 // << ", MemeberExpr*: " << get<1>(sense.second) << "\n";
212 // }
213//
214 os << " CXXMethodDecl '" << getEntryMethod() << "\n";
215 int newTabn = 0;
216
217 os << " Wait Calls \n";
218 for (waitContainerListType::iterator it = _waitCalls.begin(),
219 eit = _waitCalls.end();
220 it != eit; it++) {
221 (*it)->dump(os, newTabn);
222 }
223 os << " Notify Calls \n";
224 for (notifyContainerListType::iterator it = _notifyCalls.begin(),
225 eit = _notifyCalls.end();
226 it != eit; it++) {
227 (*it)->dump(os, newTabn);
228 }
229
230 os << "\nReset signals\n";
231 os << "reset_signal " << reset_signal_.first << "\n";
232 os << "reset_edge " << reset_edge_.first << "\n";
233 os << "reset_type_async " << reset_type_async_ << "\n";
234
235 // os << "\n Suspension CFG";
236 // os << "\n ###############";
237 // dumpSusCFG(os);
238 // os << "\n ###############";
239 // os << "\n Suspension Automaton";
240 // os << "\n @@@@@@@@@@@@@@@@";
241 // dumpSauto(os);
242 // os << "\n @@@@@@@@@@@@@@@@";
243}
A container class to hold entry function information.
std::vector< NotifyContainer * > notifyContainerListType
const std::pair< std::string, const clang::Expr * > getResetSignal() const
std::map< std::string, std::vector< SensitivityTupleType > > SenseMapType
std::pair< std::string, const clang::Expr * > reset_signal_
Reset information.
const std::pair< std::string, const clang::Expr * > getResetEdge() const
SuspensionAutomata::transitionVectorType getSusAuto()
std::vector< WaitContainer * > waitContainerListType
typedefs
void addResetEdge(std::pair< std::string, const clang::Expr * > reset_edge)
std::pair< std::string, const clang::Expr * > reset_edge_
void addResetSignal(std::pair< std::string, const clang::Expr * > reset_signal)
SuspensionAutomata::susCFGVectorType getSusCFG()
std::vector< clang::CallExpr * > NotifyCallListType
Definition FindNotify.h:20
clang::CXXMethodDecl * getEntryMethod() const
NotifyCallListType getNotifyCallList() const
vector< WaitContainer * > waitListType
Definition FindWait.h:20
clang::CXXMethodDecl * getEntryMethod() const
Definition FindWait.cpp:66
waitListType getWaitCalls()
Definition FindWait.cpp:64
vector< SusCFG * > getChildBlockList()
vector< Transition * > transitionVectorType