Ignore:
Timestamp:
Jul 7, 2018, 10:21:29 PM (10 months ago)
Author:
xwa163
Message:
  1. Improve RE_Compiler for multiplexing
  2. Use faster approach for LineBreakStream? generating in LZParabix_grep
File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/cc/cc_compiler.cpp

    r6089 r6127  
    2727    }
    2828
    29 Parabix_CC_Compiler::Parabix_CC_Compiler(pablo::PabloBlock * scope, std::vector<pablo::PabloAST *> basisBitSet, cc::BitNumbering basisSetNumbering)
     29Parabix_CC_Compiler::Parabix_CC_Compiler(pablo::PabloBlock * scope, std::vector<pablo::PabloAST *> basisBitSet, cc::BitNumbering basisSetNumbering, bool fakeBasisBits)
    3030: CC_Compiler(scope)
    3131, mEncodingBits(basisBitSet.size())
    3232, mBasisSetNumbering(basisSetNumbering)
    33 , mBasisBit(basisBitSet) {
     33, mBasisBit(basisBitSet)
     34, mFakeBasisBits(fakeBasisBits) {
    3435    mEncodingMask = (static_cast<unsigned>(1) << mEncodingBits) - static_cast<unsigned>(1);
    3536}
     
    7879                hi |= (mEncodingMask ^ (mEncodingMask - 1));
    7980                PabloAST * expr = make_range(lo, hi, pb);
    80                 PabloAST * bit0 = getBasisVar(0);
     81                PabloAST * bit0 = getBasisVar(0, pb);
    8182                if ((lo & 1) == 0) {
    8283                    bit0 = pb.createNot(bit0);
     
    105106            PabloAST * term = pb.createOnes();
    106107            if (selected_bits & test_bit) {
    107                 term = getBasisVar(i);
     108                term = getBasisVar(i, pb);
    108109                if ((pattern & test_bit) == 0) {
    109110                    term = pb.createNot(term);
     
    162163    PabloAST* hi_test = LE_Range(diff_count - 1, n2 & mask1, pb);
    163164
    164     return pb.createAnd(common, pb.createSel(getBasisVar(diff_count - 1), hi_test, lo_test));
     165    return pb.createAnd(common, pb.createSel(getBasisVar(diff_count - 1, pb), hi_test, lo_test));
    165166}
    166167
     
    171172    }
    172173    else if (((N % 2) == 0) && ((n >> (N - 2)) == 0)) {
    173         return pb.createOr(pb.createOr(getBasisVar(N - 1), getBasisVar(N - 2)), GE_Range(N - 2, n, pb));
     174        return pb.createOr(pb.createOr(getBasisVar(N - 1, pb), getBasisVar(N - 2, pb)), GE_Range(N - 2, n, pb));
    174175    }
    175176    else if (((N % 2) == 0) && ((n >> (N - 2)) == 3)) {
    176         return pb.createAnd(pb.createAnd(getBasisVar(N - 1), getBasisVar(N - 2)), GE_Range(N - 2, n - (3 << (N - 2)), pb));
     177        return pb.createAnd(pb.createAnd(getBasisVar(N - 1, pb), getBasisVar(N - 2, pb)), GE_Range(N - 2, n - (3 << (N - 2)), pb));
    177178    }
    178179    else if (N >= 1)
     
    188189              the value of GE_range(N-1), lo_range) is required.
    189190            */
    190             return pb.createOr(getBasisVar(N - 1), lo_range);
     191            return pb.createOr(getBasisVar(N - 1, pb), lo_range);
    191192        }
    192193        else
     
    196197              in the target for >= and GE_range(N-1, lo_bits) must also be true.
    197198            */
    198             return pb.createAnd(getBasisVar(N - 1), lo_range);
     199            return pb.createAnd(getBasisVar(N - 1, pb), lo_range);
    199200        }
    200201    }
     
    225226}
    226227
    227 inline PabloAST * Parabix_CC_Compiler::getBasisVar(const unsigned i) const {
    228     assert (i < mEncodingBits);
    229     if (mBasisSetNumbering == cc::BitNumbering::BigEndian)
    230         return mBasisBit[mEncodingBits - i - 1];
    231     else return mBasisBit[i];
     228template<typename PabloBlockOrBuilder>
     229inline PabloAST * Parabix_CC_Compiler::getBasisVar(const unsigned i, PabloBlockOrBuilder & pb) const {
     230    if (mFakeBasisBits) {
     231        return pb.createZeroes();
     232    } else {
     233        assert (i < mEncodingBits);
     234        if (mBasisSetNumbering == cc::BitNumbering::BigEndian)
     235            return mBasisBit[mEncodingBits - i - 1];
     236        else return mBasisBit[i];
     237    }
    232238}
    233239
Note: See TracChangeset for help on using the changeset viewer.