Changeset 4215


Ignore:
Timestamp:
Oct 5, 2014, 10:30:15 PM (5 years ago)
Author:
nmedfort
Message:

Removed string based CC lookup in CC Compiler.

Location:
icGREP/icgrep-devel/icgrep
Files:
27 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/cc/cc_compiler.cpp

    r4214 r4215  
    3333CC_Compiler::CC_Compiler(CodeGenState & cg, const Encoding encoding, const std::string basis_pattern, const std::string gensym_pattern)
    3434: mCG(cg)
     35, mBasisBit(encoding.getBits())
    3536, mEncoding(encoding)
    3637, mGenSymPattern(gensym_pattern)
    3738, mBasisPattern(basis_pattern)
    3839{
    39     for (int i = 0; i < mEncoding.getBits(); i++)
    40     {
    41         Var * basisVar = getBasisVar(i);
    42         Expression* expr = new Expression();
    43         expr->expr_string  =  basisVar->getName();
    44         expr->pablo_expr = basisVar;
    45         mCommon_Expression_Map.insert(make_pair(basisVar->getName(), expr));
    46     }
     40    for (int i = 0; i < mEncoding.getBits(); i++) {
     41        mBasisBit[i] = mCG.createVar(mBasisPattern + std::to_string((mEncoding.getBits() - 1) - i));
     42        mCG.push_back(mBasisBit[i]);
     43    }
     44}
     45
     46inline Var * CC_Compiler::getBasisVar(const int i) const {
     47    return mBasisBit[i];
    4748}
    4849
     
    7576}
    7677
    77 Expression * CC_Compiler::add_assignment(std::string varname, Expression* expr)
    78 {   
    79     //Add the new mapping to the list of pablo statements:
    80     mCG.push_back(mCG.createAssign(varname, expr->pablo_expr));
    81 
    82     //Add the new mapping to the common expression map:
    83     std::string key_value = expr->expr_string;
    84     Expression* mapped_value = new Expression();
    85     mapped_value->expr_string = varname;
    86     mapped_value->pablo_expr = mCG.createVar(varname);
    87     return mCommon_Expression_Map.insert(std::make_pair(key_value, mapped_value)).first->second;
    88 }
    89 
    90 Expression * CC_Compiler::expr_to_variable(Expression * expr) {
    91     MapIterator itr = mCommon_Expression_Map.find(expr->expr_string);
    92     if (itr != mCommon_Expression_Map.end()) {
    93         return itr->second;
    94     }
    95     else {
    96         return add_assignment(mCG.ssa(mGenSymPattern), expr);
    97     }
    98 }
    99 
    10078void CC_Compiler::process_re(const RE * re) {
    10179    if (const Alt * alt = dyn_cast<const Alt>(re)) {
     
    11795}
    11896
    119 void CC_Compiler::process(const CC * cc)
    120 {
    121     add_assignment(cc->getName(), expr2pabloe(charset_expr(cc)));
    122 }
    123 
     97inline void CC_Compiler::process(const CC * cc) {
     98    if (mComputedSet.insert(cc->getName()).second) {
     99        //Add the new mapping to the list of pablo statements:
     100        mCG.push_back(mCG.createAssign(cc->getName(), charset_expr(cc)));
     101    }
     102}
    124103
    125104PabloE* CC_Compiler::bit_pattern_expr(int pattern, int selected_bits)
     
    309288}
    310289
    311 Expression* CC_Compiler::expr2pabloe(PabloE* expr) {
    312     /*
    313       Translate a Pablo Expression into three-address code using
    314       the code generator object CC_CodeGenObject.
    315     */
    316 
    317     Expression* retExpr = new Expression();
    318 
    319     if (All * all = dyn_cast<All>(expr))
    320     {
    321         if (all->getValue() == 1)
    322         {
    323             retExpr->expr_string = "All(1)";
    324         }
    325         else if (all->getValue() == 0)
    326         {
    327             retExpr->expr_string = "All(0)";
    328         }
    329     }
    330     else if (Var * var = dyn_cast<Var>(expr))
    331     {
    332             retExpr->expr_string = var->getName();
    333     }
    334     else if (Not * pe_not = dyn_cast<Not>(expr))
    335     {
    336         Expression* ret = expr_to_variable(expr2pabloe(pe_not->getExpr()));
    337         retExpr->expr_string =  "~" + ret->expr_string;
    338     }
    339     else if(Or * pe_or = dyn_cast<Or>(expr))
    340     {
    341         Expression* ret1 = expr_to_variable(expr2pabloe(pe_or->getExpr1()));
    342         Expression* ret2 = expr_to_variable(expr2pabloe(pe_or->getExpr2()));
    343         retExpr->expr_string = "(" + ret1->expr_string + "|" + ret2->expr_string + ")";
    344     }
    345     else if (Xor * pe_xor = dyn_cast<Xor>(expr))
    346     {
    347         Expression* ret1 = expr_to_variable(expr2pabloe(pe_xor->getExpr1()));
    348         Expression* ret2 = expr_to_variable(expr2pabloe(pe_xor->getExpr2()));
    349         retExpr->expr_string = "(" + ret1->expr_string + "^" + ret2->expr_string + ")";
    350     }
    351     else if (And * pe_and = dyn_cast<And>(expr))
    352     {
    353         if (Not * pe_not = dyn_cast<Not>(pe_and->getExpr1()))
    354         {
    355             Expression* ret1 = expr_to_variable(expr2pabloe(pe_not->getExpr()));
    356             Expression* ret2 = expr_to_variable(expr2pabloe(pe_and->getExpr2()));
    357             retExpr->expr_string = "(" + ret2->expr_string + "&~" + ret1->expr_string + ")";
    358         }
    359         else if (Not * pe_not = dyn_cast<Not>(pe_and->getExpr2()))
    360         {
    361             Expression* ret1 = expr_to_variable(expr2pabloe(pe_and->getExpr1()));
    362             Expression* ret2 = expr_to_variable(expr2pabloe(pe_not->getExpr()));
    363             retExpr->expr_string = "(" + ret1->expr_string  + "&~" + ret2->expr_string + ")";
    364         }
    365         else
    366         {
    367             Expression* ret1 = expr_to_variable(expr2pabloe(pe_and->getExpr1()));
    368             Expression* ret2 = expr_to_variable(expr2pabloe(pe_and->getExpr2()));
    369             retExpr->expr_string = "(" + ret1->expr_string + "&" + ret2->expr_string + ")";
    370         }
    371     }
    372     else if (Sel * pe_sel = dyn_cast<Sel>(expr))
    373     {
    374         Expression* ret_sel = expr_to_variable(expr2pabloe(pe_sel->getCondition()));
    375         Expression* ret_true = expr_to_variable(expr2pabloe(pe_sel->getTrueExpr()));
    376         Expression* ret_false = expr_to_variable(expr2pabloe(pe_sel->getFalseExpr()));
    377         retExpr->expr_string = "((" + ret_sel->expr_string + "&" + ret_true->expr_string + ")|(~("
    378             + ret_sel->expr_string + ")&" + ret_false->expr_string + ")";       
    379     }
    380     retExpr->pablo_expr = expr;
    381     return retExpr;
    382 }
    383 
    384 inline Var * CC_Compiler::getBasisVar(const int i) const {
    385     return mCG.createVar(mBasisPattern + std::to_string((mEncoding.getBits() - 1) - i));
    386 }
    387 
    388290} // end of namespace cc
  • icGREP/icgrep-devel/icgrep/cc/cc_compiler.h

    r4211 r4215  
    88#define CC_COMPILER_H
    99
    10 #include <string>
    11 #include <list>
    12 #include <map>
    1310#include "utf_encoding.h"
    1411#include <pablo/codegenstate.h>
    1512#include <pablo/pe_pabloe.h>
    1613#include <re/re_cc.h>
     14#include <string>
     15#include <set>
    1716
    1817namespace cc {
    1918
    20 struct Expression{
    21     std::string expr_string;
    22     pablo::PabloE * pablo_expr;
    23 };
    24 
    2519class CC_Compiler{
    26     typedef std::map<std::string, re::RE*>      REMap;
    27     typedef std::map<std::string, Expression*>  ExpressionMap;
    28     typedef ExpressionMap::iterator             MapIterator;
    29     typedef std::list<pablo::PabloE *>          List;
     20    typedef std::map<std::string, re::RE *> REMap;
     21    typedef std::set<std::string>           ComputedSet;
    3022public:
    3123
     
    4840    pablo::PabloE * char_or_range_expr(const re::CodePointType lo, const re::CodePointType hi);
    4941    pablo::PabloE * charset_expr(const re::CC *cc);
    50     Expression* expr2pabloe(pablo::PabloE * expr);
    5142    void process(const re::CC *cc);
    5243
    53     Expression * add(std::string key_value, Expression *mapped_value);
    54     Expression * add_assignment(std::string value, Expression* expr);
    55     Expression* expr_to_variable(Expression* cgo);
    56 
    5744    pablo::CodeGenState &       mCG;
     45    std::vector<pablo::Var *>   mBasisBit;
    5846    const Encoding              mEncoding;
    5947    const std::string           mGenSymPattern;
    6048    const std::string           mBasisPattern;
    61     ExpressionMap               mCommon_Expression_Map;
     49    ComputedSet                 mComputedSet;
    6250};
    6351
  • icGREP/icgrep-devel/icgrep/icgrep-devel.files

    r4209 r4215  
    184184pablo/codegenstate.cpp
    185185pablo/codegenstate.h
     186pablo/printer_pablos.cpp
     187pablo/printer_pablos.h
  • icGREP/icgrep-devel/icgrep/llvm_gen.cpp

    r4214 r4215  
    401401    mCarryQueueIdx = 0;
    402402    mCarryQueueSize += LLVM_Generator_Helper::CarryCount_PabloStatements(cg_state.expressions());
    403     /* The following may be needed if carry-generating operations are ever inserted
    404        by the character class compiler.
    405     mCarryQueueSize += LLVM_Generator_Helper::CarryCount_PabloStatements(cc_cgo_stmtsl);
    406     */
    407 
    408403    mBasicBlock = BasicBlock::Create(mMod->getContext(), "parabix_entry", mFunc_process_block,0);
    409404
     
    637632}
    638633
    639 void LLVM_Generator::DeclareCallFunctions(List stmts) {
     634void LLVM_Generator::DeclareCallFunctions(ExpressionList stmts) {
    640635    for (auto it = stmts.begin(); it != stmts.end(); ++it) {
    641636        DeclareCallFunctions_PabloS(*it);
     
    656651    else if (While * whl = dyn_cast<While>(stmt))
    657652    {
    658         DeclareCallFunctions_PabloE(whl->getExpr());
     653        DeclareCallFunctions_PabloE(whl->getCondition());
    659654        DeclareCallFunctions(whl->getPSList());
    660655    }
     
    870865}
    871866
    872 std::string LLVM_Generator::Generate_PabloStatements(List stmts) {
     867std::string LLVM_Generator::Generate_PabloStatements(ExpressionList stmts) {
    873868    std::string retVal = "";
    874869    for (auto it = stmts.begin(); it != stmts.end(); ++it) {
     
    955950        IRBuilder<> b_cond(whileCondBlock);
    956951
    957         Value* expression_marker_value = Generate_PabloE(whl->getExpr());
     952        Value* expression_marker_value = Generate_PabloE(whl->getCondition());
    958953        Value* int_tobool1 = genBitBlockAny(expression_marker_value);
    959954
  • icGREP/icgrep-devel/icgrep/llvm_gen.h

    r4210 r4215  
    8888
    8989class LLVM_Generator {
    90     typedef std::list<PabloE *> List;
    9190public:
    9291    LLVM_Generator(std::map<std::string, std::string> name_map, std::string basis_pattern, int bits);
     
    9796    void DefineTypes();
    9897    void DeclareFunctions();
    99     void DeclareCallFunctions(List stmts);
     98    void DeclareCallFunctions(ExpressionList stmts);
    10099    void DeclareCallFunctions_PabloS(PabloE* stmt);
    101100    void DeclareCallFunctions_PabloE(PabloE* expr);
     
    104103    void SetReturnMarker(std::string marker, int output_idx);
    105104    Value* GetMarker(std::string name);
    106     std::string Generate_PabloStatements(List stmts);
     105    std::string Generate_PabloStatements(ExpressionList stmts);
    107106    std::string Generate_PabloS(PabloE* stmt);
    108107    Value* Generate_PabloE(PabloE* expr);
  • icGREP/icgrep-devel/icgrep/llvm_gen_helper.cpp

    r4207 r4215  
    2727LLVM_Generator_Helper::LLVM_Generator_Helper(){}
    2828
    29 int LLVM_Generator_Helper::CarryCount_PabloStatements(std::list<PabloE *> stmts)
     29int LLVM_Generator_Helper::CarryCount_PabloStatements(const ExpressionList & stmts)
    3030{
    3131    int retVal = 0;
     
    5656    else if (While* whl = dyn_cast<While>(stmt))
    5757    {
    58         retVal = CarryCount_PabloE(whl->getExpr());
     58        retVal = CarryCount_PabloE(whl->getCondition());
    5959        retVal += CarryCount_PabloStatements(whl->getPSList());
    6060    }
  • icGREP/icgrep-devel/icgrep/llvm_gen_helper.h

    r4199 r4215  
    88#define LLVM_GENERATOR_HELPER_H
    99
    10 #include <list>
    11 
    12 namespace pablo {
    13 class PabloE;
    14 }
     10#include <pablo/pe_pabloe.h>
    1511
    1612class LLVM_Generator_Helper
    1713{
    1814public:
    19     static int CarryCount_PabloStatements(std::list<pablo::PabloE*> stmts);
     15    static int CarryCount_PabloStatements(const pablo::ExpressionList &stmts);
    2016private:
    2117    static int CarryCount_PabloS(pablo::PabloE* stmt);
  • icGREP/icgrep-devel/icgrep/pablo/codegenstate.h

    r4214 r4215  
    3939    CodeGenState(SymbolGenerator & symgen)
    4040    : mSymbolGenerator(symgen)
    41     , mAll{{makeAll(0), makeAll(1)}}
     41    , mAll{{new All(0), new All(1)}}
    4242    , mUnary(nullptr, this)
    4343    , mBinary(nullptr, this)
     
    9191    PabloE * createSel(PabloE * condition, PabloE * trueExpr, PabloE * falseExpr);
    9292
     93    inline If * createIf(PabloE * condition, ExpressionList statements) {
     94        return new If(condition, std::move(statements));
     95    }
     96
     97    inline While * createWhile(PabloE * cond, ExpressionList statements) {
     98        return new While(cond, std::move(statements));
     99    }
     100
    93101    template<typename... Args>
    94102    struct ExpressionMap {
     
    130138    private:
    131139
    132         inline PabloE * find(const Key & key) {
     140        inline PabloE * find(const Key & key) const {
    133141            // check this map to see if we have it
    134142            auto itr = mMap.find(key);
     
    163171    }
    164172
    165     inline const std::list<PabloE *> & expressions() const {
     173    inline const ExpressionList & expressions() const {
    166174        return mExpressions;
    167175    }
     
    173181    ExpressionMap<PabloE *, PabloE *>               mBinary;
    174182    ExpressionMap<PabloE *, PabloE *, PabloE *>     mTernary;
    175     std::list<PabloE *>                             mExpressions;
     183    ExpressionList                                  mExpressions;
    176184};
    177185
  • icGREP/icgrep-devel/icgrep/pablo/pe_advance.h

    r4214 r4215  
    3737};
    3838
    39 inline Advance * makeAdvance(PabloE * expr) {
    40     return new Advance(expr);
    41 }
    42 
    4339}
    4440
  • icGREP/icgrep-devel/icgrep/pablo/pe_all.h

    r4211 r4215  
    1313
    1414class All : public PabloE {
    15     friend All * makeAll(bool value);
    1615    friend struct CodeGenState;
    1716public:
     
    4544};
    4645
    47 inline All * makeAll(bool value) {
    48     return new All(value);
    49 }
    50 
    5146}
    5247
  • icGREP/icgrep-devel/icgrep/pablo/pe_and.h

    r4214 r4215  
    5252};
    5353
    54 inline PabloE * makeAnd(PabloE * expr1, PabloE * expr2, CodeGenState & cg) {
    55     OptimizeAnd run(cg);
    56     return run(expr1, expr2);
    57 }
    58 
    5954}
    6055
  • icGREP/icgrep-devel/icgrep/pablo/pe_call.h

    r4214 r4215  
    88
    99class Call : public PabloE {
    10     friend Call * makeCall(PabloE *);
    1110    friend struct CodeGenState;
    1211public:
     
    3130    const String * const mCallee;
    3231};
    33 inline Call * makeCall(PabloE * callee) {
    34     return new Call(callee);
    35 }
    3632}
    3733
  • icGREP/icgrep-devel/icgrep/pablo/pe_charclass.h

    r4214 r4215  
    1414
    1515class CharClass : public PabloE {
    16     friend CharClass * makeCharClass(const String *);
    1716    friend struct CodeGenState;
    1817public:
     
    3938};
    4039
    41 inline CharClass * makeCharClass(const String * cc) {
    42     return new CharClass(cc);
    43 }
    44 
    4540}
    4641
  • icGREP/icgrep-devel/icgrep/pablo/pe_matchstar.h

    r4214 r4215  
    1313
    1414class MatchStar : public PabloE {
    15     friend MatchStar * makeMatchStar(PabloE *, PabloE *);
    1615    friend struct CodeGenState;
    1716public:
     
    4342};
    4443
    45 inline MatchStar * makeMatchStar(PabloE * expr1, PabloE * expr2) {
    46     return new MatchStar(expr1, expr2);
    47 }
    48 
    4944}
    5045
  • icGREP/icgrep-devel/icgrep/pablo/pe_not.h

    r4214 r4215  
    3838    PabloE * const mExpr;
    3939};
     40
    4041struct OptimizeNot {
    4142    inline OptimizeNot(CodeGenState & cg) : cg(cg) {}
     
    4546
    4647};
    47 inline PabloE * makeNot(PabloE * expr, CodeGenState & cg) {
    48     OptimizeNot run(cg);
    49     return run(expr);
    50 }
     48
    5149}
    5250
  • icGREP/icgrep-devel/icgrep/pablo/pe_or.h

    r4214 r4215  
    5252};
    5353
    54 inline PabloE * makeOr(PabloE * expr1, PabloE * expr2, CodeGenState & cg) {
    55     OptimizeOr run(cg);
    56     return run(expr1, expr2);
    57 }
    58 
    5954}
    6055
  • icGREP/icgrep-devel/icgrep/pablo/pe_pabloe.h

    r4213 r4215  
    99
    1010#include <llvm/Support/Casting.h>
     11#include <list>
    1112
    1213using namespace llvm;
     
    5051bool equals(const PabloE * expr1, const PabloE *expr2);
    5152
    52 //template <typename To, typename From>
    53 //inline static bool isa(const From * object) {
    54 //    return To::classof(object);
    55 //}
    56 
    57 //template <typename To, typename From>
    58 //inline static To * cast(From * object) {
    59 //    return reinterpret_cast<To *>(object);
    60 //}
    61 
    62 //template <typename To, typename From>
    63 //inline static To * dyn_cast(From * object) {
    64 //    if (isa<To, From>(object)) {
    65 //        return cast<To, From>(object);
    66 //    }
    67 //    return nullptr;
    68 //}
     53typedef std::list<PabloE *> ExpressionList;
    6954
    7055}
  • icGREP/icgrep-devel/icgrep/pablo/pe_scanthru.h

    r4214 r4215  
    1313
    1414class ScanThru : public  PabloE {
    15     friend PabloE * makeScanThru(PabloE *, PabloE *);
    1615    friend struct CodeGenState;
    1716public:
     
    4241};
    4342
    44 inline PabloE * makeScanThru(PabloE * from, PabloE * thru) {
    45     return new ScanThru(from, thru);
    46 }
    47 
    4843}
    4944
  • icGREP/icgrep-devel/icgrep/pablo/pe_sel.h

    r4214 r4215  
    5757};
    5858
    59 inline PabloE * makeSel(PabloE * if_expr, PabloE * t_expr, PabloE * f_expr, CodeGenState & cg) {
    60     OptimizeSel run(cg);
    61     return run(if_expr, t_expr, f_expr);
    62 }
    63 
    6459}
    6560
  • icGREP/icgrep-devel/icgrep/pablo/pe_var.h

    r4214 r4215  
    1515
    1616class Var : public PabloE {
    17     friend Var * makeVar(String *);
    18     friend Var * makeVar(Assign * assign);
    1917    friend struct CodeGenState;
    2018public:
     
    4038};
    4139
    42 inline Var * makeVar(String * var) {
    43     return new Var(var);
    44 }
    45 
    46 inline Var * makeVar(Assign * assign) {
    47     return new Var(assign->mName);
    48 }
    49 
    5040}
    5141
  • icGREP/icgrep-devel/icgrep/pablo/pe_xor.h

    r4214 r4215  
    5252};
    5353
    54 inline PabloE * makeXor(PabloE * expr1, PabloE * expr2, CodeGenState & cg) {
    55     OptimizeXor run(cg);
    56     return run(expr1, expr2);
    57 }
    58 
    5954}
    6055
  • icGREP/icgrep-devel/icgrep/pablo/printer_pablos.cpp

    r4214 r4215  
    5353}
    5454
    55 std::string StatementPrinter::Print_PB_PabloStmts(const List &stmts, std::string strOut) {
     55std::string StatementPrinter::Print_PB_PabloStmts(const ExpressionList & stmts, std::string strOut) {
    5656    for (const auto stmt : stmts) {
    5757        strOut += ShowPabloS(stmt);
     
    6060}
    6161
    62 std::string StatementPrinter::Print_CC_PabloStmts(const List & stmts) {
     62std::string StatementPrinter::Print_CC_PabloStmts(const pablo::ExpressionList &stmts) {
    6363    std::string strOut = "Total Statements: " + std::to_string(stmts.size()) + "\n";
    6464    for (const auto stmt : stmts) {
     
    8282    else if (const While * whl = dyn_cast<const While>(stmt))
    8383    {
    84         retVal = "While(" + ShowPabloE(whl->getExpr()) + ", " + Print_PB_PabloStmts(whl->getPSList(), retVal) + ")";
     84        retVal = "While(" + ShowPabloE(whl->getCondition()) + ", " + Print_PB_PabloStmts(whl->getPSList(), retVal) + ")";
    8585    }
    8686    else retVal = "UNKNOWN_STATEMENT_TYPE!!!";
  • icGREP/icgrep-devel/icgrep/pablo/printer_pablos.h

    r4207 r4215  
    88#define SHOW_H
    99
     10#include <pablo/pe_pabloe.h>
    1011#include <string>
    11 #include <list>
    1212
    1313namespace pablo {
    14     class PabloE;
    1514    class CodeGenState;
    1615}
    1716
    1817class StatementPrinter {
    19     typedef std::list<pablo::PabloE *> List;
    2018public:
    2119    static std::string PrintStmts(const pablo::CodeGenState & cg_state);
    22     static std::string Print_CC_PabloStmts(const List & stmts);
    23     static std::string Print_PB_PabloStmts(const List & stmts, std::string strOut);
     20    static std::string Print_CC_PabloStmts(const pablo::ExpressionList & stmts);
     21    static std::string Print_PB_PabloStmts(const pablo::ExpressionList & stmts, std::string strOut);
    2422    static std::string ShowPabloE(const pablo::PabloE * expr);
    2523    static std::string ShowPabloS(const pablo::PabloE *stmt);
  • icGREP/icgrep-devel/icgrep/pablo/ps_assign.h

    r4214 r4215  
    1313namespace pablo {
    1414
    15 class Var;
    16 
    1715class Assign : public PabloE {
    18     friend Assign * makeAssign(String *, PabloE *);
    19     friend Var * makeVar(Assign *);
    2016    friend struct CodeGenState;
    2117public:
     
    4743};
    4844
    49 inline Assign * makeAssign(String * marker, PabloE * expr) {
    50     return new Assign(marker, expr);
    51 }
    52 
    5345}
    5446
  • icGREP/icgrep-devel/icgrep/pablo/ps_if.h

    r4214 r4215  
    99
    1010#include <pablo/pe_pabloe.h>
    11 #include <list>
    1211
    1312namespace pablo {
     
    1615    friend struct CodeGenState;
    1716public:
    18     typedef std::list<PabloE*> List;
    19     friend If * makeIf(PabloE * expr, List psl);
    20 
    2117    static inline bool classof(const PabloE * e) {
    2218        return e->getClassTypeId() == ClassTypeId::If;
     
    3026        return mExpr;
    3127    }
    32     inline const List & getPSList() const {
     28    inline const ExpressionList & getPSList() const {
    3329        return mPSList;
    3430    }
    3531protected:
    36     If(PabloE * expr, List psl)
     32    If(PabloE * expr, ExpressionList && psl)
    3733    : PabloE(ClassTypeId::If)
    3834    , mExpr(expr)
     
    4339private:
    4440    PabloE * const mExpr;
    45     List          mPSList;
     41    ExpressionList mPSList;
    4642};
    47 
    48 inline If * makeIf(PabloE * expr, If::List statements) {
    49     return new If(expr, statements);
    50 }
    5143
    5244}
  • icGREP/icgrep-devel/icgrep/pablo/ps_while.h

    r4214 r4215  
    99
    1010#include <pablo/pe_pabloe.h>
    11 #include <list>
     11#include <vector>
    1212
    1313namespace pablo {
     
    1616    friend struct CodeGenState;
    1717public:
    18     typedef std::list<PabloE*> List;
    19     friend While * makeWhile(PabloE * expr, List psl);
    20 
    2118    static inline bool classof(const PabloE * e) {
    2219        return e->getClassTypeId() == ClassTypeId::While;
     
    2724    virtual ~While() {
    2825    }
    29     inline PabloE * getExpr() const {
     26    inline PabloE * getCondition() const {
    3027        return mExpr;
    3128    }
    32     inline const List & getPSList() const {
     29    inline const ExpressionList & getPSList() const {
    3330        return mPSList;
    3431    }
    3532protected:
    36     While(PabloE * expr, List psl)
     33    While(PabloE * expr, ExpressionList && psl)
    3734    : PabloE(ClassTypeId::While)
    3835    , mExpr(expr)
     
    4340private:
    4441    PabloE * const  mExpr;
    45     List            mPSList;
     42    ExpressionList  mPSList;
    4643};
    47 
    48 inline While * makeWhile(PabloE * cond, While::List statements) {
    49     return new While(cond, statements);
    50 }
    5144
    5245}
  • icGREP/icgrep-devel/icgrep/re/re_compiler.cpp

    r4214 r4215  
    7474        PabloE * assign_non_final = cg.createAssign(gs_nonfinal, cg.createOr(cg.createOr(u8pfx, u8scope32), cg.createOr(u8scope42, u8scope43)));
    7575        #ifdef USE_IF_FOR_NONFINAL
    76         std::list<PabloE *> * if_body = new std::list<PabloE *> ();
    77         if_body->push_back(assign_non_final);
    78         mCG.push_back(makeIf(u8pfx, *if_body));
     76        If::List body;
     77        body.push_back(assign_non_final);
     78        mCG.push_back(cg.createIf(u8pfx, body));
    7979        #else
    8080        cg.push_back(assign_non_final);
     
    224224
    225225        wt.push_back(target);
    226         cg.push_back(makeWhile(cg.createVar(while_test), wt.expressions()));
     226        cg.push_back(cg.createWhile(cg.createVar(while_test), wt.expressions()));
    227227    }   
    228228    return target;
Note: See TracChangeset for help on using the changeset viewer.