Ignore:
Timestamp:
Jan 25, 2015, 4:11:26 PM (5 years ago)
Author:
nmedfort
Message:

Temporary check in.

File:
1 edited

Legend:

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

    r4432 r4443  
    77namespace pablo {
    88
    9 class Builder {
     9class PabloBuilder {
    1010public:
    11     PabloAST * createAdvance(PabloAST * expr, const int shiftAmount);
     11
     12    inline static PabloBlock & Create() {
     13        return *(new PabloBlock());
     14    }
     15
     16    inline static PabloBlock & Create(PabloBlock & predecessor) {
     17        return *(new PabloBlock(&predecessor));
     18    }
     19
    1220
    1321    inline Zeroes * createZeroes() const {
     
    1725    inline Ones * createOnes() const {
    1826        return mPb->createOnes();
     27    }
     28
     29    Var * createVar(const std::string name) {
     30        return createVar(mPb->getName(name));
     31    }
     32
     33    Var * createVar(String * name);
     34
     35    PabloAST * createVar(const PabloAST * const) {
     36        throw std::runtime_error("Var objects should only refer to external Vars (i.e., input basis bit streams). Use Assign objects directly.");
    1937    }
    2038
     
    2745    Assign * createAssign(const std::string prefix, PabloAST * expr, const int outputIndex = -1);
    2846
    29     Var * createVar(const std::string name) {
    30         return createVar(mPb->getName(name));
     47    inline PabloAST * createAdvance(PabloAST * expr, const int shiftAmount) {
     48        if (shiftAmount == 0) {
     49            return expr;
     50        }
     51        return createAdvance(expr, mPb->getInteger(shiftAmount));
    3152    }
    3253
    33     Var * createVar(String * name);
    34 
    35     PabloAST * createVar(const PabloAST * const) {
    36         throw std::runtime_error("Var objects should only refer to external Vars (i.e., input basis bit streams). Use Assign objects directly.");
    37     }
     54    PabloAST * createAdvance(PabloAST * expr, PabloAST * shiftAmount);
    3855
    3956    Next * createNext(Assign * assign, PabloAST * expr);
     
    5370    PabloAST * createSel(PabloAST * condition, PabloAST * trueExpr, PabloAST * falseExpr);
    5471
    55     If * createIf(PabloAST * condition, std::vector<Assign *> && definedVars, PabloBlock & body);
     72    inline If * createIf(PabloAST * condition, std::vector<Assign *> && definedVars, PabloBlock & body) {
     73        mPb->createIf(condition, std::move(definedVars), body);
     74    }
    5675
    57     While * createWhile(PabloAST * cond, PabloBlock & body);
     76    inline While * createWhile(PabloAST * condition, PabloBlock & body) {
     77        mPb->createWhile(condition, body);
     78    }
    5879
    5980private:
    6081
    61     PabloBlock * mPb;
    62 
     82    PabloBlock *        mPb;
     83    ExpressionTable     mExprTable;
    6384};
    6485
Note: See TracChangeset for help on using the changeset viewer.