Ignore:
Timestamp:
Nov 14, 2015, 5:38:36 PM (4 years ago)
Author:
nmedfort
Message:

Bug fix for Multiplexing. Added ability to set the body of a If/While? node after creation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/pablo/builder.hpp

    r4788 r4870  
    1010public:
    1111
    12     explicit PabloBuilder(PabloBlock & block) : mPb(&block), mParent(nullptr), mExprTable(nullptr) {}
    13 
    14     explicit PabloBuilder(PabloBlock & block, PabloBuilder & parent) : mPb(&block), mParent(&parent), mExprTable(&(parent.mExprTable)) {}
     12    explicit PabloBuilder(PabloBlock * block) : mPb(block), mParent(nullptr), mExprTable(nullptr) {}
     13
     14    explicit PabloBuilder(PabloBlock * block, PabloBuilder & parent) : mPb(block), mParent(&parent), mExprTable(&(parent.mExprTable)) {}
    1515
    1616    PabloBuilder(PabloBuilder && builder) : mPb(builder.mPb), mParent(builder.mParent), mExprTable(std::move(builder.mExprTable)) {}
     
    3131    using const_iterator = PabloBlock::const_iterator;
    3232
    33     inline static PabloBuilder Create(PabloBuilder & parent) noexcept {
    34         return std::move(PabloBuilder(PabloBlock::Create(*(parent.mPb)), parent));
     33    inline static PabloBuilder Create(PabloBlock * block) noexcept {
     34        return std::move(PabloBuilder(block));
     35    }
     36
     37    inline static PabloBuilder Create(PabloBuilder & builder) noexcept {
     38        return std::move(PabloBuilder(new PabloBlock(builder.mPb->mSymbolGenerator), builder));
    3539    }
    3640
     
    150154    /// CreateIf Wrappers
    151155
    152     inline If * createIf(PabloAST * condition, std::initializer_list<Assign *> definedVars, PabloBlock & body) {
     156    inline If * createIf(PabloAST * condition, std::initializer_list<Assign *> definedVars, PabloBlock * body) {
    153157        return mPb->createIf(condition, std::move(definedVars), body);
    154158    }
    155159
    156     inline If * createIf(PabloAST * condition, const std::vector<Assign *> & definedVars, PabloBlock & body) {
     160    inline If * createIf(PabloAST * condition, const std::vector<Assign *> & definedVars, PabloBlock * body) {
    157161        return mPb->createIf(condition, definedVars, body);
    158162    }
    159163
    160     inline If * createIf(PabloAST * condition, std::vector<Assign *> && definedVars, PabloBlock & body) {
     164    inline If * createIf(PabloAST * condition, std::vector<Assign *> && definedVars, PabloBlock * body) {
    161165        return mPb->createIf(condition, std::move(definedVars), body);
    162166    }
    163167
    164168    inline If * createIf(PabloAST * condition, std::initializer_list<Assign *> definedVars, PabloBuilder & builder) {
    165         return mPb->createIf(condition, std::move(definedVars), *builder.mPb);
     169        return mPb->createIf(condition, std::move(definedVars), builder.mPb);
    166170    }
    167171
    168172    inline If * createIf(PabloAST * condition, const std::vector<Assign *> & definedVars, PabloBuilder & builder) {
    169         return mPb->createIf(condition, definedVars, *builder.mPb);
     173        return mPb->createIf(condition, definedVars, builder.mPb);
    170174    }
    171175
    172176    inline If * createIf(PabloAST * condition, std::vector<Assign *> && definedVars, PabloBuilder & builder) {
    173         return mPb->createIf(condition, std::move(definedVars), *builder.mPb);
     177        return mPb->createIf(condition, std::move(definedVars), builder.mPb);
    174178    }
    175179
    176180    /// CreateWhile Wrappers
    177181
    178     inline While * createWhile(PabloAST * condition, const std::initializer_list<Next *> nextVars, PabloBlock & body) {
     182    inline While * createWhile(PabloAST * condition, const std::initializer_list<Next *> nextVars, PabloBlock * body) {
    179183        return mPb->createWhile(condition, nextVars, body);
    180184    }
    181185
    182     inline While * createWhile(PabloAST * condition, const std::vector<Next *> & nextVars, PabloBlock & body) {
     186    inline While * createWhile(PabloAST * condition, const std::vector<Next *> & nextVars, PabloBlock * body) {
    183187        return mPb->createWhile(condition, nextVars, body);
    184188    }
    185189
    186     inline While * createWhile(PabloAST * condition, std::vector<Next *> && nextVars, PabloBlock & body) {
     190    inline While * createWhile(PabloAST * condition, std::vector<Next *> && nextVars, PabloBlock * body) {
    187191        return mPb->createWhile(condition, std::move(nextVars), body);
    188192    }
    189193
    190194    inline While * createWhile(PabloAST * condition, const std::initializer_list<Next *> nextVars, PabloBuilder & builder) {
    191         return mPb->createWhile(condition, nextVars, *builder.mPb);
     195        return mPb->createWhile(condition, std::move(nextVars), builder.mPb);
    192196    }
    193197
    194198    inline While * createWhile(PabloAST * condition, const std::vector<Next *> & nextVars, PabloBuilder & builder) {
    195         return mPb->createWhile(condition, nextVars, *builder.mPb);
     199        return mPb->createWhile(condition, nextVars, builder.mPb);
    196200    }
    197201
    198202    inline While * createWhile(PabloAST * condition, std::vector<Next *> && nextVars, PabloBuilder & builder) {
    199         return mPb->createWhile(condition, std::move(nextVars), *builder.mPb);
     203        return mPb->createWhile(condition, std::move(nextVars), builder.mPb);
    200204    }
    201205
Note: See TracChangeset for help on using the changeset viewer.