Ignore:
Timestamp:
Jun 12, 2015, 2:16:59 PM (4 years ago)
Author:
nmedfort
Message:

Fixed PabloBuilder? and intergrated it into CC Compiler.

File:
1 edited

Legend:

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

    r4511 r4602  
    1010public:
    1111
    12     inline static PabloBuilder Create(PabloBuilder & predecessor) {
    13         return *(new PabloBlock(predecessor->mPb));
    14     }
     12    PabloBuilder(PabloBlock & pb) : mPb(pb) {}
    1513
    1614    inline Zeroes * createZeroes() const {
    17         return mPb->createZeroes();
     15        return mPb.createZeroes();
    1816    }
    1917
    2018    inline Ones * createOnes() const {
    21         return mPb->createOnes();
     19        return mPb.createOnes();
    2220    }
    2321
    2422    Var * createVar(const std::string name) {
    25         return createVar(mPb->getName(name));
     23        return createVar(mPb.getName(name));
    2624    }
    2725
     
    3331
    3432    inline Call * createCall(const std::string name) {
    35         return createCall(mPb->getName(name));
     33        return createCall(mPb.getName(name));
    3634    }
    3735
    3836    Call * createCall(String * name);
    3937
    40     Assign * createAssign(const std::string prefix, PabloAST * expr, const int outputIndex = -1);
     38    Assign * createAssign(const std::string prefix, PabloAST * expr, const int outputIndex = -1) {
     39        return mPb.createAssign(prefix, expr, outputIndex);
     40    }
    4141
    4242    inline PabloAST * createAdvance(PabloAST * expr, const Integer::integer_t shiftAmount) {
     
    4444            return expr;
    4545        }
    46         return createAdvance(expr, mPb->getInteger(shiftAmount));
     46        return createAdvance(expr, mPb.getInteger(shiftAmount));
    4747    }
    4848
     
    6666
    6767    inline If * createIf(PabloAST * condition, std::initializer_list<Assign *> definedVars, PabloBlock & body) {
    68         mPb->createIf(condition, std::move(definedVars), body);
     68        return mPb.createIf(condition, std::move(definedVars), body);
     69    }
     70
     71    inline If * createIf(PabloAST * condition, std::vector<Assign *> definedVars, PabloBlock & body) {
     72        return mPb.createIf(condition, std::move(definedVars), body);
    6973    }
    7074
    7175    inline While * createWhile(PabloAST * condition, PabloBlock & body) {
    72         mPb->createWhile(condition, body);
     76        return mPb.createWhile(condition, body);
    7377    }
    7478
    7579private:
    7680
    77     PabloBlock *        mPb;
     81    PabloBlock &        mPb;
    7882    ExpressionTable     mExprTable;
    7983};
Note: See TracChangeset for help on using the changeset viewer.