Ignore:
Timestamp:
Jan 25, 2018, 2:03:09 PM (20 months ago)
Author:
cameron
Message:

CC Compiler refactoring step

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

Legend:

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

    r5842 r5843  
    111111void ParabixCharacterClassKernelBuilder::generatePabloMethod() {
    112112    PabloBuilder pb(getEntryScope());
    113     CC_Compiler ccc(this, getInput(0));
     113    cc::CC_Compiler ccc(this, getInputStreamSet("basis"));
    114114    for (unsigned i = 0; i < mCharClasses.size(); ++i) {
    115115        pb.createAssign(getOutput(i), ccc.compileCC("cc", mCharClasses[i], pb));
  • icGREP/icgrep-devel/icgrep/kernels/charclasses.cpp

    r5842 r5843  
    7575    PabloBuilder pb(getEntryScope());
    7676
    77     CC_Compiler ccc(this, getInput(0));
     77    CC_Compiler ccc(this, getInputStreamSet("basis"));
    7878    unsigned n = mCCs.size();
    7979
  • icGREP/icgrep-devel/icgrep/kernels/delmask_kernel.cpp

    r5842 r5843  
    2222    //  input: 8 basis bit streams
    2323   
    24     const auto u8bitSet = this->getInputStreamVar("u8bit");
    25     PabloAST * u8_bits[8];
    26     for (int i = 0; i < 8; ++i) {
    27         u8_bits[i] = main.createExtract(u8bitSet, main.getInteger(i));
    28     }
     24    std::vector<PabloAST *> u8_bits = getInputStreamSet("u8bit");
    2925    //  output: delmask stream + error stream
    3026   
    31     cc::CC_Compiler ccc(this, u8bitSet);
     27    cc::CC_Compiler ccc(this, u8_bits);
    3228   
    3329    Zeroes * zeroes = main.createZeroes();
  • icGREP/icgrep-devel/icgrep/kernels/grep_kernel.cpp

    r5842 r5843  
    4242void RequiredStreams_UTF8::generatePabloMethod() {
    4343    PabloBuilder pb(getEntryScope());
    44     cc::CC_Compiler ccc(this, getInput(0));
     44    cc::CC_Compiler ccc(this, getInputStreamSet("basis"));
    4545    Zeroes * const ZEROES = pb.createZeroes();
    4646    PabloAST * const u8pfx = ccc.compileCC(makeByte(0xC0, 0xFF));
     
    135135void RequiredStreams_UTF16::generatePabloMethod() {
    136136    PabloBuilder pb(getEntryScope());
    137     cc::CC_Compiler ccc(this, getInput(0));
     137    cc::CC_Compiler ccc(this, getInputStreamSet("basis"));
    138138   
    139139    PabloAST * u16hi_hi_surrogate = ccc.compileCC(makeCC(0xD800, 0xDBFF, &cc::UTF16));    //u16hi_hi_surrogate = [\xD8-\xDB]
     
    208208void ICGrepKernel::generatePabloMethod() {
    209209    PabloBuilder pb(getEntryScope());
    210     Var * const basis = getInputStreamVar("basis");
    211     cc::CC_Compiler cc_compiler(this, basis);
     210    cc::CC_Compiler cc_compiler(this, getInputStreamSet("basis"));
    212211    RE_Compiler re_compiler(this, cc_compiler);
    213212    for (auto a : mAlphabets) {
    214         auto basis = getInputStreamVar(a->getName() + "_basis");
    215         re_compiler.addAlphabet(a, basis);
     213        auto mpx_basis = getInputStreamSet(a->getName() + "_basis");
     214        re_compiler.addAlphabet(a, mpx_basis);
    216215    }
    217216    PabloAST * const matches = re_compiler.compile(mRE);
  • icGREP/icgrep-devel/icgrep/kernels/linebreak_kernel.cpp

    r5842 r5843  
    4040    PabloAST * LF = compileCCfromCodeUnitStream(makeByte(0x0A), getInput(0), pb);
    4141    #else
    42     CC_Compiler ccc(this, getInput(0));
     42    cc::CC_Compiler ccc(this, getInputStreamSet("basis"));
    4343    PabloAST * LF = ccc.compileCC("LF", makeByte(0x0A), pb);
    4444    #endif
     
    5959void LineBreakKernelBuilder::generatePabloMethod() {
    6060    PabloBuilder pb(getEntryScope());
    61     CC_Compiler ccc(this, getInput(0));
     61    cc::CC_Compiler ccc(this, getInputStreamSet("basis"));
    6262
    6363    Integer * const ZERO = pb.getInteger(0);
  • icGREP/icgrep-devel/icgrep/kernels/streamset.h

    r5793 r5843  
    4646    }
    4747
     48    // Return the number of streams for a static stream set or 0 for an expandable stream set.
     49    unsigned getNumOfStreams () const {
     50        if (mBufferKind == BufferKind::ExpandableBuffer) return 0;
     51        size_t numStreams = 1;
     52        if (mBaseType->isArrayTy()) {
     53            numStreams = mBaseType->getArrayNumElements();
     54        }
     55        return numStreams;
     56    }
     57   
     58    unsigned getStreamFieldWidth () const {
     59        if (mBaseType->isArrayTy()) {
     60            return mBaseType->getArrayElementType()->getScalarSizeInBits();
     61        }
     62        return mBaseType->getScalarSizeInBits();
     63    }
     64   
    4865    unsigned getAddressSpace() const {
    4966        return mAddressSpace;
  • icGREP/icgrep-devel/icgrep/kernels/u8u32_kernel.cpp

    r5842 r5843  
    2222   
    2323    //  input: 8 basis bit streams
    24     const auto u8bitSet = this->getInputStreamVar("u8bit");
    25     PabloAST * u8_bits[8];
    26     for (int i = 0; i < 8; ++i) {
    27         u8_bits[i] = main.createExtract(u8bitSet, main.getInteger(i));
    28     }
     24    std::vector<PabloAST *> u8_bits = getInputStreamSet("u8bit");
    2925    //  output: 32 u8-indexed streams, + delmask stream + error stream
    3026   
    31     cc::CC_Compiler ccc(this, u8bitSet);
     27    cc::CC_Compiler ccc(this, u8_bits);
    3228   
    3329    Zeroes * zeroes = main.createZeroes();
Note: See TracChangeset for help on using the changeset viewer.