Ignore:
Timestamp:
Jan 27, 2017, 2:22:06 PM (2 years ago)
Author:
nmedfort
Message:

Optimized Symbol Generation (and fixed potential bug that could allow duplicate names being constructed); made PabloKernel? extend PabloAST (temporarily removed PabloAST::getName() to avoid diamond problem); added an internal scalar to PabloKernel? struct for each Count to avoid InOut? output scalar variable problem; allowed CodeMotionPass? to move code within the same scope but across a branch statement. Began work on separating Kernels into either Block-Oriented or Segment-Oriented kernels.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/pablo/builder.cpp

    r5267 r5283  
    3737        return mPb->NAME(arg, mPrefix); \
    3838    } \
    39     inline __##NAME(PabloBlock * pb, const std::string & prefix) : mPb(pb), mPrefix(prefix) {} \
    40 private: \
    41     PabloBlock * mPb; \
    42     const std::string & mPrefix; \
     39    inline __##NAME(PabloBlock * pb, const llvm::StringRef & prefix) : mPb(pb), mPrefix(prefix) {} \
     40private: \
     41    PabloBlock * mPb; \
     42    const llvm::StringRef & mPrefix; \
    4343}; \
    4444__##NAME functor(mPb, prefix); \
     
    6262        return mPb->NAME(arg1, arg2, mPrefix); \
    6363    } \
    64     inline __##NAME(PabloBlock * pb, const std::string & prefix) : mPb(pb), mPrefix(prefix) {} \
    65 private: \
    66     PabloBlock * mPb; \
    67     const std::string & mPrefix; \
     64    inline __##NAME(PabloBlock * pb, const llvm::StringRef & prefix) : mPb(pb), mPrefix(prefix) {} \
     65private: \
     66    PabloBlock * mPb; \
     67    const llvm::StringRef & mPrefix; \
    6868}; \
    6969__##NAME functor(mPb, PREFIX); \
     
    8787        return mPb->NAME(arg1, arg2, arg3, mPrefix); \
    8888    } \
    89     inline __##NAME(PabloBlock * pb, const std::string & prefix) : mPb(pb), mPrefix(prefix) {} \
    90 private: \
    91     PabloBlock * mPb; \
    92     const std::string & mPrefix; \
     89    inline __##NAME(PabloBlock * pb, const llvm::StringRef & prefix) : mPb(pb), mPrefix(prefix) {} \
     90private: \
     91    PabloBlock * mPb; \
     92    const llvm::StringRef & mPrefix; \
    9393}; \
    9494__##NAME functor(mPb, PREFIX); \
     
    125125}
    126126
    127 PabloAST * PabloBuilder::createAdvance(PabloAST * expr, PabloAST * shiftAmount, const std::string & prefix) {
     127PabloAST * PabloBuilder::createAdvance(PabloAST * expr, PabloAST * shiftAmount, const llvm::StringRef & prefix) {
    128128    if (isa<Zeroes>(expr) || cast<Integer>(shiftAmount)->value() == 0) {
    129129        return expr;
     
    138138}
    139139
    140 Extract * PabloBuilder::createExtract(PabloAST * value, not_null<PabloAST *> index, const std::string & prefix) {
     140Extract * PabloBuilder::createExtract(PabloAST * value, not_null<PabloAST *> index, const llvm::StringRef & prefix) {
    141141    MAKE_NAMED_BINARY(createExtract, TypeId::Extract, prefix, value, index);
    142142    return cast<Extract>(result);
     
    151151}
    152152
    153 PabloAST * PabloBuilder::createLookahead(PabloAST * expr, PabloAST * shiftAmount, const std::string & prefix) {
     153PabloAST * PabloBuilder::createLookahead(PabloAST * expr, PabloAST * shiftAmount, const llvm::StringRef & prefix) {
    154154    if (isa<Zeroes>(expr) || cast<Integer>(shiftAmount)->value() == 0) {
    155155        return expr;
     
    173173}
    174174
    175 PabloAST * PabloBuilder::createNot(PabloAST * expr, const std::string & prefix) {
     175PabloAST * PabloBuilder::createNot(PabloAST * expr, const llvm::StringRef & prefix) {
    176176    if (isa<Ones>(expr)) {
    177177        return createZeroes(expr->getType());
     
    192192}
    193193
    194 PabloAST * PabloBuilder::createCount(PabloAST * expr, const std::string & prefix) {
     194PabloAST * PabloBuilder::createCount(PabloAST * expr, const llvm::StringRef & prefix) {
    195195    MAKE_NAMED_UNARY(createCount, TypeId::Count, prefix, expr);
    196196    return result;
     
    232232}
    233233
    234 PabloAST * PabloBuilder::createAnd(PabloAST * expr1, PabloAST * expr2, const std::string & prefix) {
     234PabloAST * PabloBuilder::createAnd(PabloAST * expr1, PabloAST * expr2, const llvm::StringRef & prefix) {
    235235    if (isa<Zeroes>(expr2) || isa<Ones>(expr1)) {
    236236        return expr2;
     
    310310}
    311311
    312 PabloAST * PabloBuilder::createOr(PabloAST * expr1, PabloAST * expr2, const std::string & prefix) {
     312PabloAST * PabloBuilder::createOr(PabloAST * expr1, PabloAST * expr2, const llvm::StringRef & prefix) {
    313313    if (isa<Zeroes>(expr1) || isa<Ones>(expr2)){
    314314        return expr2;
     
    380380}
    381381
    382 PabloAST * PabloBuilder::createXor(PabloAST * expr1, PabloAST * expr2, const std::string & prefix) {
     382PabloAST * PabloBuilder::createXor(PabloAST * expr1, PabloAST * expr2, const llvm::StringRef & prefix) {
    383383    if (expr1 == expr2) {
    384384        return createZeroes(expr1->getType());
     
    448448}
    449449
    450 PabloAST * PabloBuilder::createInFile(PabloAST * expr, const std::string & prefix) {
     450PabloAST * PabloBuilder::createInFile(PabloAST * expr, const llvm::StringRef & prefix) {
    451451    MAKE_NAMED_UNARY(createInFile, TypeId::InFile, prefix, expr);
    452452    return result;
     
    458458}
    459459
    460 PabloAST * PabloBuilder::createAtEOF(PabloAST * expr, const std::string & prefix) {
     460PabloAST * PabloBuilder::createAtEOF(PabloAST * expr, const llvm::StringRef & prefix) {
    461461    MAKE_NAMED_UNARY(createAtEOF, TypeId::AtEOF, prefix, expr);
    462462    return result;
     
    471471}
    472472
    473 PabloAST * PabloBuilder::createMatchStar(PabloAST * marker, PabloAST * charclass, const std::string & prefix) {
     473PabloAST * PabloBuilder::createMatchStar(PabloAST * marker, PabloAST * charclass, const llvm::StringRef & prefix) {
    474474    if (isa<Zeroes>(marker) || isa<Zeroes>(charclass)) {
    475475        return marker;
     
    487487}
    488488
    489 PabloAST * PabloBuilder::createScanThru(PabloAST * from, PabloAST * thru, const std::string & prefix) {
     489PabloAST * PabloBuilder::createScanThru(PabloAST * from, PabloAST * thru, const llvm::StringRef & prefix) {
    490490    if (isa<Zeroes>(from) || isa<Zeroes>(thru)) {
    491491        return from;
     
    520520}
    521521
    522 PabloAST * PabloBuilder::createSel(PabloAST * condition, PabloAST * trueExpr, PabloAST * falseExpr, const std::string & prefix) {
     522PabloAST * PabloBuilder::createSel(PabloAST * condition, PabloAST * trueExpr, PabloAST * falseExpr, const llvm::StringRef & prefix) {
    523523    if (isa<Ones>(condition)) {
    524524        return trueExpr;
Note: See TracChangeset for help on using the changeset viewer.