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/codegenstate.h

    r5267 r5283  
    6868    }
    6969
    70     Advance * createAdvance(PabloAST * expr, PabloAST * shiftAmount, const std::string & prefix) {
     70    Advance * createAdvance(PabloAST * expr, PabloAST * shiftAmount, const llvm::StringRef & prefix) {
    7171        return createAdvance(expr, shiftAmount, makeName(prefix));
    7272    }
     
    7878    }
    7979
    80     Lookahead * createLookahead(PabloAST * expr, PabloAST * shiftAmount, const std::string & prefix) {
     80    Lookahead * createLookahead(PabloAST * expr, PabloAST * shiftAmount, const llvm::StringRef & prefix) {
    8181        return createLookahead(expr, shiftAmount, makeName(prefix));
    8282    }
     
    9696    }
    9797
    98     Not * createNot(PabloAST * expr, const std::string & prefix) {
     98    Not * createNot(PabloAST * expr, const llvm::StringRef & prefix) {
    9999        return createNot(expr, makeName(prefix));
    100100    }
     
    102102    Not * createNot(PabloAST * expr, String * name);
    103103
    104     inline Var * createVar(const std::string & name, llvm::Type * const type = nullptr) {
     104    inline Var * createVar(const llvm::StringRef & name, llvm::Type * const type = nullptr) {
    105105        return createVar(makeName(name), type);
    106106    }
     
    112112    Count * createCount(PabloAST * expr);
    113113
    114     Count * createCount(PabloAST * expr, const std::string & prefix);
     114    Count * createCount(PabloAST * expr, const llvm::StringRef & prefix);
    115115
    116116    InFile * createInFile(PabloAST * expr) {
     
    118118    }
    119119
    120     InFile * createInFile(PabloAST * expr, const std::string & prefix) {
     120    InFile * createInFile(PabloAST * expr, const llvm::StringRef & prefix) {
    121121        return createInFile(expr, makeName(prefix));
    122122    }
     
    128128    }
    129129
    130     AtEOF * createAtEOF(PabloAST * expr, const std::string & prefix) {
     130    AtEOF * createAtEOF(PabloAST * expr, const llvm::StringRef & prefix) {
    131131        return createAtEOF(expr, makeName(prefix));
    132132    }
     
    138138    }
    139139
    140     Extract * createExtract(PabloAST * array, PabloAST * index, const std::string & prefix) {
     140    Extract * createExtract(PabloAST * array, PabloAST * index, const llvm::StringRef & prefix) {
    141141        return createExtract(array, index, makeName(prefix));
    142142    }
     
    146146    }
    147147
    148     Extract * createExtract(PabloAST * array, const int64_t index, const std::string & prefix) {
     148    Extract * createExtract(PabloAST * array, const int64_t index, const llvm::StringRef & prefix) {
    149149        return createExtract(array, getInteger(index), makeName(prefix));
    150150    }
     
    158158    }
    159159
    160     And * createAnd(PabloAST * expr1, PabloAST * expr2, const std::string & prefix) {
     160    And * createAnd(PabloAST * expr1, PabloAST * expr2, const llvm::StringRef & prefix) {
    161161        return createAnd(expr1, expr2, makeName(prefix));
    162162    }
     
    174174    }
    175175
    176     Or * createOr(PabloAST * expr1, PabloAST * expr2, const std::string & prefix) {
     176    Or * createOr(PabloAST * expr1, PabloAST * expr2, const llvm::StringRef & prefix) {
    177177        return createOr(expr1, expr2, makeName(prefix));
    178178    }
     
    190190    }
    191191
    192     Xor * createXor(PabloAST * expr1, PabloAST * expr2, const std::string & prefix) {
     192    Xor * createXor(PabloAST * expr1, PabloAST * expr2, const llvm::StringRef & prefix) {
    193193        return createXor(expr1, expr2, makeName(prefix));
    194194    }
     
    206206    }
    207207
    208     Sel * createSel(PabloAST * condition, PabloAST * trueExpr, PabloAST * falseExpr, const std::string & prefix) {
     208    Sel * createSel(PabloAST * condition, PabloAST * trueExpr, PabloAST * falseExpr, const llvm::StringRef & prefix) {
    209209        return createSel(condition, trueExpr, falseExpr, makeName(prefix));
    210210    }
     
    222222    }
    223223
    224     MatchStar * createMatchStar(PabloAST * marker, PabloAST * charclass, const std::string & prefix) {
     224    MatchStar * createMatchStar(PabloAST * marker, PabloAST * charclass, const llvm::StringRef & prefix) {
    225225        return createMatchStar(marker, charclass, makeName(prefix));
    226226    }
     
    232232    }
    233233
    234     ScanThru * createScanThru(PabloAST * from, PabloAST * thru, const std::string & prefix) {
     234    ScanThru * createScanThru(PabloAST * from, PabloAST * thru, const llvm::StringRef & prefix) {
    235235        return createScanThru(from, thru, makeName(prefix));
    236236    }
     
    276276    }
    277277
    278     inline String * getName(const std::string & name) const {
     278    inline String * getName(const llvm::StringRef & name) const {
    279279        return mParent->getName(name);
    280280    }
    281281
    282     inline String * makeName(const std::string & prefix) const {
     282    inline String * makeName(const llvm::StringRef & prefix) const {
    283283        return mParent->makeName(prefix);
    284284    }
     
    295295
    296296    explicit PabloBlock(PabloKernel * const parent, Allocator & allocator) noexcept
    297     : PabloAST(PabloAST::ClassTypeId::Block, nullptr, nullptr, allocator)
     297    : PabloAST(PabloAST::ClassTypeId::Block, nullptr, allocator)
    298298    , mParent(parent)
    299299    , mBranch(nullptr)
Note: See TracChangeset for help on using the changeset viewer.