Changeset 6219 for icGREP


Ignore:
Timestamp:
Dec 6, 2018, 8:22:12 AM (4 months ago)
Author:
cameron
Message:

Update lz4 grep; don't print definitions of names except when needed

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

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/lz4/grep/lz4_grep_base_generator.cpp

    r6188 r6219  
    6060using namespace cc;
    6161
    62 using Alphabets = ICGrepKernel::Alphabets;
    63 using Externals = ICGrepKernel::Externals;
    64 
    6562inline RE * makeNonFinal() {
    6663    CC * const C2_F4 = makeByte(0xC2, 0xF4);
     
    231228                StreamSet * u8FinalStream = mPipeline->CreateStreamSet();
    232229                RE * const mpxU8FinalRe = transformCCs(mpx, u8FinalRe);
    233                 Alphabets alpha;
    234                 alpha.emplace_back(mpx, uncompressedCharClasses);
    235                 mPipeline->CreateKernelCall<ICGrepKernel>(mpxU8FinalRe, fakeMatchCopiedBits, uncompressedCharClasses, Externals{}, alpha, BitNumbering::BigEndian, false);
     230               
     231                std::unique_ptr<GrepKernelOptions> options = make_unique<GrepKernelOptions>();
     232                options->addAlphabet(mpx, uncompressedCharClasses);
     233                options->setSource(fakeMatchCopiedBits);
     234                options->setNumbering(BitNumbering::BigEndian);
     235                options->setRE(mpxU8FinalRe);
     236                options->setResults(u8FinalStream);
     237                mPipeline->CreateKernelCall<ICGrepKernel>(std::move(options));
     238
    236239                u8NoFinalStream = mPipeline->CreateStreamSet(1, 1);
    237240                mPipeline->CreateKernelCall<LZ4NotKernel>(u8FinalStream, u8NoFinalStream);
    238241            } else {
    239242                StreamSet * compressedNonFinalStream = mPipeline->CreateStreamSet(1, 1);
    240                 mPipeline->CreateKernelCall<ICGrepKernel>(u8NonFinalRe, compressedBitStream, compressedNonFinalStream, Externals{}, Alphabets{}, BitNumbering::BigEndian);
     243 
     244                std::unique_ptr<GrepKernelOptions> options = make_unique<GrepKernelOptions>();
     245                options->setSource(compressedBitStream);
     246                options->setNumbering(BitNumbering::BigEndian);
     247                options->setRE(u8NonFinalRe);
     248                options->setResults(compressedNonFinalStream);
     249                mPipeline->CreateKernelCall<ICGrepKernel>(std::move(options));
     250
    241251                auto decompressedStreams = decompressBitStreams(compressedByteStream, {CharClasses, compressedNonFinalStream});
    242252                uncompressedCharClasses = decompressedStreams[0];
     
    273283    StreamSet * LineBreakStream = mPipeline->CreateStreamSet(1, 1);
    274284
    275     RE * const transformedCC = transformCCs(mpx, linefeedCC);
    276 
    277     Alphabets alpha;
    278     alpha.emplace_back(mpx, uncompressedCharClasses);
    279 
    280     mPipeline->CreateKernelCall<ICGrepKernel>(transformedCC, fakeMatchCopiedBits, LineBreakStream, Externals{}, alpha, BitNumbering::BigEndian, false);
    281 
    282     Externals externals;
    283     externals.emplace_back("UTF8_nonfinal", u8NoFinalStream);
    284 
    285     mPipeline->CreateKernelCall<ICGrepKernel>(mRE, fakeMatchCopiedBits, MatchResults, externals, alpha, BitNumbering::BigEndian, false);
     285    RE * const transformedLF = transformCCs(mpx, linefeedCC);
     286    std::unique_ptr<GrepKernelOptions> optionsLF = make_unique<GrepKernelOptions>();
     287
     288    optionsLF->addAlphabet(mpx, uncompressedCharClasses);
     289    optionsLF->setSource(fakeMatchCopiedBits);
     290    optionsLF->setNumbering(BitNumbering::BigEndian);
     291    optionsLF->setRE(transformedLF);
     292    optionsLF->setResults(LineBreakStream);
     293    mPipeline->CreateKernelCall<ICGrepKernel>(std::move(optionsLF));
     294
     295    std::unique_ptr<GrepKernelOptions> options = make_unique<GrepKernelOptions>();
     296    options->addAlphabet(mpx, uncompressedCharClasses);
     297    options->setSource(fakeMatchCopiedBits);
     298    options->setNumbering(BitNumbering::BigEndian);
     299    options->addExternal("UTF8_nonfinal", u8NoFinalStream);
     300    options->setRE(mRE);
     301    options->setResults(MatchResults);
     302    mPipeline->CreateKernelCall<ICGrepKernel>(std::move(options));
    286303
    287304    StreamSet * Matches = MatchResults;
     
    318335        mPipeline->CreateKernelCall<CharClassesKernel>(std::move(mpx_basis), uncompressedBasisBits, CharClasses, BitNumbering::BigEndian);
    319336
    320         Alphabets alphabets;
    321         alphabets.emplace_back(std::move(mpx), CharClasses);
    322         mPipeline->CreateKernelCall<ICGrepKernel>(mRE, uncompressedBasisBits, MatchResults, Externals{}, alphabets, BitNumbering::BigEndian, false);
     337        std::unique_ptr<GrepKernelOptions> options = make_unique<GrepKernelOptions>();
     338        options->addAlphabet(mpx, CharClasses);
     339        options->setSource(uncompressedBasisBits);
     340        options->setNumbering(BitNumbering::BigEndian);
     341        options->setRE(mRE);
     342        options->setResults(MatchResults);
     343        mPipeline->CreateKernelCall<ICGrepKernel>(std::move(options));
    323344
    324345
     
    330351            mRE = toUTF8(mRE);
    331352        }
    332         mPipeline->CreateKernelCall<ICGrepKernel>(mRE, uncompressedBasisBits, MatchResults, Externals{}, Alphabets{}, BitNumbering::BigEndian);
     353        std::unique_ptr<GrepKernelOptions> options = make_unique<GrepKernelOptions>();
     354        options->setSource(uncompressedBasisBits);
     355        options->setNumbering(BitNumbering::BigEndian);
     356        options->setRE(mRE);
     357        options->setResults(MatchResults);
     358        mPipeline->CreateKernelCall<ICGrepKernel>(std::move(options));
    333359    }
    334360
  • icGREP/icgrep-devel/icgrep/re/printer_re.cpp

    r6170 r6219  
    5555        retVal += re_name->getName();
    5656        retVal += "\" ";
    57         //if (re_name->getType() == Name::Type::Capture) {
     57        if (re_name->getType() == Name::Type::Capture) {
    5858            retVal += "=(" + PrintRE(re_name->getDefinition()) + ")";
    59         //}
     59        }
    6060    } else if (const Range* rg = dyn_cast<const Range>(re)) {
    6161        retVal = "Range (";
Note: See TracChangeset for help on using the changeset viewer.