source: icGREP/icgrep-devel/icgrep/pablo/ps_if.cpp @ 4415

Last change on this file since 4415 was 4415, checked in by nmedfort, 4 years ago

More work on usedef info.

File size: 702 bytes
Line 
1#include <pablo/ps_if.h>
2#include <pablo/codegenstate.h>
3
4namespace pablo {
5
6If::If(PabloAST * expr, DefinedVars && definedVars, PabloBlock & body, PabloBlock * parent)
7: Statement(ClassTypeId::If, {expr}, nullptr, parent)
8, mBody(body)
9, mDefined(definedVars.begin(), definedVars.end())
10, mCarryCount(0)
11, mAdvanceCount(0)
12{
13    // Conceptually, having a defined var X is identical to having:
14    //
15    // Assign(X, 0)
16    // If (...)
17    //    Next(Assign(X), ...)
18    //
19    // Since the implied 'Next' node is a user of the Assign node, and the Assign node is
20    // embedded into the If, the defined var is a user of the If node.
21
22    for (Assign * x : mDefined) {
23        addUser(x);
24    }
25}
26
27}
Note: See TracBrowser for help on using the repository browser.