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

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

More work towards n-ary And/Or/Xor? functions.

File size: 968 bytes
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    for (Next * variant : nextVars) {
11        variant->addUser(this);
12        this->addUser(variant);
13    }
14}
15
16While::While(PabloAST * expr, const std::vector<Next *> & nextVars, PabloBlock * body)
17: Statement(ClassTypeId::While, {expr}, nullptr)
18, mBody(body)
19, mVariant(nextVars.begin(), nextVars.end(), reinterpret_cast<NextAllocator &>(mAllocator)) {
20    for (Next * variant : nextVars) {
21        variant->addUser(this);
22        this->addUser(variant);
23    }
24}
25
26PabloBlock * While::setBody(PabloBlock * body) {
27    body->setParent(mBody->getParent());
28    std::swap(mBody, body);
29    body->setParent(nullptr);
30    return body;
31}
32
33}
Note: See TracBrowser for help on using the repository browser.