Changeset 5023


Ignore:
Timestamp:
May 3, 2016, 10:39:29 AM (17 months ago)
Author:
cameron
Message:

pablo.InFile? initial support

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

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/cc/cc_compiler.cpp

    r4890 r5023  
    5151        return pb.createZeroes();
    5252    }
     53    bool includes_codepoint_zero = lo_codepoint(cc->begin()) == 0;
    5354    if (cc->size() > 2) {
    5455        bool combine = true;
     
    8788        expr = (expr == nullptr) ? temp : pb.createOr(expr, temp);
    8889    }
    89     return expr;
     90    if (includes_codepoint_zero) {
     91        return pb.createInFile(expr);
     92    }
     93    else {
     94        return expr;
     95    }
    9096}
    9197
  • icGREP/icgrep-devel/icgrep/pablo/builder.cpp

    r4980 r5023  
    162162}
    163163
     164PabloAST * PabloBuilder::createInFile(PabloAST * expr) {
     165    MAKE_UNARY(createInFile, PabloAST::ClassTypeId::InFile, expr);
     166    return result;
     167}
     168
     169PabloAST * PabloBuilder::createInFile(PabloAST * expr, const std::string prefix) {
     170    MAKE_UNARY(createInFile, PabloAST::ClassTypeId::InFile, expr, prefix);
     171    return result;
     172}
     173   
    164174PabloAST * PabloBuilder::createMatchStar(PabloAST * marker, PabloAST * charclass) {
    165175    MAKE_BINARY(createMatchStar, PabloAST::ClassTypeId::MatchStar, marker, charclass);
  • icGREP/icgrep-devel/icgrep/pablo/builder.hpp

    r4980 r5023  
    140140   
    141141    PabloAST * createCount(PabloAST * expr, const std::string prefix);
    142 
     142   
     143    PabloAST * createInFile(PabloAST * expr);
     144   
     145    PabloAST * createInFile(PabloAST * expr, const std::string prefix);
     146   
    143147    /// CreateIf Wrappers
    144148
  • icGREP/icgrep-devel/icgrep/pablo/codegenstate.cpp

    r4980 r5023  
    154154}
    155155
    156    
     156PabloAST * PabloBlock::createInFile(PabloAST * expr) {
     157    assert (expr);
     158    return insertAtInsertionPoint(new InFile(expr, makeName("count_")));
     159}
     160
     161PabloAST * PabloBlock::createInFile(PabloAST * expr, const std::string prefix) {
     162    assert (expr);
     163    return insertAtInsertionPoint(new InFile(expr, makeName(prefix, false)));
     164}
     165
     166
    157167/// BINARY CREATE FUNCTIONS
    158168
  • icGREP/icgrep-devel/icgrep/pablo/codegenstate.h

    r4980 r5023  
    2121#include <pablo/pe_scanthru.h>
    2222#include <pablo/pe_sel.h>
     23#include <pablo/pe_infile.h>
    2324#include <pablo/pe_integer.h>
    2425#include <pablo/pe_string.h>
     
    182183    PabloAST * createCount(PabloAST * expr, const std::string prefix);
    183184   
     185    PabloAST * createInFile(PabloAST * expr);
     186   
     187    PabloAST * createInFile(PabloAST * expr, const std::string prefix);
     188   
    184189    If * createIf(PabloAST * condition, const std::initializer_list<Assign *> definedVars, PabloBlock * body);
    185190
  • icGREP/icgrep-devel/icgrep/pablo/pabloAST.cpp

    r4922 r5023  
    3232        } else if (isa<Not>(expr1)) {
    3333            return equals(cast<Not>(expr1)->getOperand(0), cast<Not>(expr2)->getOperand(0));
     34        } else if (isa<InFile>(expr1)) {
     35            return equals(cast<InFile>(expr1)->getOperand(0), cast<InFile>(expr2)->getOperand(0));
    3436        } else if (isa<Variadic>(expr1)) {
    3537            const Variadic * const var1 = cast<Variadic>(expr1);
  • icGREP/icgrep-devel/icgrep/pablo/pabloAST.h

    r4983 r5023  
    6868        , Lookahead
    6969        , MatchStar
     70        , InFile
    7071        // Statistics operations
    7172        , Count
  • icGREP/icgrep-devel/icgrep/pablo/pablo_compiler.cpp

    r5000 r5023  
    395395        Value * const  sum = mCarryManager->addCarryInCarryOut(sthru->getLocalCarryIndex(), marker_expr, cc_expr);
    396396        expr = iBuilder->simd_and(sum, iBuilder->simd_not(cc_expr));
     397    } else if (const InFile * e = dyn_cast<InFile>(stmt)) {
     398        // Currently InFile(x) => x;  a no-op
     399        expr = compileExpression(e->getExpr());
    397400    } else if (const Count * c = dyn_cast<Count>(stmt)) {
    398401        Value * const to_count = compileExpression(c->getExpr());
  • icGREP/icgrep-devel/icgrep/pablo/printer_pablos.cpp

    r4980 r5023  
    120120        print(count->getExpr(), out);
    121121        out << ")";
     122    } else if (const InFile * e = dyn_cast<const InFile>(stmt)) {
     123        out << e->getName() << " = pablo.InFile(";
     124        print(e->getExpr(), out);
     125        out << ")";
    122126    } else {
    123127        out << "???";
Note: See TracChangeset for help on using the changeset viewer.