source: icGREP/icgrep-devel/icgrep/pablo/ps_while.cpp @ 4878

Last change on this file since 4878 was 4878, checked in by nmedfort, 3 years ago

More work on n-ary operations.

File size: 1.0 KB
Line 
1#include <pablo/ps_while.h>
2#include <pablo/codegenstate.h>
3
4namespace pablo {
5
6While::While(PabloAST * expr, const std::initializer_list<Next *> nextVars, PabloBlock * body)
7: Statement(ClassTypeId::While, {expr}, nullptr)
8, mBody(body)
9, mVariant(nextVars.begin(), nextVars.end(), reinterpret_cast<NextAllocator &>(mAllocator)) {
10    mBody->setParent(getParent());
11    for (Next * variant : nextVars) {
12        variant->addUser(this);
13        this->addUser(variant);
14    }
15}
16
17While::While(PabloAST * expr, const std::vector<Next *> & nextVars, PabloBlock * body)
18: Statement(ClassTypeId::While, {expr}, nullptr)
19, mBody(body)
20, mVariant(nextVars.begin(), nextVars.end(), reinterpret_cast<NextAllocator &>(mAllocator)) {
21    mBody->setParent(getParent());
22    for (Next * variant : nextVars) {
23        variant->addUser(this);
24        this->addUser(variant);
25    }
26}
27
28PabloBlock * While::setBody(PabloBlock * body) {
29    body->setParent(mBody->getParent());
30    std::swap(mBody, body);
31    body->setParent(nullptr);
32    return body;
33}
34
35}
Note: See TracBrowser for help on using the repository browser.