Ignore:
Timestamp:
May 6, 2017, 4:05:05 PM (2 years ago)
Author:
nmedfort
Message:

Continued refactoring work.

File:
1 edited

Legend:

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

    r5320 r5435  
    1515using namespace re;
    1616using namespace llvm;
     17
     18DirectCharacterClassKernelBuilder::DirectCharacterClassKernelBuilder(
     19        const std::unique_ptr<IDISA::IDISA_Builder> & b, std::string ccSetName, std::vector<re::CC *> charClasses, unsigned codeUnitSize)
     20: BlockOrientedKernel(std::move(ccSetName),
     21              {Binding{b->getStreamSetTy(1, 8 * codeUnitSize), "codeUnitStream"}},
     22              {Binding{b->getStreamSetTy(charClasses.size(), 1), "ccStream"}},
     23              {}, {}, {})
     24, mCharClasses(charClasses)
     25, mCodeUnitSize(codeUnitSize) {
     26
     27}
    1728
    1829void DirectCharacterClassKernelBuilder::generateDoBlockMethod() {
     
    6071
    6172ParabixCharacterClassKernelBuilder::ParabixCharacterClassKernelBuilder (
    62 IDISA::IDISA_Builder * iBuilder
    63 , std::string ccSetName
    64 , const std::vector<CC *> & charClasses
    65 , unsigned basisBitsCount)
    66 : PabloKernel(iBuilder, ccSetName +"_kernel", {Binding{iBuilder->getStreamSetTy(basisBitsCount), "basis"}}) {
     73        const std::unique_ptr<IDISA::IDISA_Builder> & b, std::string ccSetName, const std::vector<CC *> & charClasses, unsigned codeUnitSize)
     74: PabloKernel(b, ccSetName +"_kernel", {Binding{b->getStreamSetTy(codeUnitSize), "basis"}})
     75, mCharClasses(charClasses) {
     76    for (CC * cc : mCharClasses) {
     77        addOutput(cc->canonicalName(re::ByteClass), b->getStreamTy());
     78    }
     79}
     80
     81void ParabixCharacterClassKernelBuilder::prepareKernel() {
    6782    CC_Compiler ccc(this, getInput(0));
    6883    auto & builder = ccc.getBuilder();
    69     for (CC * cc : charClasses) {
    70         Var * const r = addOutput(cc->canonicalName(re::ByteClass), getStreamTy());
    71         builder.createAssign(r, ccc.compileCC("cc", cc, builder));
     84    for (unsigned i = 0; i < mCharClasses.size(); ++i) {
     85        builder.createAssign(getOutput(i), ccc.compileCC("cc", mCharClasses[i], builder));
    7286    }
    73 
     87    PabloKernel::prepareKernel();
    7488}
Note: See TracChangeset for help on using the changeset viewer.