Changeset 4641


Ignore:
Timestamp:
Jul 6, 2015, 9:35:48 AM (4 years ago)
Author:
nmedfort
Message:

Next nodes for While statements must be declared similar to how Defined Vars are for Ifs. (Temporarily breaks multiplexing correctness.)

Location:
icGREP/icgrep-devel/icgrep
Files:
14 edited

Legend:

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

    r4622 r4641  
    66struct __##NAME { \
    77    inline PabloAST * operator()(PabloAST * arg) { \
    8         return mPb.NAME(arg); \
     8        return mPb->NAME(arg); \
    99    } \
    10     inline __##NAME(PabloBlock & pb) : mPb(pb) {} \
     10    inline __##NAME(PabloBlock * pb) : mPb(pb) {} \
    1111private: \
    12     PabloBlock & mPb; \
     12    PabloBlock * mPb; \
    1313}; \
    1414__##NAME functor(mPb); \
     
    1818struct __##NAME { \
    1919    inline PabloAST * operator()(PabloAST * arg, const std::string name) { \
    20         return mPb.NAME(arg, name); \
     20        return mPb->NAME(arg, name); \
    2121    } \
    22     inline __##NAME(PabloBlock & pb) : mPb(pb) {} \
     22    inline __##NAME(PabloBlock * pb) : mPb(pb) {} \
    2323private: \
    24     PabloBlock & mPb; \
     24    PabloBlock * mPb; \
    2525}; \
    2626__##NAME functor(mPb); \
     
    3030struct __##NAME { \
    3131    inline PabloAST * operator()(PabloAST * arg1, PabloAST * arg2) { \
    32         return mPb.NAME(arg1, arg2); \
     32        return mPb->NAME(arg1, arg2); \
    3333    } \
    34     inline __##NAME(PabloBlock & pb) : mPb(pb) {} \
     34    inline __##NAME(PabloBlock * pb) : mPb(pb) {} \
    3535private: \
    36     PabloBlock & mPb; \
     36    PabloBlock * mPb; \
    3737}; \
    3838__##NAME functor(mPb); \
     
    4242struct __##NAME { \
    4343    inline PabloAST * operator()(PabloAST * arg1, PabloAST * arg2, const std::string name) { \
    44         return mPb.NAME(arg1, arg2, name); \
     44        return mPb->NAME(arg1, arg2, name); \
    4545    } \
    46     inline __##NAME(PabloBlock & pb) : mPb(pb) {} \
     46    inline __##NAME(PabloBlock * pb) : mPb(pb) {} \
    4747private: \
    48     PabloBlock & mPb; \
     48    PabloBlock * mPb; \
    4949}; \
    5050__##NAME functor(mPb); \
     
    5454struct __##NAME { \
    5555    inline PabloAST * operator()(PabloAST * arg1, PabloAST * arg2, PabloAST * arg3) { \
    56         return mPb.NAME(arg1, arg2, arg3); \
     56        return mPb->NAME(arg1, arg2, arg3); \
    5757    } \
    58     inline __##NAME(PabloBlock & pb) : mPb(pb) {} \
     58    inline __##NAME(PabloBlock * pb) : mPb(pb) {} \
    5959private: \
    60     PabloBlock & mPb; \
     60    PabloBlock * mPb; \
    6161}; \
    6262__##NAME functor(mPb); \
     
    6666struct __##NAME { \
    6767    inline PabloAST * operator()(PabloAST * arg1, PabloAST * arg2, PabloAST * arg3, const std::string name) { \
    68         return mPb.NAME(arg1, arg2, arg3, name); \
     68        return mPb->NAME(arg1, arg2, arg3, name); \
    6969    } \
    70     inline __##NAME(PabloBlock & pb) : mPb(pb) {} \
     70    inline __##NAME(PabloBlock * pb) : mPb(pb) {} \
    7171private: \
    72     PabloBlock & mPb; \
     72    PabloBlock * mPb; \
    7373}; \
    7474__##NAME functor(mPb); \
  • icGREP/icgrep-devel/icgrep/pablo/builder.hpp

    r4622 r4641  
    1010public:
    1111
    12     PabloBuilder(PabloBlock & block) : mPb(block), mParent(nullptr) {}
     12    explicit PabloBuilder(PabloBlock & block) : mPb(&block), mParent(nullptr) {}
    1313
    14     PabloBuilder(PabloBlock & block, PabloBuilder & parent) : mPb(block), mParent(&parent), mExprTable(&(parent.mExprTable)) {}
     14    explicit PabloBuilder(PabloBlock & block, PabloBuilder & parent) : mPb(&block), mParent(&parent), mExprTable(&(parent.mExprTable)) {}
    1515
    16     inline static PabloBuilder && Create(PabloBuilder & parent) {
    17         return std::move(PabloBuilder(parent.mPb.Create(parent.mPb), parent));
     16    PabloBuilder(const PabloBuilder &) = default;
     17
     18    PabloBuilder & operator=(PabloBuilder &) = delete;
     19
     20    PabloBuilder & operator=(PabloBuilder &&) = default;
     21
     22    inline static PabloBuilder && Create(PabloBuilder & parent) noexcept {
     23        return std::move(PabloBuilder(PabloBlock::Create(*(parent.mPb)), parent));
    1824    }
    1925
    2026    inline Zeroes * createZeroes() const {
    21         return mPb.createZeroes();
     27        return mPb->createZeroes();
    2228    }
    2329
    2430    inline Ones * createOnes() const {
    25         return mPb.createOnes();
     31        return mPb->createOnes();
    2632    }
    2733
    2834    inline Var * createVar(const std::string name) {
    29         return mPb.createVar(name);
     35        return mPb->createVar(name);
    3036    }
    3137
    3238    inline Var * createVar(String * const name) {
    33         return mPb.createVar(name);
     39        return mPb->createVar(name);
    3440    }
    3541
    3642    inline Var * createVar(PabloAST * const name) {
    37         return mPb.createVar(name);
     43        return mPb->createVar(name);
    3844    }
    3945
    4046    inline Call * createCall(const std::string name) {
    41         return createCall(mPb.getName(name));
     47        return createCall(mPb->getName(name));
    4248    }
    4349
     
    4551
    4652    Assign * createAssign(const std::string && prefix, PabloAST * expr, const int outputIndex = -1) {
    47         return mPb.createAssign(std::move(prefix), expr, outputIndex);
     53        return mPb->createAssign(std::move(prefix), expr, outputIndex);
    4854    }
    4955
     
    5258            return expr;
    5359        }
    54         return createAdvance(expr, mPb.getInteger(shiftAmount));
     60        return createAdvance(expr, mPb->getInteger(shiftAmount));
    5561    }
    5662
     
    6167            return expr;
    6268        }
    63         return createAdvance(expr, mPb.getInteger(shiftAmount), prefix);
     69        return createAdvance(expr, mPb->getInteger(shiftAmount), prefix);
    6470    }
    6571
     
    6773
    6874    inline Next * createNext(Assign * assign, PabloAST * expr) {
    69         return mPb.createNext(assign, expr);
     75        return mPb->createNext(assign, expr);
    7076    }
    7177
     
    98104    PabloAST * createSel(PabloAST * condition, PabloAST * trueExpr, PabloAST * falseExpr, const std::string prefix);
    99105
    100     inline If * createIf(PabloAST * condition, std::initializer_list<Assign *> definedVars, PabloBuilder & body) {
    101         return mPb.createIf(condition, std::move(definedVars), body.mPb);
     106    /// CreateIf Wrappers
     107
     108    inline If * createIf(PabloAST * condition, std::initializer_list<Assign *> definedVars, PabloBlock & body) {
     109        return mPb->createIf(condition, std::move(definedVars), body);
    102110    }
    103111
    104     inline If * createIf(PabloAST * condition, std::initializer_list<Assign *> definedVars, PabloBlock & body) {
    105         return mPb.createIf(condition, std::move(definedVars), body);
     112    inline If * createIf(PabloAST * condition, const std::vector<Assign *> & definedVars, PabloBlock & body) {
     113        return mPb->createIf(condition, definedVars, body);
    106114    }
    107115
    108     inline If * createIf(PabloAST * condition, std::vector<Assign *> definedVars, PabloBuilder & body) {
    109         return mPb.createIf(condition, std::move(definedVars), body.mPb);
     116    inline If * createIf(PabloAST * condition, std::vector<Assign *> && definedVars, PabloBlock & body) {
     117        return mPb->createIf(condition, std::move(definedVars), body);
    110118    }
    111119
    112     inline If * createIf(PabloAST * condition, std::vector<Assign *> definedVars, PabloBlock & body) {
    113         return mPb.createIf(condition, std::move(definedVars), body);
     120    inline If * createIf(PabloAST * condition, std::initializer_list<Assign *> definedVars, PabloBuilder & builder) {
     121        return mPb->createIf(condition, std::move(definedVars), *builder.mPb);
    114122    }
    115123
    116     inline While * createWhile(PabloAST * condition, PabloBuilder & body) {
    117         return mPb.createWhile(condition, body.mPb);
     124    inline If * createIf(PabloAST * condition, const std::vector<Assign *> & definedVars, PabloBuilder & builder) {
     125        return mPb->createIf(condition, definedVars, *builder.mPb);
    118126    }
    119127
    120     inline While * createWhile(PabloAST * condition, PabloBlock & body) {
    121         return mPb.createWhile(condition, body);
     128    inline If * createIf(PabloAST * condition, std::vector<Assign *> && definedVars, PabloBuilder & builder) {
     129        return mPb->createIf(condition, std::move(definedVars), *builder.mPb);
     130    }
     131
     132    /// CreateWhile Wrappers
     133
     134    inline While * createWhile(PabloAST * condition, const std::initializer_list<Next *> nextVars, PabloBlock & body) {
     135        return mPb->createWhile(condition, nextVars, body);
     136    }
     137
     138    inline While * createWhile(PabloAST * condition, const std::vector<Next *> & nextVars, PabloBlock & body) {
     139        return mPb->createWhile(condition, nextVars, body);
     140    }
     141
     142    inline While * createWhile(PabloAST * condition, std::vector<Next *> && nextVars, PabloBlock & body) {
     143        return mPb->createWhile(condition, std::move(nextVars), body);
     144    }
     145
     146    inline While * createWhile(PabloAST * condition, const std::initializer_list<Next *> nextVars, PabloBuilder & builder) {
     147        return mPb->createWhile(condition, nextVars, *builder.mPb);
     148    }
     149
     150    inline While * createWhile(PabloAST * condition, const std::vector<Next *> & nextVars, PabloBuilder & builder) {
     151        return mPb->createWhile(condition, nextVars, *builder.mPb);
     152    }
     153
     154    inline While * createWhile(PabloAST * condition, std::vector<Next *> && nextVars, PabloBuilder & builder) {
     155        return mPb->createWhile(condition, std::move(nextVars), *builder.mPb);
    122156    }
    123157
    124158    inline Statement * front() const {
    125         return mPb.front();
     159        return mPb->front();
    126160    }
    127161
    128162    inline Statement * back() const {
    129         return mPb.back();
    130     }
    131 
    132     inline void setInsertPoint(Statement * const statement) {
    133         mPb.setInsertPoint(statement);
    134     }
    135 
    136     inline void setInsertPoint(StatementList * const list) {
    137         mPb.setInsertPoint(list);
     163        return mPb->back();
    138164    }
    139165
    140166    inline Statement * getInsertPoint() const {
    141         return mPb.getInsertPoint();
     167        return mPb->getInsertPoint();
    142168    }
    143169
    144     inline PabloBlock & getPabloBlock() {
     170    inline PabloBlock * getPabloBlock() {
    145171        return mPb;
    146172    }
     
    152178private:
    153179
    154     PabloBlock &        mPb;
     180    PabloBlock *        mPb;
    155181    PabloBuilder *      mParent;
    156182    ExpressionTable     mExprTable;
  • icGREP/icgrep-devel/icgrep/pablo/codegenstate.cpp

    r4612 r4641  
    9494Next * PabloBlock::createNext(Assign * assign, PabloAST * expr) {
    9595    assert (assign && expr);
    96     return insertAtInsertionPoint(new Next(assign, expr, this));
     96    assert (assign->getName());
     97    std::string name = assign->getName()->to_string() + "'";
     98    return new Next(assign, createAssign(std::move(name), expr), this);
    9799}
    98100
     
    393395}
    394396
    395 While * PabloBlock::createWhile(PabloAST * condition, PabloBlock & body) {
    396     assert (condition);
    397     return insertAtInsertionPoint(new While(condition, body, this));
     397While * PabloBlock::createWhile(PabloAST * condition, const std::initializer_list<Next *> nextVars, PabloBlock & body) {
     398    assert (condition);
     399    return insertAtInsertionPoint(new While(condition, nextVars, body, this));
     400}
     401
     402While * PabloBlock::createWhile(PabloAST * condition, const std::vector<Next *> & nextVars, PabloBlock & body) {
     403    assert (condition);
     404    return insertAtInsertionPoint(new While(condition, nextVars, body, this));
     405}
     406
     407While * PabloBlock::createWhile(PabloAST * condition, std::vector<Next *> && nextVars, PabloBlock & body) {
     408    assert (condition);
     409    return insertAtInsertionPoint(new While(condition, nextVars, body, this));
    398410}
    399411
  • icGREP/icgrep-devel/icgrep/pablo/codegenstate.h

    r4612 r4641  
    129129    If * createIf(PabloAST * condition, std::vector<Assign *> && definedVars, PabloBlock & body);
    130130
    131     While * createWhile(PabloAST * condition, PabloBlock & body);
     131    While * createWhile(PabloAST * condition, const std::initializer_list<Next *> nextVars, PabloBlock & body);
     132
     133    While * createWhile(PabloAST * condition, const std::vector<Next *> & nextVars, PabloBlock & body);
     134
     135    While * createWhile(PabloAST * condition, std::vector<Next *> && nextVars, PabloBlock & body);
     136
    132137
    133138    inline StatementList & statements() {
  • icGREP/icgrep-devel/icgrep/pablo/expression_map.hpp

    r4602 r4641  
    1111struct ExpressionMap {
    1212    enum {N = sizeof...(Args)};
    13     typedef ExpressionMap<Args...> MapType;
     13    typedef ExpressionMap<Args...> Type;
    1414    typedef std::tuple<PabloAST::ClassTypeId, Args...> Key;
    1515
    16     inline ExpressionMap(MapType * predecessor)
    17     : mPredecessor(predecessor)
    18     {
     16    inline explicit ExpressionMap(Type * predecessor) : mPredecessor(predecessor) { }
    1917
    20     }
     18    ExpressionMap(const Type &) = default;
     19
     20    ExpressionMap(Type &&) = default;
    2121
    2222    template <class Functor, typename... Params>
     
    7979
    8080private:
    81     MapType * const             mPredecessor;
     81    Type *                      mPredecessor;
    8282    std::map<Key, PabloAST *>   mMap;
    8383};
     
    8686struct ExpressionTable {
    8787
    88     ExpressionTable()
     88    ExpressionTable() noexcept
    8989    : mUnary(nullptr)
    9090    , mBinary(nullptr)
    91     , mTernary(nullptr)
    92     {
     91    , mTernary(nullptr) {
    9392
    9493    }
    9594
    96     ExpressionTable(ExpressionTable * predecessor)
     95    explicit ExpressionTable(ExpressionTable * predecessor) noexcept
    9796    : mUnary(predecessor ? &(predecessor->mUnary) : nullptr)
    9897    , mBinary(predecessor ? &(predecessor->mBinary) : nullptr)
    99     , mTernary(predecessor ? &(predecessor->mTernary) : nullptr)
    100     {
     98    , mTernary(predecessor ? &(predecessor->mTernary) : nullptr) {
    10199
    102100    }
     101
     102    ExpressionTable(const ExpressionTable &) = default;
     103
     104    ExpressionTable(ExpressionTable &&) = default;
    103105
    104106    template <class Functor, typename... Params>
  • icGREP/icgrep-devel/icgrep/pablo/optimizers/pablo_automultiplexing.cpp

    r4639 r4641  
    996996                }
    997997
    998                 PabloAST * demuxed = Q.front(); Q.pop_front(); assert (demux);
     998                PabloAST * demuxed = Q.front(); Q.pop_front(); assert (demuxed);
    999999                input[i - 1]->replaceWith(demuxed, true, true);
    10001000            }
    10011001
    1002             // simplify(muxed, m, builder);
     1002            simplify(muxed, m, builder);
    10031003        }
    10041004    }
     
    10141014    std::queue<PabloAST *> Q;
    10151015    llvm::DenseMap<PabloAST *, DdNode *> characterization;
    1016     boost::container::flat_set<PabloAST *> uncharacterized;
     1016    flat_set<PabloAST *> uncharacterized;
    10171017
    10181018    DdManager * manager = Cudd_Init(n + mBaseVariables.size(), 0, CUDD_UNIQUE_SLOTS, CUDD_CACHE_SLOTS, 0);
     
    10441044                case PabloAST::ClassTypeId::Sel:
    10451045                    // And it is within the same scope ...
    1046                     if ((stmt = cast<Statement>(user))->getParent() == &builder.getPabloBlock()) {
     1046                    if ((stmt = cast<Statement>(user))->getParent() == builder.getPabloBlock()) {
    10471047                        bool characterized = true;
    10481048                        for (unsigned i = 0; i != stmt->getNumOperands(); ++i) {
     
    11101110    int * cube = nullptr;
    11111111    for (auto itr : outputs) {
     1112
    11121113        // Look into doing some more analysis here to see if a Xor or Sel operation is possible.
    11131114        DdGen * gen = Cudd_FirstCube(manager, itr.second, &cube, &value);
    11141115        while (!Cudd_IsGenEmpty(gen)) {
    1115             // cube[0 ... n - 1] = { 0 : false, 1: true, 2: don't care }
    1116             for (unsigned i = n - 1; i; --i) {
     1116            // cube[0 ... n - 1] = {{ 0 : false, 1: true, 2: don't care }}
     1117            for (unsigned i = 0; i != n; ++i) {
    11171118                if (cube[i] == 0) {
    11181119                    S.push_back(variables[i]);
     
    11301131            }
    11311132
    1132             for (unsigned i = n - 1; i; --i) {
     1133            for (unsigned i = 0; i != n; ++i) {
    11331134                if (cube[i] == 1) {
    11341135                    S.push_back(variables[i]);
  • icGREP/icgrep-devel/icgrep/pablo/pablo_compiler.cpp

    r4640 r4641  
    566566        LOAD_WHILE_CARRIES
    567567
    568         SmallVector<const Next*, 4> nextNodes;
    569         SmallVector<PHINode *, 4> nextPhis;
    570         for (const PabloAST * node : whileStatement->getBody()) {
    571             if (isa<Next>(node)) {
    572                 nextNodes.push_back(cast<Next>(node));
    573             }
    574         }
     568        const auto & nextNodes = whileStatement->getVariants();
     569        std::vector<PHINode *> nextPhis;
     570        nextPhis.reserve(nextNodes.size());
    575571   
    576572        // On entry to the while structure, proceed to execute the first iteration
     
    623619        for (unsigned i = 0; i < nextNodes.size(); i++) {
    624620            const Next * n = nextNodes[i];
    625             auto f = mMarkerMap.find(n->getInitial());
    626             assert (f != mMarkerMap.end());
    627             PHINode * phi = nextPhis[i];
    628             if (LLVM_UNLIKELY(f->second == phi)) {
    629                 throw std::runtime_error("Unexpected Phi node for Next node.");
     621            auto f = mMarkerMap.find(n->getExpr());
     622            if (LLVM_UNLIKELY(f == mMarkerMap.end())) {
     623                throw std::runtime_error("Next node expression was not compiled!");
    630624            }
    631             phi->addIncoming(f->second, whileBodyFinalBlock);
    632             //mMarkerMap[n->getInitial()] = f->second;
     625            nextPhis[i]->addIncoming(f->second, whileBodyFinalBlock);
    633626        }
    634627
  • icGREP/icgrep-devel/icgrep/pablo/pe_next.h

    r4432 r4641  
    2929protected:
    3030    Next(PabloAST * initial, PabloAST * expr, PabloBlock * parent)
    31     : Statement(ClassTypeId::Next, {cast<Assign>(initial), expr}, cast<Assign>(initial)->getName(), parent) {
     31    : Statement(ClassTypeId::Next, {cast<Assign>(initial), cast<Assign>(expr)}, cast<Assign>(initial)->getName(), parent) {
    3232        this->addUser(initial);
    3333    }
  • icGREP/icgrep-devel/icgrep/pablo/ps_if.cpp

    r4541 r4641  
    88: Statement(ClassTypeId::If, {expr}, nullptr, parent)
    99, mBody(body)
    10 , mDefined(definedVars.begin(), definedVars.end(), mVectorAllocator)
     10, mDefined(definedVars.begin(), definedVars.end(), reinterpret_cast<DefinedAllocator &>(mVectorAllocator))
    1111{
    1212    // Conceptually, having a defined var X is identical to having:
     
    3030: Statement(ClassTypeId::If, {expr}, nullptr, parent)
    3131, mBody(body)
    32 , mDefined(definedVars.begin(), definedVars.end(), mVectorAllocator)
     32, mDefined(definedVars.begin(), definedVars.end(), reinterpret_cast<DefinedAllocator &>(mVectorAllocator))
    3333{
    3434    for (PabloAST * assign : mDefined) {
  • icGREP/icgrep-devel/icgrep/pablo/ps_if.h

    r4640 r4641  
    2020    friend class Simplifier;
    2121public:
    22     using DefinedVars = std::vector<PabloAST *, VectorAllocator>;
     22    using DefinedAllocator = VectorAllocator::rebind<Assign *>::other;
     23    using DefinedVars = std::vector<Assign *, DefinedAllocator>;
    2324
    2425    static inline bool classof(const PabloAST * e) {
  • icGREP/icgrep-devel/icgrep/pablo/ps_while.cpp

    r4541 r4641  
    44namespace pablo {
    55
    6 While::While(PabloAST * expr, PabloBlock & body, PabloBlock * parent)
     6While::While(PabloAST * expr, const std::initializer_list<Next *> nextVars, PabloBlock & body, PabloBlock * parent)
    77: Statement(ClassTypeId::While, {expr}, nullptr, parent)
    88, mBody(body)
     9, mNext(nextVars.begin(), nextVars.end(), reinterpret_cast<NextAllocator &>(mVectorAllocator))
     10{
     11
     12}
     13
     14While::While(PabloAST * expr, const std::vector<Next *> & nextVars, PabloBlock & body, PabloBlock * parent)
     15: Statement(ClassTypeId::While, {expr}, nullptr, parent)
     16, mBody(body)
     17, mNext(nextVars.begin(), nextVars.end(), reinterpret_cast<NextAllocator &>(mVectorAllocator))
    918{
    1019
  • icGREP/icgrep-devel/icgrep/pablo/ps_while.h

    r4640 r4641  
    1212namespace pablo {
    1313
     14class Next;
     15
    1416class While : public Statement {
    1517    friend class PabloBlock;
    1618public:
     19
     20    using NextAllocator = VectorAllocator::rebind<Next*>::other;
     21    using NextVars = std::vector<Next *, NextAllocator>;
     22
    1723    static inline bool classof(const PabloAST * e) {
    1824        return e->getClassTypeId() == ClassTypeId::While;
     
    2632        return getOperand(0);
    2733    }
     34    inline const NextVars & getVariants() const {
     35        return mNext;
     36    }
    2837    inline PabloBlock & getBody() {
    2938        return mBody;
     
    3342    }
    3443protected:
    35     While(PabloAST * expr, PabloBlock &body, PabloBlock * parent);
     44    While(PabloAST * expr, const std::initializer_list<Next *> nextVars, PabloBlock &body, PabloBlock * parent);
     45    While(PabloAST * expr, const std::vector<Next *> & nextVars, PabloBlock &body, PabloBlock * parent);
     46
    3647private:
    37     PabloBlock &        mBody;
     48    PabloBlock &    mBody;
     49    NextVars        mNext;
    3850};
    3951
  • icGREP/icgrep-devel/icgrep/re/re_compiler.cpp

    r4638 r4641  
    3838static cl::opt<bool> DisableUnicodeLineBreak("disable-unicode-linebreak", cl::init(false),
    3939                     cl::desc("disable Unicode line breaks - use LF only"), cl::cat(fREcompilationOptions));
    40 static cl::opt<bool> DisablePregeneratedUnicode("disable-pregenerated-unicode", cl::init(true),
     40static cl::opt<bool> DisablePregeneratedUnicode("disable-pregenerated-unicode", cl::init(false),
    4141                     cl::desc("disable use of pregenerated Unicode character class sets"), cl::cat(fREcompilationOptions));
    4242
     
    5959, mWhileTest(nullptr)
    6060, mStarDepth(0)
    61 , mPB(ccCompiler.getBuilder().getPabloBlock(), ccCompiler.getBuilder())
     61, mLoopVariants()
     62, mPB(*ccCompiler.getBuilder().getPabloBlock(), ccCompiler.getBuilder())
    6263, mUCDCompiler(ccCompiler)
    6364{
     
    510511        Next * nextPending = pb.createNext(starPending, pb.createAnd(loopComputation, pb.createNot(m2)));
    511512        Next * nextStarAccum = pb.createNext(starAccum, pb.createOr(loopComputation, m2));
     513        mLoopVariants.push_back(nextPending);
     514        mLoopVariants.push_back(nextStarAccum);
    512515        mWhileTest = pb.createOr(mWhileTest, nextPending);
    513516        mStarDepth--;
     
    528531        Next * nextWhileAccum = wb.createNext(whileAccum, wb.createOr(loopComputation, whileAccum));
    529532        Next * nextWhileTest = wb.createNext(whileTest, wb.createOr(mWhileTest, nextWhilePending));
    530         pb.createWhile(nextWhileTest, wb);
     533        mLoopVariants.push_back(nextWhilePending);
     534        mLoopVariants.push_back(nextWhileAccum);
     535        mLoopVariants.push_back(nextWhileTest);
     536        pb.createWhile(nextWhileTest, mLoopVariants, wb);
    531537        mStarDepth--;
    532 
     538        mLoopVariants.clear();
    533539        return makeMarker(InitialPostPositionByte, pb.createAssign("unbounded", nextWhileAccum));
    534540    }   
  • icGREP/icgrep-devel/icgrep/re/re_compiler.h

    r4638 r4641  
    9797    pablo::PabloAST *                               mWhileTest;
    9898    int                                             mStarDepth;
     99    std::vector<pablo::Next *>                      mLoopVariants; // <- rethink name
    99100    pablo::PabloBuilder                             mPB;
    100101    UCD::UCDCompiler                                mUCDCompiler;
Note: See TracChangeset for help on using the changeset viewer.