Ignore:
Timestamp:
Mar 7, 2016, 3:37:30 PM (4 years ago)
Author:
nmedfort
Message:

Initial modifications to Pablo Compiler and Kernel Builder to support circular buffers for Lookahead.

File:
1 edited

Legend:

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

    r4896 r4959  
    4444/// UNARY CREATE FUNCTIONS
    4545
    46 Assign * PabloBlock::createAssign(const std::string && prefix, PabloAST * expr)  {
     46Assign * PabloBlock::createAssign(const std::string && prefix, PabloAST * const expr)  {
     47    assert ("Assign expression cannot be null!" && expr);
    4748    return insertAtInsertionPoint(new Assign(expr, makeName(prefix, false)));
    4849}
     
    7273    if (isa<Zeroes>(expr) || shiftAmount == 0) {
    7374        return renameNonNamedNode(expr, std::move(prefix));
    74     }   
     75    }
    7576    return insertAtInsertionPoint(new Advance(expr, getInteger(shiftAmount), makeName(prefix, false)));
     77}
     78
     79PabloAST * PabloBlock::createLookahead(PabloAST * expr, PabloAST * shiftAmount) {
     80    if (isa<Zeroes>(expr) || cast<Integer>(shiftAmount)->value() == 0) {
     81        return expr;
     82    }
     83    return insertAtInsertionPoint(new Lookahead(expr, shiftAmount, makeName("lookahead")));
     84}
     85
     86PabloAST * PabloBlock::createLookahead(PabloAST * expr, PabloAST * shiftAmount, const std::string prefix) {
     87    if (isa<Zeroes>(expr) || cast<Integer>(shiftAmount)->value() == 0) {
     88        return expr;
     89    }
     90    return insertAtInsertionPoint(new Lookahead(expr, shiftAmount, makeName(prefix, false)));
     91}
     92
     93PabloAST * PabloBlock::createLookahead(PabloAST * expr, const Integer::Type shiftAmount) {
     94    if (isa<Zeroes>(expr) || shiftAmount == 0) {
     95        return expr;
     96    }
     97    return insertAtInsertionPoint(new Lookahead(expr, getInteger(shiftAmount), makeName("lookahead")));
     98}
     99
     100PabloAST * PabloBlock::createLookahead(PabloAST * expr, const Integer::Type shiftAmount, const std::string prefix) {
     101    if (isa<Zeroes>(expr) || shiftAmount == 0) {
     102        return renameNonNamedNode(expr, std::move(prefix));
     103    }
     104    return insertAtInsertionPoint(new Lookahead(expr, getInteger(shiftAmount), makeName(prefix, false)));
    76105}
    77106
     
    141170    }   
    142171    return insertAtInsertionPoint(new Mod64Advance(expr, getInteger(shiftAmount), makeName(prefix, false)));
     172}
     173
     174PabloAST * PabloBlock::createMod64Lookahead(PabloAST * expr, PabloAST * shiftAmount) {
     175    if (isa<Zeroes>(expr) || cast<Integer>(shiftAmount)->value() == 0) {
     176        return expr;
     177    }
     178    return insertAtInsertionPoint(new Mod64Lookahead(expr, shiftAmount, makeName("advance")));
     179}
     180
     181PabloAST * PabloBlock::createMod64Lookahead(PabloAST * expr, PabloAST * shiftAmount, const std::string prefix) {
     182    if (isa<Zeroes>(expr) || cast<Integer>(shiftAmount)->value() == 0) {
     183        return expr;
     184    }
     185    return insertAtInsertionPoint(new Mod64Lookahead(expr, shiftAmount, makeName(prefix, false)));
     186}
     187
     188PabloAST * PabloBlock::createMod64Lookahead(PabloAST * expr, const Integer::Type shiftAmount) {
     189    if (isa<Zeroes>(expr) || shiftAmount == 0) {
     190        return expr;
     191    }
     192    return insertAtInsertionPoint(new Mod64Lookahead(expr, getInteger(shiftAmount), makeName("advance")));
     193}
     194
     195PabloAST * PabloBlock::createMod64Lookahead(PabloAST * expr, const Integer::Type shiftAmount, const std::string prefix) {
     196    if (isa<Zeroes>(expr) || shiftAmount == 0) {
     197        return renameNonNamedNode(expr, std::move(prefix));
     198    }
     199    return insertAtInsertionPoint(new Mod64Lookahead(expr, getInteger(shiftAmount), makeName(prefix, false)));
    143200}
    144201
Note: See TracChangeset for help on using the changeset viewer.