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.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.