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

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

File:
1 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
Note: See TracChangeset for help on using the changeset viewer.