Ignore:
Timestamp:
Apr 18, 2017, 10:41:50 PM (2 years ago)
Author:
cameron
Message:

Factor out CountOnly? and InvertMatches? as separate kernels

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/re/re_compiler.cpp

    r5404 r5413  
    198198}
    199199
    200 void RE_Compiler::finalizeMatchResult(MarkerType match_result, bool InvertMatches) {
     200void RE_Compiler::finalizeMatchResult(MarkerType match_result) {
    201201    PabloAST * match_follow = mPB.createMatchStar(markerVar(match_result), mAny);
    202     if (InvertMatches) {
    203         match_follow = mPB.createNot(match_follow);
    204     }
    205     PabloAST * matches = mPB.createAnd(match_follow, mLineBreak, "matches");
    206     if (mCountOnly) {
    207         Var * const output = mKernel->getOutputScalarVar("matchedLineCount");
    208         PabloBuilder nestedCount = PabloBuilder::Create(mPB);
    209         mPB.createIf(matches, nestedCount);
    210         nestedCount.createAssign(output, nestedCount.createCount(matches));
    211     } else {
    212         Var * const output = mKernel->getOutputStreamVar("matches");
    213         mPB.createAssign(mPB.createExtract(output, mPB.getInteger(0)), matches);
    214     }
     202    PabloAST * matches = mPB.createAnd(match_follow, mLineBreak, "matchedLine3s");
     203    Var * const output = mKernel->getOutputStreamVar("matches");
     204    mPB.createAssign(mPB.createExtract(output, mPB.getInteger(0)), matches);
    215205}
    216206
     
    625615   
    626616
    627 RE_Compiler::RE_Compiler(PabloKernel * kernel, cc::CC_Compiler & ccCompiler, bool CountOnly)
     617RE_Compiler::RE_Compiler(PabloKernel * kernel, cc::CC_Compiler & ccCompiler)
    628618: mKernel(kernel)
    629 , mCountOnly(CountOnly)
    630619, mCCCompiler(ccCompiler)
    631620, mLineBreak(nullptr)
Note: See TracChangeset for help on using the changeset viewer.