Ignore:
Timestamp:
Jan 21, 2015, 3:16:19 PM (5 years ago)
Author:
nmedfort
Message:

Temporary check in.

File:
1 edited

Legend:

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

    r4419 r4432  
    1515}
    1616
     17PabloAST * PabloBlock::createAdvance(PabloAST * expr, PabloAST * shiftAmount) {
     18    if (isa<Zeroes>(expr) || cast<Integer>(shiftAmount)->value() == 0) {
     19        return expr;
     20    }
     21    return insertAtInsertionPoint(new Advance(expr, shiftAmount, mSymbolGenerator, this));
     22}
     23
    1724PabloAST * PabloBlock::createAdvance(PabloAST * expr, const int shiftAmount) {
    1825    if (isa<Zeroes>(expr) || shiftAmount == 0) {
    1926        return expr;
    20     }
    21     return insertAtInsertionPoint(new Advance(expr, shiftAmount, mSymbolGenerator, this));
    22 }
    23 
    24 Call * PabloBlock::createCall(const std::string name) {
    25     return createCall(mSymbolGenerator->get(name));
     27    }   
     28    return insertAtInsertionPoint(new Advance(expr, mSymbolGenerator->getInteger(shiftAmount), mSymbolGenerator, this));
    2629}
    2730
     
    4144    }
    4245    return insertAtInsertionPoint(new Not(expr, this));
    43 }
    44 
    45 Var * PabloBlock::createVar(const std::string name) {
    46     return createVar(mSymbolGenerator->get(name));
    4746}
    4847
     
    214213
    215214PabloBlock::PabloBlock()
    216 : mZeroes(new Zeroes())
     215: PabloAST(PabloAST::ClassTypeId::Block)
     216, mZeroes(new Zeroes())
    217217, mOnes(new Ones())
    218218, mSymbolGenerator(new SymbolGenerator())
     219, mPredecessor(nullptr)
    219220{
    220221
     
    222223
    223224PabloBlock::PabloBlock(PabloBlock * predecessor)
    224 : mZeroes(predecessor->mZeroes) // inherit the original "Zeroes" variable for simplicity
     225: PabloAST(PabloAST::ClassTypeId::Block)
     226, mZeroes(predecessor->mZeroes) // inherit the original "Zeroes" variable for simplicity
    225227, mOnes(predecessor->mOnes) // inherit the original "Ones" variable for simplicity
    226228, mSymbolGenerator(predecessor->mSymbolGenerator)
     229, mPredecessor(predecessor)
    227230{
    228231
    229232}
    230233
    231 }
     234PabloBlock::~PabloBlock() {
     235    if (mPredecessor == nullptr) {
     236        delete mSymbolGenerator;
     237    }   
     238}
     239
     240}
Note: See TracChangeset for help on using the changeset viewer.