Ignore:
Timestamp:
Nov 18, 2016, 1:46:55 PM (3 years ago)
Author:
nmedfort
Message:

Merged PabloFunction? and PabloKernel? classes. Updated projects where necessary.

Location:
icGREP/icgrep-devel/icgrep/cc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/cc/cc_compiler.cpp

    r5202 r5217  
    1818#include <pablo/codegenstate.h>
    1919#include <pablo/builder.hpp>
    20 #include <pablo/function.h>
     20#include <pablo/prototype.h>
     21#include <pablo/pablo_kernel.h>
    2122#include <stdexcept>
    2223
     
    2627namespace cc {
    2728
    28 CC_Compiler::CC_Compiler(PabloFunction & function, const unsigned encodingBits, const std::string prefix)
    29 : mBuilder(function.getEntryBlock())
     29CC_Compiler::CC_Compiler(PabloKernel * kernel, const unsigned encodingBits, const std::string prefix)
     30: mBuilder(kernel->getEntryBlock())
    3031, mBasisBit(encodingBits)
    3132, mEncodingBits(encodingBits) {
    3233
    3334    // TODO: basisBits should be defined prior and only retrieved here.
    34     Var * const basisBits = function.addParameter(prefix, getStreamTy(1, 8));
     35    Var * const basisBits = kernel->addInput(prefix, kernel->getStreamSetTy(encodingBits));
    3536    for (unsigned i = 0; i != mEncodingBits; i++) {
    3637        mBasisBit[i] = mBuilder.createExtract(basisBits, mBuilder.getInteger(i)); assert (mBasisBit[i]);
     
    224225}
    225226
    226 inline PabloAST *CC_Compiler::getBasisVar(const unsigned i) const {
     227inline PabloAST * CC_Compiler::getBasisVar(const unsigned i) const {
    227228    assert (i < mEncodingBits);
    228229    const unsigned index = mEncodingBits - i - 1; assert (index < mEncodingBits);
     
    230231    return mBasisBit[index];
    231232}
    232    
    233 PabloFunction * ParabixCharacterClassFunction(const std::string & name, const std::vector<CC *> & charClasses, const unsigned basisBitsCount) {
    234     PabloFunction * f = PabloFunction::Create(name + "_fn");
    235     CC_Compiler ccc(*f, basisBitsCount);
    236     PabloBuilder builder(f->getEntryBlock());
    237     for (CC * cc : charClasses) {
    238         Var * const r = f->addResult(cc->canonicalName(re::ByteClass), getStreamTy());
    239         builder.createAssign(r, ccc.charset_expr(cc, builder));
    240     }
    241     return f;
    242 }
    243233
    244234} // end of namespace cc
  • icGREP/icgrep-devel/icgrep/cc/cc_compiler.h

    r5202 r5217  
    1414
    1515namespace pablo {
    16     class PabloFunction;
     16    class PabloKernel;
    1717    class Var;
    1818}
     
    2323
    2424class CC_Compiler{
    25 
    26     friend pablo::PabloFunction * ParabixCharacterClassFunction(const std::string &, const std::vector<re::CC *> &, const unsigned);
    27 
     25    friend class ParabixCharacterClassKernelBuilder;
    2826public:
    2927
    3028    using Vars = std::vector<pablo::Var *>;
    3129
    32     CC_Compiler(pablo::PabloFunction & function, const unsigned encodingBits = 8, const std::string prefix = "basis");
     30    CC_Compiler(pablo::PabloKernel * kernel, const unsigned encodingBits = 8, const std::string prefix = "basis");
    3331
    3432    pablo::PabloAST * compileCC(const re::CC *cc);
    3533
    36     pablo::PabloAST *compileCC(const re::CC *cc, pablo::PabloBlock & block);
     34    pablo::PabloAST * compileCC(const re::CC *cc, pablo::PabloBlock & block);
    3735
    3836    pablo::PabloAST * compileCC(const re::CC *cc, pablo::PabloBuilder & builder);
     
    9189}
    9290
    93 pablo::PabloFunction * ParabixCharacterClassFunction(const std::string & name, const std::vector<re::CC *> & charClasses, const unsigned basisBitsCount);
    94 
    9591}
    9692
Note: See TracChangeset for help on using the changeset viewer.