Ignore:
Timestamp:
May 19, 2016, 8:50:15 PM (3 years ago)
Author:
cameron
Message:

Add pablo.atEOF; clean out bit4/6 hack for unterminated final lines in icgrep.

Location:
icGREP/icgrep-devel/icgrep/pablo
Files:
8 edited

Legend:

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

    r5023 r5042  
    171171    return result;
    172172}
    173    
     173
     174PabloAST * PabloBuilder::createAtEOF(PabloAST * expr) {
     175    MAKE_UNARY(createAtEOF, PabloAST::ClassTypeId::AtEOF, expr);
     176    return result;
     177}
     178
     179PabloAST * PabloBuilder::createAtEOF(PabloAST * expr, const std::string prefix) {
     180    MAKE_UNARY(createAtEOF, PabloAST::ClassTypeId::AtEOF, expr, prefix);
     181    return result;
     182}
     183
    174184PabloAST * PabloBuilder::createMatchStar(PabloAST * marker, PabloAST * charclass) {
    175     MAKE_BINARY(createMatchStar, PabloAST::ClassTypeId::MatchStar, marker, charclass);
    176     return result;
     185MAKE_BINARY(createMatchStar, PabloAST::ClassTypeId::MatchStar, marker, charclass);
     186return result;
    177187}
    178188
  • icGREP/icgrep-devel/icgrep/pablo/builder.hpp

    r5037 r5042  
    145145    PabloAST * createInFile(PabloAST * expr, const std::string prefix);
    146146   
     147    PabloAST * createAtEOF(PabloAST * expr);
     148   
     149    PabloAST * createAtEOF(PabloAST * expr, const std::string prefix);
     150   
    147151    /// CreateIf Wrappers
    148152
  • icGREP/icgrep-devel/icgrep/pablo/codegenstate.cpp

    r5023 r5042  
    156156PabloAST * PabloBlock::createInFile(PabloAST * expr) {
    157157    assert (expr);
    158     return insertAtInsertionPoint(new InFile(expr, makeName("count_")));
     158    return insertAtInsertionPoint(new InFile(expr, makeName("inFile_")));
    159159}
    160160
     
    165165
    166166
    167 /// BINARY CREATE FUNCTIONS
     167PabloAST * PabloBlock::createAtEOF(PabloAST * expr) {
     168    assert (expr);
     169    return insertAtInsertionPoint(new AtEOF(expr, makeName("atEOF_")));
     170}
     171
     172PabloAST * PabloBlock::createAtEOF(PabloAST * expr, const std::string prefix) {
     173    assert (expr);
     174    return insertAtInsertionPoint(new AtEOF(expr, makeName(prefix, false)));
     175}
     176   
     177   
     178    /// BINARY CREATE FUNCTIONS
    168179
    169180Next * PabloBlock::createNext(Assign * assign, PabloAST * expr) {
  • icGREP/icgrep-devel/icgrep/pablo/codegenstate.h

    r5023 r5042  
    187187    PabloAST * createInFile(PabloAST * expr, const std::string prefix);
    188188   
     189    PabloAST * createAtEOF(PabloAST * expr);
     190   
     191    PabloAST * createAtEOF(PabloAST * expr, const std::string prefix);
     192   
    189193    If * createIf(PabloAST * condition, const std::initializer_list<Assign *> definedVars, PabloBlock * body);
    190194
  • icGREP/icgrep-devel/icgrep/pablo/pabloAST.cpp

    r5037 r5042  
    3535        } else if (isa<InFile>(expr1)) {
    3636            return equals(cast<InFile>(expr1)->getOperand(0), cast<InFile>(expr2)->getOperand(0));
     37        } else if (isa<AtEOF>(expr1)) {
     38            return equals(cast<AtEOF>(expr1)->getOperand(0), cast<AtEOF>(expr2)->getOperand(0));
    3739        } else if (isa<Variadic>(expr1)) {
    3840            const Variadic * const var1 = cast<Variadic>(expr1);
  • icGREP/icgrep-devel/icgrep/pablo/pabloAST.h

    r5037 r5042  
    6969        , MatchStar
    7070        , InFile
     71        , AtEOF
    7172        // Statistics operations
    7273        , Count
  • icGREP/icgrep-devel/icgrep/pablo/pablo_compiler.cpp

    r5039 r5042  
    112112    mCarryManager->initialize(function, mKernelBuilder);
    113113   
    114     mKernelBuilder->addInternalState(mBitBlockType, "EOFmask");
     114    mKernelBuilder->addInternalState(mBitBlockType, "EOFmark");
    115115   
    116116    mFunction = mKernelBuilder->prepareFunction({mInputStreamOffset.begin(), mInputStreamOffset.end()});
     
    396396        expr = iBuilder->simd_and(sum, iBuilder->simd_not(cc_expr));
    397397    } else if (const InFile * e = dyn_cast<InFile>(stmt)) {
    398         // Currently InFile(x) => x;  a no-op
    399         Value * EOFmask = iBuilder->CreateLoad(mKernelBuilder->getInternalState("EOFmask"));
    400         expr = iBuilder->simd_and(compileExpression(e->getExpr()), iBuilder->simd_not(EOFmask));
     398        Value * EOFmark = iBuilder->CreateLoad(mKernelBuilder->getInternalState("EOFmark"));
     399        Value * infileMask = iBuilder->simd_add(iBuilder->getBitBlockWidth(), EOFmark, iBuilder->allOnes());
     400        expr = iBuilder->simd_and(compileExpression(e->getExpr()), infileMask);
     401    } else if (const AtEOF * e = dyn_cast<AtEOF>(stmt)) {
     402        Value * EOFmark = iBuilder->CreateLoad(mKernelBuilder->getInternalState("EOFmark"));
     403        expr = iBuilder->simd_and(compileExpression(e->getExpr()), EOFmark);
    401404    } else if (const Count * c = dyn_cast<Count>(stmt)) {
    402405        Value * const to_count = compileExpression(c->getExpr());
  • icGREP/icgrep-devel/icgrep/pablo/pe_infile.h

    r5024 r5042  
    3030};
    3131
     32class AtEOF : public Statement {
     33    friend class PabloBlock;
     34public:
     35    static inline bool classof(const PabloAST * e) {
     36        return e->getClassTypeId() == ClassTypeId::AtEOF;
     37    }
     38    static inline bool classof(const void *) {
     39        return false;
     40    }
     41    virtual ~AtEOF(){
     42    }
     43    PabloAST * getExpr() const {
     44        return getOperand(0);
     45    }
     46protected:
     47    AtEOF(PabloAST * expr, String * name) : Statement(ClassTypeId::AtEOF, {expr}, name) { }
     48};
     49   
    3250}
    3351
Note: See TracChangeset for help on using the changeset viewer.