Ignore:
Timestamp:
Oct 20, 2014, 10:49:33 AM (5 years ago)
Author:
nmedfort
Message:

Transitory check-in; initial integration of pablo Next nodes and enforcement of SSA form for all Assign nodes.

File:
1 edited

Legend:

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

    r4249 r4252  
    1616
    1717Call * PabloBlock::createCall(const std::string name) {
    18     return mUnary.findOrMake<Call>(PabloAST::ClassTypeId::Call, mSymbolGenerator[name]);
     18    return mUnary.findOrMake<Call>(PabloAST::ClassTypeId::Call, mSymbolGenerator.get(name));
    1919}
    2020
     
    2424
    2525Var * PabloBlock::createVar(const std::string name) {
    26     return mUnary.findOrMake<Var>(PabloAST::ClassTypeId::Var, mSymbolGenerator[name]);
     26    return mUnary.findOrMake<Var>(PabloAST::ClassTypeId::Var, mSymbolGenerator.get(name));
    2727}
    2828
    29 Var * PabloBlock::createVar(Assign * assign) {
    30     return mUnary.findOrMake<Var>(PabloAST::ClassTypeId::Var, const_cast<String *>(assign->mName));
     29Var * PabloBlock::createVar(String * name) {
     30    return mUnary.findOrMake<Var>(PabloAST::ClassTypeId::Var, name);
    3131}
    3232
    3333/// BINARY CREATE FUNCTIONS
     34
     35Next * PabloBlock::createNext(Assign * assign, PabloAST * expr) {
     36    Next * next = mBinary.findOrMake<Next>(PabloAST::ClassTypeId::Next, assign, expr);
     37    mStatements.push_back(next);
     38    return next;
     39}
     40
     41MatchStar * PabloBlock::createMatchStar(PabloAST * marker, PabloAST * charclass) {
     42    return mBinary.findOrMake<MatchStar>(PabloAST::ClassTypeId::MatchStar, marker, charclass);
     43}
     44
     45ScanThru * PabloBlock::createScanThru(PabloAST * from, PabloAST * thru) {
     46    return mBinary.findOrMake<ScanThru>(PabloAST::ClassTypeId::ScanThru, from, thru);
     47}
    3448
    3549PabloAST * PabloBlock::createAnd(PabloAST * expr1, PabloAST * expr2) {
     
    4054}
    4155
    42 Assign * PabloBlock::createAssign(const std::string name, PabloAST * expr) {
    43     auto key = std::make_tuple(PabloAST::ClassTypeId::Assign, expr);
    44     Assign * assign = cast_or_null<Assign>(mUnary.find(key));
    45     if (assign == nullptr) {
    46         assign = new Assign(mSymbolGenerator[name], expr);
    47         mUnary.insert(std::move(key), assign);
    48     }
    49     else {
    50         assign = new Assign(mSymbolGenerator[name], createVar(assign));
    51     }
    52 //    Assign * assign = mBinary.findOrMake<Assign>(PabloAST::ClassTypeId::Assign, mSymbolGenerator[name], expr);
    53     mStatements.push_back(assign);
    54     return assign;
    55 }
    56 
    57 MatchStar * PabloBlock::createMatchStar(PabloAST * expr1, PabloAST * expr2) {
    58     return mBinary.findOrMake<MatchStar>(PabloAST::ClassTypeId::MatchStar, expr1, expr2);
    59 }
    60 
    6156PabloAST * PabloBlock::createOr(PabloAST * expr1, PabloAST * expr2) {
    6257    if (expr1 < expr2) {
     
    6459    }
    6560    return mBinary.findOrCall<OptimizeOr>(PabloAST::ClassTypeId::Or, expr1, expr2);
    66 }
    67 
    68 ScanThru * PabloBlock::createScanThru(PabloAST * from, PabloAST * thru) {
    69     return mBinary.findOrMake<ScanThru>(PabloAST::ClassTypeId::ScanThru, from, thru);
    7061}
    7162
Note: See TracChangeset for help on using the changeset viewer.