Ignore:
Timestamp:
Sep 22, 2017, 3:36:36 PM (21 months ago)
Author:
nmedfort
Message:

Minor bug fixes and removal of inadvertent check in for StreamSet?.cpp/h

Location:
icGREP/icgrep-devel/icgrep/pablo
Files:
4 edited

Legend:

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

    r5486 r5647  
    13061306    using line_t = long long int;
    13071307
    1308     enum : line_t { MAX_INT = std::numeric_limits<line_t>::max() };
     1308    const auto MAX_INT = std::numeric_limits<line_t>::max();
    13091309
    13101310    // errs() << "---------------------------------------------------------\n";
  • icGREP/icgrep-devel/icgrep/pablo/pabloAST.cpp

    r5283 r5647  
    351351 * @brief contains
    352352 ** ------------------------------------------------------------------------------------------------------------- */
    353 bool StatementList::contains(Statement * const statement) {
    354     for (Statement * stmt : *this) {
     353bool StatementList::contains(const Statement * const statement) const {
     354    for (const Statement * stmt : *this) {
    355355        if (statement == stmt) {
    356356            return true;
  • icGREP/icgrep-devel/icgrep/pablo/pabloAST.h

    r5510 r5647  
    461461        iterator(Statement* base): mCurrent(base) {}
    462462
    463         iterator(const iterator& other): mCurrent(other.mCurrent) {}
    464 
    465         const iterator& operator=(const iterator& other) {
    466             mCurrent = other.mCurrent; return other;
     463        iterator(const iterator & other): mCurrent(other.mCurrent) {}
     464
     465        iterator & operator=(const iterator & other) {
     466            mCurrent = other.mCurrent;
     467            return *this;
    467468        }
    468469
     
    473474        }
    474475
    475         iterator  operator++(int) {
     476        iterator operator++(int) {
    476477            iterator tmp(*this);
    477478            ++(*this);
     
    479480        }
    480481
    481         bool operator==(const iterator& other) const {
     482        bool operator==(const iterator & other) const {
    482483            return  mCurrent == other.mCurrent;
    483484        }
    484485
    485         bool operator!=(const iterator& other) const {
     486        bool operator!=(const iterator & other) const {
    486487            return  mCurrent != other.mCurrent;
    487488        }
     
    500501        const_iterator(const Statement* base): mCurrent(base) {}
    501502        const_iterator(const const_iterator& other): mCurrent(other.mCurrent) {}
    502         const const_iterator& operator=(const const_iterator& other) {mCurrent = other.mCurrent; return other;}
     503        const_iterator& operator=(const const_iterator & other) {
     504            mCurrent = other.mCurrent;
     505            return *this;
     506        }
    503507
    504508        inline const_iterator& operator++() {
     
    537541        reverse_iterator(const reverse_iterator& other): mCurrent(other.mCurrent) {}
    538542
    539         const reverse_iterator& operator=(const reverse_iterator& other) {
    540             mCurrent = other.mCurrent; return other;
     543        reverse_iterator & operator=(const reverse_iterator & other) {
     544            mCurrent = other.mCurrent;
     545            return *this;
    541546        }
    542547
     
    573578        const_reverse_iterator(): mCurrent(nullptr) {}
    574579        const_reverse_iterator(const Statement* base): mCurrent(base) {}
    575         const_reverse_iterator(const const_reverse_iterator& other): mCurrent(other.mCurrent) {}
    576         const const_reverse_iterator& operator=(const const_reverse_iterator& other) {mCurrent = other.mCurrent; return other;}
     580        const_reverse_iterator(const const_reverse_iterator & other): mCurrent(other.mCurrent) {}
     581
     582        const_reverse_iterator& operator=(const const_reverse_iterator & other) {
     583            mCurrent = other.mCurrent;
     584            return *this;
     585        }
    577586
    578587        inline const_reverse_iterator& operator++() {
     
    686695    }
    687696
    688     bool contains(Statement * const statement);
     697    bool contains(const Statement * const statement) const;
    689698
    690699protected:
  • icGREP/icgrep-devel/icgrep/pablo/pablo_compiler.cpp

    r5646 r5647  
    556556            iBuilder->CreateAlignedStore(value, ptr, alignment);
    557557        } else if (const Lookahead * l = dyn_cast<Lookahead>(stmt)) {
    558             Var * var = nullptr;
    559558            PabloAST * stream = l->getExpression();
    560             Value * index = iBuilder->getInt32(0);
     559            Value * index = nullptr;
    561560            if (LLVM_UNLIKELY(isa<Extract>(stream))) {
    562                 var = cast<Var>(cast<Extract>(stream)->getArray());
     561                stream = cast<Extract>(stream)->getArray();
     562                index = compileExpression(iBuilder, cast<Extract>(stream)->getIndex());
     563            } else {
     564                index = iBuilder->getInt32(0);
    563565            }
    564566            const auto bit_shift = (l->getAmount() % iBuilder->getBitBlockWidth());
    565567            const auto block_shift = (l->getAmount() / iBuilder->getBitBlockWidth());
    566 
    567             Value * ptr = iBuilder->getAdjustedInputStreamBlockPtr(iBuilder->getSize(block_shift), var->getName(), index);
     568            Value * ptr = iBuilder->getAdjustedInputStreamBlockPtr(iBuilder->getSize(block_shift), cast<Var>(stream)->getName(), index);
    568569            Value * lookAhead = iBuilder->CreateBlockAlignedLoad(ptr);
    569570            if (bit_shift == 0) {  // Simple case with no intra-block shifting.
    570571                value = lookAhead;
    571572            } else { // Need to form shift result from two adjacent blocks.
    572                 Value * ptr = iBuilder->getAdjustedInputStreamBlockPtr(iBuilder->getSize(block_shift + 1), var->getName(), index);
     573                Value * ptr = iBuilder->getAdjustedInputStreamBlockPtr(iBuilder->getSize(block_shift + 1), cast<Var>(stream)->getName(), index);
    573574                Value * lookAhead1 = iBuilder->CreateBlockAlignedLoad(ptr);
    574575                if (LLVM_UNLIKELY((bit_shift % 8) == 0)) { // Use a single whole-byte shift, if possible.
Note: See TracChangeset for help on using the changeset viewer.