Ignore:
Timestamp:
Jul 5, 2017, 10:34:41 AM (2 years ago)
Author:
cameron
Message:

Decouple finalizeMatchResults, creating separate MatchedLinesKernel?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/kernels/grep_kernel.cpp

    r5491 r5548  
    1111#include <kernels/kernel_builder.h>
    1212#include <pablo/builder.hpp>
     13#include <pablo/boolean.h>
    1314#include <pablo/pe_count.h>
     15#include <pablo/pe_matchstar.h>
    1416
    1517#include <llvm/Support/raw_ostream.h>
     
    5456}
    5557
     58void MatchedLinesKernel::generatePabloMethod() {
     59    auto pb = this->getEntryBlock();
     60    PabloAST * matchResults = pb->createExtract(getInputStreamVar("matchResults"), pb->getInteger(0));
     61    PabloAST * lineBreaks = pb->createExtract(getInputStreamVar("lineBreaks"), pb->getInteger(0));
     62    PabloAST * notLB = pb->createNot(lineBreaks);
     63    PabloAST * match_follow = pb->createMatchStar(matchResults, notLB);
     64    Var * const matchedLines = getOutputStreamVar("matchedLines");
     65    pb->createAssign(pb->createExtract(matchedLines, pb->getInteger(0)), pb->createAnd(match_follow, lineBreaks));
     66}
     67
     68MatchedLinesKernel::MatchedLinesKernel (const std::unique_ptr<kernel::KernelBuilder> & iBuilder)
     69: PabloKernel(iBuilder, "MatchedLines",
     70              {Binding{iBuilder->getStreamSetTy(1), "matchResults"}, Binding{iBuilder->getStreamSetTy(1), "lineBreaks"}},
     71              {Binding{iBuilder->getStreamSetTy(1), "matchedLines"}},
     72              {},
     73              {}) {
     74}
     75
     76
    5677void InvertMatchesKernel::generateDoBlockMethod(const std::unique_ptr<KernelBuilder> & iBuilder) {
    5778    Value * input = iBuilder->loadInputStreamBlock("matchedLines", iBuilder->getInt32(0));
     
    7495}
    7596
    76 
    7797PopcountKernel::PopcountKernel (const std::unique_ptr<kernel::KernelBuilder> & iBuilder)
    7898: PabloKernel(iBuilder, "Popcount",
     
    81101              {},
    82102              {Binding{iBuilder->getSizeTy(), "countResult"}}) {
    83    
    84103}
    85104
Note: See TracChangeset for help on using the changeset viewer.