top | up | prev | next

ControlFlowAnalyzer Class

Definition at line 19 of ControlFlowAnalyzer.cpp

Constructors

ControlFlowAnalyzer()

Member Functions

void CollectLabel(BoundStatement& statement)
void ResolveGoto(BoundGotoStatement& boundGotoStatement)
void Visit(BoundAssignmentStatement& boundAssignmentStatement) override
void Visit(BoundBreakStatement& boundBreakStatement) override
void Visit(BoundCaseStatement& boundCaseStatement) override
void Visit(BoundCatchStatement& boundCatchStatement) override
void Visit(BoundClass& boundClass) override
void Visit(BoundCompileUnit& boundCompileUnit) override
void Visit(BoundCompoundStatement& boundCompoundStatement) override
void Visit(BoundConstructionStatement& boundConstructionStatement) override
void Visit(BoundContinueStatement& boundContinueStatement) override
void Visit(BoundDefaultStatement& boundDefaultStatement) override
void Visit(BoundDoStatement& boundDoStatement) override
void Visit(BoundEmptyStatement& boundEmptyStatement) override
void Visit(BoundExpressionStatement& boundExpressionStatement) override
void Visit(BoundForStatement& boundForStatement) override
void Visit(BoundFunction& boundFunction) override
void Visit(BoundGotoCaseStatement& boundGotoCaseStatement) override
void Visit(BoundGotoDefaultStatement& boundGotoDefaultStatement) override
void Visit(BoundGotoStatement& boundGotoStatement) override
void Visit(BoundIfStatement& boundIfStatement) override
void Visit(BoundInitializationStatement& boundInitializationStatement) override
void Visit(BoundRethrowStatement& boundRethrowStatement) override
void Visit(BoundReturnStatement& boundReturnStatement) override
void Visit(BoundSequenceStatement& boundSequenceStatement) override
void Visit(BoundSetVmtPtrStatement& boundSetVmtPtrStatement) override
void Visit(BoundSwitchStatement& boundSwitchStatement) override
void Visit(BoundThrowStatement& boundThrowStatement) override
void Visit(BoundTryStatement& boundTryStatement) override
void Visit(BoundWhileStatement& boundWhileStatement) override

Member Variables

bool collectLabels
BoundFunction* currentFunction
std::unordered_map<std::u32string, BoundStatement*> labelStatementMap
Module* module
bool resolveGotos

Constructor Details

ControlFlowAnalyzer Constructor

cmajor::binder::ControlFlowAnalyzer::ControlFlowAnalyzer()

Definition at line 61 of ControlFlowAnalyzer.cpp :
 61 : module(nullptr)currentFunction(nullptr)collectLabels(false)resolveGotos(false)
 62 {
 63 }


Declaration at line 22 of ControlFlowAnalyzer.cpp


Member Function Details

CollectLabel Member Function

void cmajor::binder::ControlFlowAnalyzer::CollectLabel(BoundStatement & statement)

Definition at line 65 of ControlFlowAnalyzer.cpp
Declaration at line 57 of ControlFlowAnalyzer.cpp

Calls: cmajor::binder::BoundFunction::AddLabeledStatement , cmajor::binder::BoundNode::GetSpan , cmajor::binder::BoundNode::ModuleId , cmajor::binder::BoundStatement::Label

Called by: cmajor::binder::ControlFlowAnalyzer::Visit , cmajor::binder::ControlFlowAnalyzer::Visit , cmajor::binder::ControlFlowAnalyzer::Visit , cmajor::binder::ControlFlowAnalyzer::Visit , cmajor::binder::ControlFlowAnalyzer::Visit , cmajor::binder::ControlFlowAnalyzer::Visit , cmajor::binder::ControlFlowAnalyzer::Visit , cmajor::binder::ControlFlowAnalyzer::Visit , cmajor::binder::ControlFlowAnalyzer::Visit , cmajor::binder::ControlFlowAnalyzer::Visit , cmajor::binder::ControlFlowAnalyzer::Visit , cmajor::binder::ControlFlowAnalyzer::Visit , cmajor::binder::ControlFlowAnalyzer::Visit , cmajor::binder::ControlFlowAnalyzer::Visit , cmajor::binder::ControlFlowAnalyzer::Visit , cmajor::binder::ControlFlowAnalyzer::Visit , cmajor::binder::ControlFlowAnalyzer::Visit , cmajor::binder::ControlFlowAnalyzer::Visit , cmajor::binder::ControlFlowAnalyzer::Visit , cmajor::binder::ControlFlowAnalyzer::Visit , cmajor::binder::ControlFlowAnalyzer::Visit , cmajor::binder::ControlFlowAnalyzer::Visit , cmajor::binder::ControlFlowAnalyzer::Visit , cmajor::binder::ControlFlowAnalyzer::Visit , cmajor::binder::ControlFlowAnalyzer::Visit


ResolveGoto Member Function

void cmajor::binder::ControlFlowAnalyzer::ResolveGoto(BoundGotoStatement & boundGotoStatement)

Definition at line 82 of ControlFlowAnalyzer.cpp
Declaration at line 58 of ControlFlowAnalyzer.cpp

Calls: cmajor::binder::BoundGotoStatement::SetTargetBlock , cmajor::binder::BoundGotoStatement::SetTargetStatement , cmajor::binder::BoundGotoStatement::Target , cmajor::binder::BoundNode::GetSpan , cmajor::binder::BoundNode::ModuleId , cmajor::binder::BoundStatement::Block , cmajor::binder::BoundStatement::Parent

Called by: cmajor::binder::ControlFlowAnalyzer::Visit


Visit Member Function

void cmajor::binder::ControlFlowAnalyzer::Visit(BoundAssignmentStatement & boundAssignmentStatement) override

Definition at line 323 of ControlFlowAnalyzer.cpp :
324 {
325     if (collectLabels)
326     {
327         CollectLabel(boundAssignmentStatement);
328     }
329 }


Declaration at line 42 of ControlFlowAnalyzer.cpp

Base class overridden functions: cmajor::binder::BoundNodeVisitor::Visit

Calls: cmajor::binder::ControlFlowAnalyzer::CollectLabel


Visit Member Function

void cmajor::binder::ControlFlowAnalyzer::Visit(BoundBreakStatement & boundBreakStatement) override

Definition at line 287 of ControlFlowAnalyzer.cpp :
288 {
289     if (collectLabels)
290     {
291         CollectLabel(boundBreakStatement);
292     }
293 }


Declaration at line 38 of ControlFlowAnalyzer.cpp

Base class overridden functions: cmajor::binder::BoundNodeVisitor::Visit

Calls: cmajor::binder::ControlFlowAnalyzer::CollectLabel


Visit Member Function

void cmajor::binder::ControlFlowAnalyzer::Visit(BoundCaseStatement & boundCaseStatement) override

Definition at line 247 of ControlFlowAnalyzer.cpp :
248 {
249     if (collectLabels)
250     {
251         CollectLabel(boundCaseStatement);
252     }
253     if (boundCaseStatement.CompoundStatement())
254     {
255         boundCaseStatement.CompoundStatement()->Accept(*this);
256     }
257 }


Declaration at line 34 of ControlFlowAnalyzer.cpp

Base class overridden functions: cmajor::binder::BoundNodeVisitor::Visit

Calls: cmajor::binder::BoundCaseStatement::CompoundStatement , cmajor::binder::BoundCompoundStatement::Accept , cmajor::binder::ControlFlowAnalyzer::CollectLabel


Visit Member Function

void cmajor::binder::ControlFlowAnalyzer::Visit(BoundCatchStatement & boundCatchStatement) override

Definition at line 388 of ControlFlowAnalyzer.cpp :
389 {
390     if (collectLabels)
391     {
392         CollectLabel(boundCatchStatement);
393     }
394     boundCatchStatement.CatchBlock()->Accept(*this);
395 }


Declaration at line 50 of ControlFlowAnalyzer.cpp

Base class overridden functions: cmajor::binder::BoundNodeVisitor::Visit

Calls: cmajor::binder::BoundCatchStatement::CatchBlock , cmajor::binder::BoundNode::Accept , cmajor::binder::ControlFlowAnalyzer::CollectLabel


Visit Member Function

void cmajor::binder::ControlFlowAnalyzer::Visit(BoundClass & boundClass) override

Definition at line 128 of ControlFlowAnalyzer.cpp :
129 {
130     int n = boundClass.Members().size();
131     for (int i = 0; i < n; ++i)
132     {
133         BoundNode* boundNode = boundClass.Members()[i].get();
134         boundNode->Accept(*this);
135     }
136 }


Declaration at line 24 of ControlFlowAnalyzer.cpp

Base class overridden functions: cmajor::binder::BoundNodeVisitor::Visit

Calls: cmajor::binder::BoundClass::Members , cmajor::binder::BoundNode::Accept


Visit Member Function

void cmajor::binder::ControlFlowAnalyzer::Visit(BoundCompileUnit & boundCompileUnit) override

Definition at line 117 of ControlFlowAnalyzer.cpp :
118 {
119     module = &boundCompileUnit.GetModule();
120     int n = boundCompileUnit.BoundNodes().size();
121     for (int i = 0; i < n; ++i)
122     {
123         BoundNode* boundNode = boundCompileUnit.BoundNodes()[i].get();
124         boundNode->Accept(*this);
125     }
126 }


Declaration at line 23 of ControlFlowAnalyzer.cpp

Base class overridden functions: cmajor::binder::BoundNodeVisitor::Visit

Calls: cmajor::binder::BoundCompileUnit::BoundNodes , cmajor::binder::BoundCompileUnit::GetModule , cmajor::binder::BoundNode::Accept


Visit Member Function

void cmajor::binder::ControlFlowAnalyzer::Visit(BoundCompoundStatement & boundCompoundStatement) override

Definition at line 164 of ControlFlowAnalyzer.cpp
Declaration at line 27 of ControlFlowAnalyzer.cpp

Base class overridden functions: cmajor::binder::BoundNodeVisitor::Visit

Calls: cmajor::binder::BoundCompoundStatement::Statements , cmajor::binder::BoundNode::Accept , cmajor::binder::ControlFlowAnalyzer::CollectLabel


Visit Member Function

void cmajor::binder::ControlFlowAnalyzer::Visit(BoundConstructionStatement & boundConstructionStatement) override

Definition at line 315 of ControlFlowAnalyzer.cpp :
316 {
317     if (collectLabels)
318     {
319         CollectLabel(boundConstructionStatement);
320     }
321 }


Declaration at line 41 of ControlFlowAnalyzer.cpp

Base class overridden functions: cmajor::binder::BoundNodeVisitor::Visit

Calls: cmajor::binder::ControlFlowAnalyzer::CollectLabel


Visit Member Function

void cmajor::binder::ControlFlowAnalyzer::Visit(BoundContinueStatement & boundContinueStatement) override

Definition at line 295 of ControlFlowAnalyzer.cpp :
296 {
297     if (collectLabels)
298     {
299         CollectLabel(boundContinueStatement);
300     }
301 }


Declaration at line 39 of ControlFlowAnalyzer.cpp

Base class overridden functions: cmajor::binder::BoundNodeVisitor::Visit

Calls: cmajor::binder::ControlFlowAnalyzer::CollectLabel


Visit Member Function

void cmajor::binder::ControlFlowAnalyzer::Visit(BoundDefaultStatement & boundDefaultStatement) override

Definition at line 259 of ControlFlowAnalyzer.cpp :
260 {
261     if (collectLabels)
262     {
263         CollectLabel(boundDefaultStatement);
264     }
265     if (boundDefaultStatement.CompoundStatement())
266     {
267         boundDefaultStatement.CompoundStatement()->Accept(*this);
268     }
269 }


Declaration at line 35 of ControlFlowAnalyzer.cpp

Base class overridden functions: cmajor::binder::BoundNodeVisitor::Visit

Calls: cmajor::binder::BoundCompoundStatement::Accept , cmajor::binder::BoundDefaultStatement::CompoundStatement , cmajor::binder::ControlFlowAnalyzer::CollectLabel


Visit Member Function

void cmajor::binder::ControlFlowAnalyzer::Visit(BoundDoStatement & boundDoStatement) override

Definition at line 208 of ControlFlowAnalyzer.cpp :
209 {
210     if (collectLabels)
211     {
212         CollectLabel(boundDoStatement);
213     }
214     boundDoStatement.Statement()->Accept(*this);
216 }


Declaration at line 31 of ControlFlowAnalyzer.cpp

Base class overridden functions: cmajor::binder::BoundNodeVisitor::Visit

Calls: cmajor::binder::BoundDoStatement::Statement , cmajor::binder::BoundNode::Accept , cmajor::binder::ControlFlowAnalyzer::CollectLabel


Visit Member Function

void cmajor::binder::ControlFlowAnalyzer::Visit(BoundEmptyStatement & boundEmptyStatement) override

Definition at line 347 of ControlFlowAnalyzer.cpp :
348 {
349     if (collectLabels)
350     {
351         CollectLabel(boundEmptyStatement);
352     }
353 }


Declaration at line 45 of ControlFlowAnalyzer.cpp

Base class overridden functions: cmajor::binder::BoundNodeVisitor::Visit

Calls: cmajor::binder::ControlFlowAnalyzer::CollectLabel


Visit Member Function

void cmajor::binder::ControlFlowAnalyzer::Visit(BoundExpressionStatement & boundExpressionStatement) override

Definition at line 331 of ControlFlowAnalyzer.cpp :
332 {
333     if (collectLabels)
334     {
335         CollectLabel(boundExpressionStatement);
336     }
337 }


Declaration at line 43 of ControlFlowAnalyzer.cpp

Base class overridden functions: cmajor::binder::BoundNodeVisitor::Visit

Calls: cmajor::binder::ControlFlowAnalyzer::CollectLabel


Visit Member Function

void cmajor::binder::ControlFlowAnalyzer::Visit(BoundForStatement & boundForStatement) override

Definition at line 218 of ControlFlowAnalyzer.cpp :
219 {
220     if (collectLabels)
221     {
222         CollectLabel(boundForStatement);
223     }
224     boundForStatement.InitS()->Accept(*this);
225     boundForStatement.LoopS()->Accept(*this);
226     boundForStatement.ActionS()->Accept(*this);
227 }


Declaration at line 32 of ControlFlowAnalyzer.cpp

Base class overridden functions: cmajor::binder::BoundNodeVisitor::Visit

Calls: cmajor::binder::BoundForStatement::ActionS , cmajor::binder::BoundForStatement::InitS , cmajor::binder::BoundForStatement::LoopS , cmajor::binder::BoundNode::Accept , cmajor::binder::ControlFlowAnalyzer::CollectLabel


Visit Member Function

void cmajor::binder::ControlFlowAnalyzer::Visit(BoundFunction & boundFunction) override

Definition at line 138 of ControlFlowAnalyzer.cpp
Declaration at line 25 of ControlFlowAnalyzer.cpp

Base class overridden functions: cmajor::binder::BoundNodeVisitor::Visit

Calls: cmajor::binder::BoundCompoundStatement::Accept , cmajor::binder::BoundFunction::Body , cmajor::binder::BoundFunction::HasGotos


Visit Member Function

void cmajor::binder::ControlFlowAnalyzer::Visit(BoundGotoCaseStatement & boundGotoCaseStatement) override

Definition at line 271 of ControlFlowAnalyzer.cpp :
272 {
273     if (collectLabels)
274     {
275         CollectLabel(boundGotoCaseStatement);
276     }
277 }


Declaration at line 36 of ControlFlowAnalyzer.cpp

Base class overridden functions: cmajor::binder::BoundNodeVisitor::Visit

Calls: cmajor::binder::ControlFlowAnalyzer::CollectLabel


Visit Member Function

void cmajor::binder::ControlFlowAnalyzer::Visit(BoundGotoDefaultStatement & boundGotoDefaultStatement) override

Definition at line 279 of ControlFlowAnalyzer.cpp :
280 {
281     if (collectLabels)
282     {
283         CollectLabel(boundGotoDefaultStatement);
284     }
285 }


Declaration at line 37 of ControlFlowAnalyzer.cpp

Base class overridden functions: cmajor::binder::BoundNodeVisitor::Visit

Calls: cmajor::binder::ControlFlowAnalyzer::CollectLabel


Visit Member Function

void cmajor::binder::ControlFlowAnalyzer::Visit(BoundGotoStatement & boundGotoStatement) override

Definition at line 303 of ControlFlowAnalyzer.cpp :
304 {
305     if (collectLabels)
306     {
307         CollectLabel(boundGotoStatement);
308     }
309     if (resolveGotos)
310     {
311         ResolveGoto(boundGotoStatement);
312     }
313 }


Declaration at line 40 of ControlFlowAnalyzer.cpp

Base class overridden functions: cmajor::binder::BoundNodeVisitor::Visit

Calls: cmajor::binder::ControlFlowAnalyzer::CollectLabel , cmajor::binder::ControlFlowAnalyzer::ResolveGoto


Visit Member Function

void cmajor::binder::ControlFlowAnalyzer::Visit(BoundIfStatement & boundIfStatement) override

Definition at line 186 of ControlFlowAnalyzer.cpp
Declaration at line 29 of ControlFlowAnalyzer.cpp

Base class overridden functions: cmajor::binder::BoundNodeVisitor::Visit

Calls: cmajor::binder::BoundIfStatement::ElseS , cmajor::binder::BoundIfStatement::ThenS , cmajor::binder::BoundNode::Accept , cmajor::binder::ControlFlowAnalyzer::CollectLabel


Visit Member Function

void cmajor::binder::ControlFlowAnalyzer::Visit(BoundInitializationStatement & boundInitializationStatement) override

Definition at line 339 of ControlFlowAnalyzer.cpp :
340 {
341     if (collectLabels)
342     {
343         CollectLabel(boundInitializationStatement);
344     }
345 }


Declaration at line 44 of ControlFlowAnalyzer.cpp

Base class overridden functions: cmajor::binder::BoundNodeVisitor::Visit

Calls: cmajor::binder::ControlFlowAnalyzer::CollectLabel


Visit Member Function

void cmajor::binder::ControlFlowAnalyzer::Visit(BoundRethrowStatement & boundRethrowStatement) override

Definition at line 371 of ControlFlowAnalyzer.cpp :
372 {
373     if (collectLabels)
374     {
375         CollectLabel(boundRethrowStatement);
376     }
377 }


Declaration at line 48 of ControlFlowAnalyzer.cpp

Base class overridden functions: cmajor::binder::BoundNodeVisitor::Visit

Calls: cmajor::binder::ControlFlowAnalyzer::CollectLabel


Visit Member Function

void cmajor::binder::ControlFlowAnalyzer::Visit(BoundReturnStatement & boundReturnStatement) override

Definition at line 178 of ControlFlowAnalyzer.cpp :
179 {
180     if (collectLabels)
181     {
182         CollectLabel(boundReturnStatement);
183     }
184 }


Declaration at line 28 of ControlFlowAnalyzer.cpp

Base class overridden functions: cmajor::binder::BoundNodeVisitor::Visit

Calls: cmajor::binder::ControlFlowAnalyzer::CollectLabel


Visit Member Function

void cmajor::binder::ControlFlowAnalyzer::Visit(BoundSequenceStatement & boundSequenceStatement) override

Definition at line 154 of ControlFlowAnalyzer.cpp :
155 {
156     if (collectLabels)
157     {
158         CollectLabel(boundSequenceStatement);
159     }
160     boundSequenceStatement.First()->Accept(*this);
161     boundSequenceStatement.Second()->Accept(*this);
162 }


Declaration at line 26 of ControlFlowAnalyzer.cpp

Base class overridden functions: cmajor::binder::BoundNodeVisitor::Visit

Calls: cmajor::binder::BoundNode::Accept , cmajor::binder::BoundSequenceStatement::First , cmajor::binder::BoundSequenceStatement::Second , cmajor::binder::ControlFlowAnalyzer::CollectLabel


Visit Member Function

void cmajor::binder::ControlFlowAnalyzer::Visit(BoundSetVmtPtrStatement & boundSetVmtPtrStatement) override

Definition at line 355 of ControlFlowAnalyzer.cpp :
356 {
357     if (collectLabels)
358     {
359         CollectLabel(boundSetVmtPtrStatement);
360     }
361 }


Declaration at line 46 of ControlFlowAnalyzer.cpp

Base class overridden functions: cmajor::binder::BoundNodeVisitor::Visit

Calls: cmajor::binder::ControlFlowAnalyzer::CollectLabel


Visit Member Function

void cmajor::binder::ControlFlowAnalyzer::Visit(BoundSwitchStatement & boundSwitchStatement) override

Definition at line 229 of ControlFlowAnalyzer.cpp
Declaration at line 33 of ControlFlowAnalyzer.cpp

Base class overridden functions: cmajor::binder::BoundNodeVisitor::Visit

Calls: cmajor::binder::BoundCaseStatement::Accept , cmajor::binder::BoundDefaultStatement::Accept , cmajor::binder::BoundSwitchStatement::CaseStatements , cmajor::binder::BoundSwitchStatement::DefaultStatement , cmajor::binder::ControlFlowAnalyzer::CollectLabel


Visit Member Function

void cmajor::binder::ControlFlowAnalyzer::Visit(BoundThrowStatement & boundThrowStatement) override

Definition at line 363 of ControlFlowAnalyzer.cpp :
364 {
365     if (collectLabels)
366     {
367         CollectLabel(boundThrowStatement);
368     }
369 }


Declaration at line 47 of ControlFlowAnalyzer.cpp

Base class overridden functions: cmajor::binder::BoundNodeVisitor::Visit

Calls: cmajor::binder::ControlFlowAnalyzer::CollectLabel


Visit Member Function

void cmajor::binder::ControlFlowAnalyzer::Visit(BoundTryStatement & boundTryStatement) override

Definition at line 379 of ControlFlowAnalyzer.cpp :
380 {
381     if (collectLabels)
382     {
383         CollectLabel(boundTryStatement);
384     }
385     boundTryStatement.TryBlock()->Accept(*this);
386 }


Declaration at line 49 of ControlFlowAnalyzer.cpp

Base class overridden functions: cmajor::binder::BoundNodeVisitor::Visit

Calls: cmajor::binder::BoundNode::Accept , cmajor::binder::BoundTryStatement::TryBlock , cmajor::binder::ControlFlowAnalyzer::CollectLabel


Visit Member Function

void cmajor::binder::ControlFlowAnalyzer::Visit(BoundWhileStatement & boundWhileStatement) override

Definition at line 199 of ControlFlowAnalyzer.cpp :
200 {
201     if (collectLabels)
202     {
203         CollectLabel(boundWhileStatement);
204     }
205     boundWhileStatement.Statement()->Accept(*this);
206 }


Declaration at line 30 of ControlFlowAnalyzer.cpp

Base class overridden functions: cmajor::binder::BoundNodeVisitor::Visit

Calls: cmajor::binder::BoundNode::Accept , cmajor::binder::BoundWhileStatement::Statement , cmajor::binder::ControlFlowAnalyzer::CollectLabel


top | up | prev | next