Changeset 4980 for icGREP


Ignore:
Timestamp:
Mar 18, 2016, 5:45:18 AM (4 years ago)
Author:
cameron
Message:

Remove mod64 junk

Location:
icGREP/icgrep-devel/icgrep
Files:
13 edited

Legend:

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

    r4959 r4980  
    9292}
    9393
    94 PabloAST * PabloBuilder::createMod64Advance(PabloAST * expr, PabloAST * shiftAmount) {
    95     MAKE_BINARY(createMod64Advance, PabloAST::ClassTypeId::Mod64Advance, expr, shiftAmount);
    96     return result;
    97 }
    98 
    99 PabloAST * PabloBuilder::createMod64Advance(PabloAST * expr, PabloAST * shiftAmount, const std::string prefix) {
    100     MAKE_BINARY(createMod64Advance, PabloAST::ClassTypeId::Mod64Advance, expr, shiftAmount, prefix);
    101     return result;
    102 }
    103 
    104 PabloAST * PabloBuilder::createMod64Lookahead(PabloAST * expr, PabloAST * shiftAmount) {
    105     MAKE_BINARY(createMod64Lookahead, PabloAST::ClassTypeId::Mod64Lookahead, expr, shiftAmount);
    106     return result;
    107 }
    108 
    109 PabloAST * PabloBuilder::createMod64Lookahead(PabloAST * expr, PabloAST * shiftAmount, const std::string prefix) {
    110     MAKE_BINARY(createMod64Lookahead, PabloAST::ClassTypeId::Mod64Lookahead, expr, shiftAmount, prefix);
    111     return result;
    112 }
    113 
    11494PabloAST * PabloBuilder::createNot(PabloAST * expr) {
    11595    MAKE_UNARY(createNot, PabloAST::ClassTypeId::Not, expr);
     
    213193}
    214194
    215 PabloAST * PabloBuilder::createMod64MatchStar(PabloAST * marker, PabloAST * charclass) {
    216     MAKE_BINARY(createMod64MatchStar, PabloAST::ClassTypeId::Mod64MatchStar, marker, charclass);
    217     return result;
    218 }
    219 
    220 PabloAST * PabloBuilder::createMod64MatchStar(PabloAST * marker, PabloAST * charclass, const std::string prefix) {
    221     MAKE_BINARY(createMod64MatchStar, PabloAST::ClassTypeId::Mod64MatchStar, marker, charclass, prefix);
    222     return result;
    223 }
    224 
    225 PabloAST * PabloBuilder::createMod64ScanThru(PabloAST * from, PabloAST * thru) {
    226     MAKE_BINARY(createMod64ScanThru, PabloAST::ClassTypeId::Mod64ScanThru, from, thru);
    227     return result;
    228 }
    229 
    230 PabloAST * PabloBuilder::createMod64ScanThru(PabloAST * from, PabloAST * thru, const std::string prefix) {
    231     MAKE_BINARY(createMod64ScanThru, PabloAST::ClassTypeId::Mod64ScanThru, from, thru, prefix);
    232     return result;
    233 }
    234 
    235195PabloAST * PabloBuilder::createCount(PabloAST * expr) {
    236196    MAKE_UNARY(createCount, PabloAST::ClassTypeId::Count, expr);
  • icGREP/icgrep-devel/icgrep/pablo/builder.hpp

    r4959 r4980  
    140140   
    141141    PabloAST * createCount(PabloAST * expr, const std::string prefix);
    142    
    143     /// Mod64 approximate function wrappers.
    144    
    145     PabloAST * createMod64Advance(PabloAST * expr, PabloAST * shiftAmount);
    146 
    147     inline PabloAST * createMod64Advance(PabloAST * expr, const Integer::Type shiftAmount) {
    148         if (shiftAmount == 0) {
    149             return expr;
    150         }
    151         return createMod64Advance(expr, mPb->getInteger(shiftAmount));
    152     }
    153 
    154     PabloAST * createMod64Advance(PabloAST * expr, PabloAST * shiftAmount, const std::string prefix);
    155 
    156     inline PabloAST * createMod64Advance(PabloAST * expr, const Integer::Type shiftAmount, const std::string prefix) {
    157         if (shiftAmount == 0) {
    158             return expr;
    159         }
    160         return createMod64Advance(expr, mPb->getInteger(shiftAmount), prefix);
    161     }
    162 
    163     PabloAST * createMod64Lookahead(PabloAST * expr, PabloAST * shiftAmount);
    164 
    165     inline PabloAST * createMod64Lookahead(PabloAST * expr, const Integer::Type shiftAmount) {
    166         if (shiftAmount == 0) {
    167             return expr;
    168         }
    169         return createMod64Lookahead(expr, mPb->getInteger(shiftAmount));
    170     }
    171 
    172     PabloAST * createMod64Lookahead(PabloAST * expr, PabloAST * shiftAmount, const std::string prefix);
    173 
    174     inline PabloAST * createMod64Lookahead(PabloAST * expr, const Integer::Type shiftAmount, const std::string prefix) {
    175         if (shiftAmount == 0) {
    176             return expr;
    177         }
    178         return createMod64Lookahead(expr, mPb->getInteger(shiftAmount), prefix);
    179     }
    180 
    181     PabloAST * createMod64MatchStar(PabloAST * marker, PabloAST * charclass);
    182 
    183     PabloAST * createMod64MatchStar(PabloAST * marker, PabloAST * charclass, const std::string prefix);
    184 
    185     PabloAST * createMod64ScanThru(PabloAST * from, PabloAST * thru);
    186 
    187     PabloAST * createMod64ScanThru(PabloAST * from, PabloAST * thru, const std::string prefix);
    188 
    189142
    190143    /// CreateIf Wrappers
  • icGREP/icgrep-devel/icgrep/pablo/codegenstate.cpp

    r4959 r4980  
    144144}
    145145
    146 PabloAST * PabloBlock::createMod64Advance(PabloAST * expr, PabloAST * shiftAmount) {
    147     if (isa<Zeroes>(expr) || cast<Integer>(shiftAmount)->value() == 0) {
    148         return expr;
    149     }
    150     return insertAtInsertionPoint(new Mod64Advance(expr, shiftAmount, makeName("advance")));
    151 }
    152 
    153 PabloAST * PabloBlock::createMod64Advance(PabloAST * expr, PabloAST * shiftAmount, const std::string prefix) {
    154     if (isa<Zeroes>(expr) || cast<Integer>(shiftAmount)->value() == 0) {
    155         return expr;
    156     }
    157     return insertAtInsertionPoint(new Mod64Advance(expr, shiftAmount, makeName(prefix, false)));
    158 }
    159 
    160 PabloAST * PabloBlock::createMod64Advance(PabloAST * expr, const Integer::Type shiftAmount) {
    161     if (isa<Zeroes>(expr) || shiftAmount == 0) {
    162         return expr;
    163     }
    164     return insertAtInsertionPoint(new Mod64Advance(expr, getInteger(shiftAmount), makeName("advance")));
    165 }
    166 
    167 PabloAST * PabloBlock::createMod64Advance(PabloAST * expr, const Integer::Type shiftAmount, const std::string prefix) {
    168     if (isa<Zeroes>(expr) || shiftAmount == 0) {
    169         return renameNonNamedNode(expr, std::move(prefix));
    170     }   
    171     return insertAtInsertionPoint(new Mod64Advance(expr, getInteger(shiftAmount), makeName(prefix, false)));
    172 }
    173 
    174 PabloAST * 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 
    181 PabloAST * 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 
    188 PabloAST * 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 
    195 PabloAST * 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)));
    200 }
    201 
    202146PabloAST * PabloBlock::createCount(PabloAST * expr) {
    203147    assert (expr);
     
    248192    }
    249193    return insertAtInsertionPoint(new ScanThru(from, thru, makeName(prefix, false)));
    250 }
    251 
    252 PabloAST * PabloBlock::createMod64MatchStar(PabloAST * marker, PabloAST * charclass) {
    253     assert (marker && charclass);
    254     if (isa<Zeroes>(marker) || isa<Zeroes>(charclass)) {
    255         return marker;
    256     }
    257     return insertAtInsertionPoint(new Mod64MatchStar(marker, charclass, makeName("matchstar")));
    258 }
    259 
    260 PabloAST * PabloBlock::createMod64MatchStar(PabloAST * marker, PabloAST * charclass, const std::string prefix) {
    261     assert (marker && charclass);
    262     if (isa<Zeroes>(marker) || isa<Zeroes>(charclass)) {
    263         return renameNonNamedNode(marker, std::move(prefix));
    264     }
    265     return insertAtInsertionPoint(new Mod64MatchStar(marker, charclass, makeName(prefix, false)));
    266 }
    267 
    268 PabloAST * PabloBlock::createMod64ScanThru(PabloAST * from, PabloAST * thru) {
    269     assert (from && thru);
    270     if (isa<Zeroes>(from) || isa<Zeroes>(thru)) {
    271         return from;
    272     }
    273     return insertAtInsertionPoint(new Mod64ScanThru(from, thru, makeName("scanthru")));
    274 }
    275 
    276 PabloAST * PabloBlock::createMod64ScanThru(PabloAST * from, PabloAST * thru, const std::string prefix) {
    277     assert (from && thru);
    278     if (isa<Zeroes>(from) || isa<Zeroes>(thru)) {       
    279         return renameNonNamedNode(from, std::move(prefix));
    280     }
    281     return insertAtInsertionPoint(new Mod64ScanThru(from, thru, makeName(prefix, false)));
    282194}
    283195
  • icGREP/icgrep-devel/icgrep/pablo/codegenstate.h

    r4959 r4980  
    194194    While * createWhile(PabloAST * condition, std::vector<Next *> && nextVars, PabloBlock * body);
    195195
    196     PabloAST * createMod64Advance(PabloAST * expr, const Integer::Type shiftAmount);
    197 
    198     PabloAST * createMod64Advance(PabloAST * expr, PabloAST * shiftAmount);
    199 
    200     PabloAST * createMod64Advance(PabloAST * expr, const Integer::Type shiftAmount, const std::string prefix);
    201 
    202     PabloAST * createMod64Advance(PabloAST * expr, PabloAST * shiftAmount, const std::string prefix);
    203 
    204     PabloAST * createMod64Lookahead(PabloAST * expr, const Integer::Type shiftAmount);
    205 
    206     PabloAST * createMod64Lookahead(PabloAST * expr, PabloAST * shiftAmount);
    207 
    208     PabloAST * createMod64Lookahead(PabloAST * expr, const Integer::Type shiftAmount, const std::string prefix);
    209 
    210     PabloAST * createMod64Lookahead(PabloAST * expr, PabloAST * shiftAmount, const std::string prefix);
    211 
    212     PabloAST * createMod64MatchStar(PabloAST * marker, PabloAST * charclass);
    213 
    214     PabloAST * createMod64MatchStar(PabloAST * marker, PabloAST * charclass, const std::string prefix);
    215 
    216     PabloAST * createMod64ScanThru(PabloAST * from, PabloAST * thru);
    217 
    218     PabloAST * createMod64ScanThru(PabloAST * from, PabloAST * thru, const std::string prefix);
    219 
    220196    inline StatementList & statements() {
    221197        return *this;
  • icGREP/icgrep-devel/icgrep/pablo/expression_map.hpp

    r4876 r4980  
    279279            case PabloAST::ClassTypeId::ScanThru:
    280280            case PabloAST::ClassTypeId::MatchStar:
    281             case PabloAST::ClassTypeId::Mod64Advance:
    282             case PabloAST::ClassTypeId::Mod64ScanThru:
    283             case PabloAST::ClassTypeId::Mod64MatchStar:
    284281            case PabloAST::ClassTypeId::Next:
    285282                return mBinary.findOrAdd(stmt, stmt->getClassTypeId(), stmt->getOperand(0), stmt->getOperand(1));
  • icGREP/icgrep-devel/icgrep/pablo/pabloAST.h

    r4965 r4980  
    6868        , Lookahead
    6969        , MatchStar
    70         // Mod 64 approximate stream operations
    71         , Mod64Advance
    72         , Mod64ScanThru
    73         , Mod64Lookahead
    74         , Mod64MatchStar
    7570        // Statistics operations
    7671        , Count
  • icGREP/icgrep-devel/icgrep/pablo/pablo_compiler.cpp

    r4974 r4980  
    374374        Value * const strm_value = compileExpression(adv->getExpr());
    375375        expr = mCarryManager->advanceCarryInCarryOut(adv->getLocalIndex(), adv->getAmount(), strm_value);
    376     } else if (const Mod64Advance * adv = dyn_cast<Mod64Advance>(stmt)) {
    377         Value * const strm_value = compileExpression(adv->getExpr());
    378         expr = iBuilder->simd_slli(64, strm_value, adv->getAmount());
    379376    } else if (const MatchStar * mstar = dyn_cast<MatchStar>(stmt)) {
    380377        Value * const marker = compileExpression(mstar->getMarker());
     
    383380        Value * const sum = mCarryManager->addCarryInCarryOut(mstar->getLocalCarryIndex(), marker_and_cc, cc);
    384381        expr = iBuilder->simd_or(iBuilder->simd_xor(sum, cc), marker);
    385     } else if (const Mod64MatchStar * mstar = dyn_cast<Mod64MatchStar>(stmt)) {
    386         Value * const marker = compileExpression(mstar->getMarker());
    387         Value * const cc = compileExpression(mstar->getCharClass());
    388         Value * const marker_and_cc = iBuilder->simd_and(marker, cc);
    389         Value * const sum = iBuilder->simd_add(64, marker_and_cc, cc);
    390         expr = iBuilder->simd_or(iBuilder->simd_xor(sum, cc), marker);
    391382    } else if (const ScanThru * sthru = dyn_cast<ScanThru>(stmt)) {
    392383        Value * const  marker_expr = compileExpression(sthru->getScanFrom());
    393384        Value * const  cc_expr = compileExpression(sthru->getScanThru());
    394385        Value * const  sum = mCarryManager->addCarryInCarryOut(sthru->getLocalCarryIndex(), marker_expr, cc_expr);
    395         expr = iBuilder->simd_and(sum, iBuilder->simd_not(cc_expr));
    396     } else if (const Mod64ScanThru * sthru = dyn_cast<Mod64ScanThru>(stmt)) {
    397         Value * const marker_expr = compileExpression(sthru->getScanFrom());
    398         Value * const cc_expr = compileExpression(sthru->getScanThru());
    399         Value * const sum = iBuilder->simd_add(64, marker_expr, cc_expr);
    400386        expr = iBuilder->simd_and(sum, iBuilder->simd_not(cc_expr));
    401387    } else if (const Count * c = dyn_cast<Count>(stmt)) {
  • icGREP/icgrep-devel/icgrep/pablo/pe_advance.h

    r4959 r4980  
    4747};
    4848
    49 class Mod64Advance : public Statement {
    50     friend class PabloBlock;
    51 public:
    52     static inline bool classof(const PabloAST * e) {
    53         return e->getClassTypeId() == ClassTypeId::Mod64Advance;
    54     }
    55     static inline bool classof(const void *) {
    56         return false;
    57     }
    58     virtual ~Mod64Advance() {
    59     }
    60     inline PabloAST * getExpr() const {
    61         return getOperand(0);
    62     }
    63     inline Integer::Type getAmount() const {
    64         return cast<Integer>(getOperand(1))->value();
    65     }
    66 protected:
    67     Mod64Advance(PabloAST * expr, PabloAST * shiftAmount, String * name)
    68     : Statement(ClassTypeId::Mod64Advance, {expr, shiftAmount}, name)
    69     {
    70         assert(isa<Integer>(shiftAmount));
    71     }
    72 };
    73 
    7449}
    7550
  • icGREP/icgrep-devel/icgrep/pablo/pe_lookahead.h

    r4959 r4980  
    4747};
    4848
    49 class Mod64Lookahead : public Statement {
    50     friend class PabloBlock;
    51 public:
    52     static inline bool classof(const PabloAST * e) {
    53         return e->getClassTypeId() == ClassTypeId::Mod64Lookahead;
    54     }
    55     static inline bool classof(const void *) {
    56         return false;
    57     }
    58     virtual ~Mod64Lookahead() {
    59     }
    60     inline PabloAST * getExpr() const {
    61         return getOperand(0);
    62     }
    63     inline Integer::Type getAmount() const {
    64         return cast<Integer>(getOperand(1))->value();
    65     }
    66 protected:
    67     Mod64Lookahead(PabloAST * expr, PabloAST * shiftAmount, String * name)
    68     : Statement(ClassTypeId::Mod64Lookahead, {expr, shiftAmount}, name)
    69     {
    70         assert(isa<Integer>(shiftAmount));
    71     }
    72 };
    73 
    7449}
    7550
  • icGREP/icgrep-devel/icgrep/pablo/pe_matchstar.h

    r4717 r4980  
    4444};
    4545
    46 class Mod64MatchStar : public Statement {
    47     friend class PabloBlock;
    48 public:
    49     static inline bool classof(const PabloAST * e) {
    50         return e->getClassTypeId() == ClassTypeId::Mod64MatchStar;
    51     }
    52     static inline bool classof(const void *) {
    53         return false;
    54     }
    55     inline PabloAST * getMarker() const {
    56         return getOperand(0);
    57     }
    58     inline PabloAST * getCharClass() const  {
    59         return getOperand(1);
    60     }
    61     virtual ~Mod64MatchStar() {}
    62 protected:
    63     Mod64MatchStar(PabloAST * marker, PabloAST * cc, String * name)
    64     : Statement(ClassTypeId::Mod64MatchStar, {marker, cc}, name)
    65     {
    66 
    67     }
    68 };
    69 
    7046}
    7147
  • icGREP/icgrep-devel/icgrep/pablo/pe_scanthru.h

    r4717 r4980  
    4545};
    4646
    47 class Mod64ScanThru : public Statement {
    48     friend class PabloBlock;
    49 public:
    50     static inline bool classof(const PabloAST * e) {
    51         return e->getClassTypeId() == ClassTypeId::Mod64ScanThru;
    52     }
    53     static inline bool classof(const void *) {
    54         return false;
    55     }
    56     virtual ~Mod64ScanThru() {
    57     }
    58     PabloAST * getScanFrom() const {
    59         return getOperand(0);
    60     }
    61     PabloAST * getScanThru() const {
    62         return getOperand(1);
    63     }
    64 protected:
    65     Mod64ScanThru(PabloAST * from, PabloAST * thru, String * name)
    66     : Statement(ClassTypeId::Mod64ScanThru, {from, thru}, name)
    67     {
    68 
    69     }
    70 };
    71 
    7247}
    7348
  • icGREP/icgrep-devel/icgrep/pablo/printer_pablos.cpp

    r4959 r4980  
    116116        print(sthru->getScanThru(), out);
    117117        out << ")";
    118     } else if (const Mod64Advance * adv = dyn_cast<const Mod64Advance>(stmt)) {
    119         out << adv->getName() << " = pablo.Mod64Advance(";
    120         print(adv->getExpr(), out);
    121         out << ", " << std::to_string(adv->getAmount()) << ")";
    122     } else if (const Mod64Lookahead * adv = dyn_cast<const Mod64Lookahead>(stmt)) {
    123         out << adv->getName() << " = pablo.Mod64Lookahead(";
    124         print(adv->getExpr(), out);
    125         out << ", " << std::to_string(adv->getAmount()) << ")";
    126     } else if (const Mod64MatchStar * mstar = dyn_cast<const Mod64MatchStar>(stmt)) {
    127         out << mstar->getName() << " = pablo.Mod64MatchStar(";
    128         print(mstar->getMarker(), out);
    129         out << ", ";
    130         print(mstar->getCharClass(), out);
    131         out << ")";
    132     } else if (const Mod64ScanThru * sthru = dyn_cast<const Mod64ScanThru>(stmt)) {
    133         out << sthru->getName() << " = pablo.Mod64ScanThru(";
    134         print(sthru->getScanFrom(), out);
    135         out << ", ";
    136         print(sthru->getScanThru(), out);
    137         out << ")";
    138118    } else if (const Count * count = dyn_cast<const Count>(stmt)) {
    139119        out << count->getName() << " = pablo.Count(";
  • icGREP/icgrep-devel/icgrep/re/re_compiler.cpp

    r4978 r4980  
    5151static cl::opt<bool> DisableUnicodeLineBreak("disable-unicode-linebreak", cl::init(false),
    5252                     cl::desc("disable Unicode line breaks - use LF only"), cl::cat(fREcompilationOptions));
    53 static cl::opt<bool> SetMod64Approximation("mod64-approximate", cl::init(false),
    54                      cl::desc("set mod64 approximate mode"), cl::cat(fREcompilationOptions));
    5553
    5654#ifndef DISABLE_PREGENERATED_UCD_FUNCTIONS
     
    661659        PabloAST * cc = markerVar(compile(repeated, pb));
    662660        PabloAST * mstar = nullptr;
    663         if (SetMod64Approximation) {
    664             mstar = pb.createMod64MatchStar(base, cc, "unbounded");
    665         } else {
    666             mstar = pb.createMatchStar(base, cc, "unbounded");
    667         }
     661        mstar = pb.createMatchStar(base, cc, "unbounded");
    668662        return makeMarker(MarkerPosition::InitialPostPositionByte, mstar);
    669663    } else if (isUnicodeUnitLength(repeated) && !DisableMatchStar && !DisableUnicodeMatchStar) {
     
    675669        }
    676670        cc = pb.createOr(cc, nonFinal);
    677         if (SetMod64Approximation) {
    678             mstar = pb.createMod64MatchStar(base, cc);
    679         } else {
    680             mstar = pb.createMatchStar(base, cc);
    681         }
     671        mstar = pb.createMatchStar(base, cc);
    682672        PabloAST * final = mFinal;
    683673        if (mGraphemeBoundaryRule) {
Note: See TracChangeset for help on using the changeset viewer.