Ignore:
Timestamp:
Aug 7, 2015, 10:04:46 AM (4 years ago)
Author:
cameron
Message:

Mod64Advance, Mod64MatchStar, Mod64ScanThru ops; -mod64-approximate command-line option

File:
1 edited

Legend:

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

    r4699 r4717  
    111111}
    112112
     113PabloAST * PabloBlock::createMod64Advance(PabloAST * expr, PabloAST * shiftAmount) {
     114    if (isa<Zeroes>(expr) || cast<Integer>(shiftAmount)->value() == 0) {
     115        return expr;
     116    }
     117    return insertAtInsertionPoint(new Mod64Advance(expr, shiftAmount, makeName("advance")));
     118}
     119
     120PabloAST * PabloBlock::createMod64Advance(PabloAST * expr, PabloAST * shiftAmount, const std::string prefix) {
     121    if (isa<Zeroes>(expr) || cast<Integer>(shiftAmount)->value() == 0) {
     122        return expr;
     123    }
     124    return insertAtInsertionPoint(new Mod64Advance(expr, shiftAmount, makeName(prefix, false)));
     125}
     126
     127PabloAST * PabloBlock::createMod64Advance(PabloAST * expr, const Integer::Type shiftAmount) {
     128    if (isa<Zeroes>(expr) || shiftAmount == 0) {
     129        return expr;
     130    }
     131    return insertAtInsertionPoint(new Mod64Advance(expr, getInteger(shiftAmount), makeName("advance")));
     132}
     133
     134PabloAST * PabloBlock::createMod64Advance(PabloAST * expr, const Integer::Type shiftAmount, const std::string prefix) {
     135    if (isa<Zeroes>(expr) || shiftAmount == 0) {
     136        return renameNonNamedNode(expr, std::move(prefix));
     137    }   
     138    return insertAtInsertionPoint(new Mod64Advance(expr, getInteger(shiftAmount), makeName(prefix, false)));
     139}
     140
     141
    113142/// BINARY CREATE FUNCTIONS
    114143
     
    149178    return insertAtInsertionPoint(new ScanThru(from, thru, makeName(prefix, false)));
    150179}
     180
     181PabloAST * PabloBlock::createMod64MatchStar(PabloAST * marker, PabloAST * charclass) {
     182    assert (marker && charclass);
     183    if (isa<Zeroes>(marker) || isa<Zeroes>(charclass)) {
     184        return marker;
     185    }
     186    return insertAtInsertionPoint(new Mod64MatchStar(marker, charclass, makeName("matchstar")));
     187}
     188
     189PabloAST * PabloBlock::createMod64MatchStar(PabloAST * marker, PabloAST * charclass, const std::string prefix) {
     190    assert (marker && charclass);
     191    if (isa<Zeroes>(marker) || isa<Zeroes>(charclass)) {
     192        return renameNonNamedNode(marker, std::move(prefix));
     193    }
     194    return insertAtInsertionPoint(new Mod64MatchStar(marker, charclass, makeName(prefix, false)));
     195}
     196
     197PabloAST * PabloBlock::createMod64ScanThru(PabloAST * from, PabloAST * thru) {
     198    assert (from && thru);
     199    if (isa<Zeroes>(from) || isa<Zeroes>(thru)) {
     200        return from;
     201    }
     202    return insertAtInsertionPoint(new Mod64ScanThru(from, thru, makeName("scanthru")));
     203}
     204
     205PabloAST * PabloBlock::createMod64ScanThru(PabloAST * from, PabloAST * thru, const std::string prefix) {
     206    assert (from && thru);
     207    if (isa<Zeroes>(from) || isa<Zeroes>(thru)) {       
     208        return renameNonNamedNode(from, std::move(prefix));
     209    }
     210    return insertAtInsertionPoint(new Mod64ScanThru(from, thru, makeName(prefix, false)));
     211}
     212
     213
     214
    151215
    152216PabloAST * PabloBlock::createAnd(PabloAST * expr1, PabloAST * expr2) {
Note: See TracChangeset for help on using the changeset viewer.