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

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

Location:
icGREP/icgrep-devel/icgrep/re
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/re/re_compiler.cpp

    r5204 r5217  
    2323#include <re/printer_re.h>
    2424#include <pablo/codegenstate.h>
     25#include <pablo/pablo_kernel.h>
    2526#include <UCD/ucd_compiler.hpp>
    2627#include <UCD/resolve_properties.h>
     
    235236    PabloAST * matches = mPB.createAnd(match_follow, mLineBreak, "matches");
    236237    if (mCountOnly) {
    237         Var * const output = mFunction.addResult("matchedLineCount", getScalarTy());
     238        Var * const output = mKernel->addOutput("matchedLineCount", mKernel->getSizeTy());
    238239        PabloBuilder nestedCount = PabloBuilder::Create(mPB);
    239240        mPB.createIf(matches, nestedCount);
    240241        nestedCount.createAssign(output, nestedCount.createCount(matches));
    241242    } else {
    242         Var * const output = mFunction.addResult("output", getStreamTy(1, 2));
     243        Var * const output = mKernel->addOutput("output", mKernel->getStreamSetTy(2));
    243244        mPB.createAssign(mPB.createExtract(output, mPB.getInteger(0)), matches);
    244245        mPB.createAssign(mPB.createExtract(output, mPB.getInteger(1)), mLineBreak);
     
    629630}
    630631
    631 RE_Compiler::RE_Compiler(pablo::PabloFunction & function, cc::CC_Compiler & ccCompiler, bool CountOnly)
    632 : mCountOnly(CountOnly)
     632RE_Compiler::RE_Compiler(PabloKernel * kernel, cc::CC_Compiler & ccCompiler, bool CountOnly)
     633: mKernel(kernel)
     634, mCountOnly(CountOnly)
    633635, mCCCompiler(ccCompiler)
    634636, mLineBreak(nullptr)
     
    641643, mWhileTest(nullptr)
    642644, mStarDepth(0)
    643 , mPB(ccCompiler.getBuilder())
    644 , mFunction(function) {
     645, mPB(ccCompiler.getBuilder()) {
    645646
    646647}
  • icGREP/icgrep-devel/icgrep/re/re_compiler.h

    r5202 r5217  
    5252public:
    5353
    54     RE_Compiler(pablo::PabloFunction & function, cc::CC_Compiler & ccCompiler, bool CountOnly = false);
     54    RE_Compiler(pablo::PabloKernel * kernel, cc::CC_Compiler & ccCompiler, bool CountOnly = false);
    5555    void initializeRequiredStreams(const unsigned encodingBits);
    5656    void compileUnicodeNames(RE *& re);
     
    9393private:
    9494
     95    pablo::PabloKernel * const                      mKernel;
    9596    bool                                            mCountOnly;
    9697    cc::CC_Compiler &                               mCCCompiler;
     
    106107    pablo::PabloBuilder &                           mPB;
    107108    std::unordered_map<Name *, MarkerType>          mCompiledName;
    108     pablo::PabloFunction &                          mFunction;
     109
    109110};
    110111
  • icGREP/icgrep-devel/icgrep/re/re_toolchain.cpp

    r5202 r5217  
    1818#include <utf8_encoder.h>
    1919#include <cc/cc_compiler.h>
    20 #include <pablo/function.h>
     20#include <pablo/prototype.h>
     21#include <pablo/pablo_kernel.h>
    2122#include <re/printer_re.h>
    2223#include <llvm/Support/CommandLine.h>
     
    9596}
    9697   
    97 PabloFunction * re2pablo_compiler(const unsigned encodingBits, RE * re_ast, const bool CountOnly) {
    98     PabloFunction * function = PabloFunction::Create("process_block");
    99     cc::CC_Compiler cc_compiler(*function, encodingBits);
    100     re::RE_Compiler re_compiler(*function, cc_compiler, CountOnly);
     98void re2pablo_compiler(PabloKernel * kernel, const unsigned encodingBits, RE * re_ast, const bool CountOnly) {
     99    cc::CC_Compiler cc_compiler(kernel, encodingBits);
     100    re::RE_Compiler re_compiler(kernel, cc_compiler, CountOnly);
    101101    re_compiler.initializeRequiredStreams(encodingBits);
    102102    re_compiler.compileUnicodeNames(re_ast);
    103103    re_compiler.finalizeMatchResult(re_compiler.compile(re_ast), AlgorithmOptions.isSet(InvertMatches));
    104     return function;
    105104}
    106105
  • icGREP/icgrep-devel/icgrep/re/re_toolchain.h

    r5202 r5217  
    88#define RE_TOOLCHAIN_H
    99
    10 #include <re/re_re.h>
    11 #include <pablo/function.h>
    1210#include <llvm/Support/CommandLine.h>
    1311
     12namespace pablo {
     13    class PabloKernel;
     14}
     15
    1416namespace re {
     17
     18class RE;
    1519
    1620enum RE_PrintFlags {
     
    2731extern int IfInsertionGap;
    2832
    29 const cl::OptionCategory * re_toolchain_flags();
     33const llvm::cl::OptionCategory * re_toolchain_flags();
    3034
    3135RE * regular_expression_passes(RE * re_ast);
    3236
    33 pablo::PabloFunction * re2pablo_compiler(const unsigned encodingBits, RE * re_ast, const bool CountOnly = false);
     37void re2pablo_compiler(pablo::PabloKernel * kernel, const unsigned encodingBits, RE * re_ast, const bool CountOnly = false);
    3438   
    3539}
Note: See TracChangeset for help on using the changeset viewer.