Ignore:
Timestamp:
Jan 21, 2018, 6:57:46 AM (20 months ago)
Author:
cameron
Message:

Decoupling PabloKernels? from CC_compiler

Location:
icGREP/icgrep-devel/icgrep/kernels
Files:
6 edited

Legend:

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

    r5828 r5842  
    110110
    111111void ParabixCharacterClassKernelBuilder::generatePabloMethod() {
     112    PabloBuilder pb(getEntryScope());
    112113    CC_Compiler ccc(this, getInput(0));
    113     auto & builder = ccc.getBuilder();
    114114    for (unsigned i = 0; i < mCharClasses.size(); ++i) {
    115         builder.createAssign(getOutput(i), ccc.compileCC("cc", mCharClasses[i], builder));
     115        pb.createAssign(getOutput(i), ccc.compileCC("cc", mCharClasses[i], pb));
    116116    }
    117117}
  • icGREP/icgrep-devel/icgrep/kernels/charclasses.cpp

    r5805 r5842  
    7373
    7474void CharClassesKernel::generatePabloMethod() {
     75    PabloBuilder pb(getEntryScope());
     76
    7577    CC_Compiler ccc(this, getInput(0));
    76     auto & pb = ccc.getBuilder();
    7778    unsigned n = mCCs.size();
    7879
  • icGREP/icgrep-devel/icgrep/kernels/delmask_kernel.cpp

    r5836 r5842  
    1919
    2020void DelMaskKernelBuilder::generatePabloMethod() {
     21    PabloBuilder main(getEntryScope());
    2122    //  input: 8 basis bit streams
    2223   
    2324    const auto u8bitSet = this->getInputStreamVar("u8bit");
    24    
     25    PabloAST * u8_bits[8];
     26    for (int i = 0; i < 8; ++i) {
     27        u8_bits[i] = main.createExtract(u8bitSet, main.getInteger(i));
     28    }
    2529    //  output: delmask stream + error stream
    2630   
    2731    cc::CC_Compiler ccc(this, u8bitSet);
    2832   
    29     PabloBuilder & main = ccc.getBuilder();
    30     const auto u8_bits = ccc.getBasisBits();
    3133    Zeroes * zeroes = main.createZeroes();
    3234
  • icGREP/icgrep-devel/icgrep/kernels/grep_kernel.cpp

    r5836 r5842  
    4141
    4242void RequiredStreams_UTF8::generatePabloMethod() {
    43    
     43    PabloBuilder pb(getEntryScope());
    4444    cc::CC_Compiler ccc(this, getInput(0));
    45     auto & pb = ccc.getBuilder();
    4645    Zeroes * const ZEROES = pb.createZeroes();
    4746    PabloAST * const u8pfx = ccc.compileCC(makeByte(0xC0, 0xFF));
     
    135134
    136135void RequiredStreams_UTF16::generatePabloMethod() {
    137    
     136    PabloBuilder pb(getEntryScope());
    138137    cc::CC_Compiler ccc(this, getInput(0));
    139     auto & pb = ccc.getBuilder();
    140138   
    141139    PabloAST * u16hi_hi_surrogate = ccc.compileCC(makeCC(0xD800, 0xDBFF, &cc::UTF16));    //u16hi_hi_surrogate = [\xD8-\xDB]
     
    209207
    210208void ICGrepKernel::generatePabloMethod() {
     209    PabloBuilder pb(getEntryScope());
    211210    Var * const basis = getInputStreamVar("basis");
    212211    cc::CC_Compiler cc_compiler(this, basis);
     
    217216    }
    218217    PabloAST * const matches = re_compiler.compile(mRE);
    219     PabloBlock * const pb = getEntryScope();
    220218    Var * const output = getOutputStreamVar("matches");
    221     pb->createAssign(pb->createExtract(output, pb->getInteger(0)), matches);
     219    pb.createAssign(pb.createExtract(output, pb.getInteger(0)), matches);
    222220}
    223221
    224222void MatchedLinesKernel::generatePabloMethod() {
    225     auto pb = this->getEntryScope();
    226     PabloAST * matchResults = pb->createExtract(getInputStreamVar("matchResults"), pb->getInteger(0));
    227     PabloAST * lineBreaks = pb->createExtract(getInputStreamVar("lineBreaks"), pb->getInteger(0));
    228     PabloAST * notLB = pb->createNot(lineBreaks);
    229     PabloAST * match_follow = pb->createMatchStar(matchResults, notLB);
     223    PabloBuilder pb(getEntryScope());
     224    PabloAST * matchResults = pb.createExtract(getInputStreamVar("matchResults"), pb.getInteger(0));
     225    PabloAST * lineBreaks = pb.createExtract(getInputStreamVar("lineBreaks"), pb.getInteger(0));
     226    PabloAST * notLB = pb.createNot(lineBreaks);
     227    PabloAST * match_follow = pb.createMatchStar(matchResults, notLB);
    230228    Var * const matchedLines = getOutputStreamVar("matchedLines");
    231     pb->createAssign(pb->createExtract(matchedLines, pb->getInteger(0)), pb->createAnd(match_follow, lineBreaks));
     229    pb.createAssign(pb.createExtract(matchedLines, pb.getInteger(0)), pb.createAnd(match_follow, lineBreaks));
    232230}
    233231
  • icGREP/icgrep-devel/icgrep/kernels/linebreak_kernel.cpp

    r5836 r5842  
    3636
    3737void LineFeedKernelBuilder::generatePabloMethod() {
     38    PabloBuilder pb(getEntryScope());
    3839    #ifdef USE_DIRECT_LF_BUILDER
    39     PabloBuilder pb(getEntryScope());
    4040    PabloAST * LF = compileCCfromCodeUnitStream(makeByte(0x0A), getInput(0), pb);
    4141    #else
    4242    CC_Compiler ccc(this, getInput(0));
    43     auto & pb = ccc.getBuilder();
    4443    PabloAST * LF = ccc.compileCC("LF", makeByte(0x0A), pb);
    4544    #endif
     
    5958
    6059void LineBreakKernelBuilder::generatePabloMethod() {
     60    PabloBuilder pb(getEntryScope());
    6161    CC_Compiler ccc(this, getInput(0));
    62     auto & pb = ccc.getBuilder();
    6362
    6463    Integer * const ZERO = pb.getInteger(0);
  • icGREP/icgrep-devel/icgrep/kernels/u8u32_kernel.cpp

    r5836 r5842  
    1919
    2020void U8U32KernelBuilder::generatePabloMethod() {
     21    PabloBuilder main(getEntryScope());
     22   
    2123    //  input: 8 basis bit streams
    22    
    2324    const auto u8bitSet = this->getInputStreamVar("u8bit");
    24    
     25    PabloAST * u8_bits[8];
     26    for (int i = 0; i < 8; ++i) {
     27        u8_bits[i] = main.createExtract(u8bitSet, main.getInteger(i));
     28    }
    2529    //  output: 32 u8-indexed streams, + delmask stream + error stream
    2630   
    2731    cc::CC_Compiler ccc(this, u8bitSet);
    28    
    29     PabloBuilder & main = ccc.getBuilder();
    30     const auto u8_bits = ccc.getBasisBits();
    3132   
    3233    Zeroes * zeroes = main.createZeroes();
Note: See TracChangeset for help on using the changeset viewer.