Changeset 4298 for icGREP


Ignore:
Timestamp:
Nov 8, 2014, 10:56:44 AM (5 years ago)
Author:
cameron
Message:

Set Intersection back-end support

Location:
icGREP/icgrep-devel/icgrep/re
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/re/printer_re.cpp

    r4255 r4298  
    1818#include <re/re_start.h>
    1919#include <re/re_diff.h>
     20#include <re/re_intersect.h>
    2021
    2122using namespace re;
     
    6970        retVal += ") ";
    7071    }
     72    else if (const Intersect* x = dyn_cast<const Intersect>(re))
     73    {
     74        retVal = "Intersect (";
     75        retVal += PrintRE(x->getLH());
     76        retVal += " , ";
     77        retVal += PrintRE(x->getRH());
     78        retVal += ") ";
     79    }
    7180    else if (isa<const End>(re))
    7281    {
  • icGREP/icgrep-devel/icgrep/re/re_compiler.cpp

    r4283 r4298  
    1616#include <re/re_rep.h>
    1717#include <re/re_diff.h>
     18#include <re/re_intersect.h>
    1819#include <cc/cc_namemap.hpp>
    1920#include <pablo/codegenstate.h>
     
    161162}
    162163
     164inline Assign * RE_Compiler::process(Intersect * x, Assign * marker, PabloBlock & pb) {
     165    RE * lh = x->getLH();
     166    RE * rh = x->getRH();
     167    if ((isa<Any>(lh) || isa<Name>(lh)) && (isa<Any>(rh) || isa<Name>(rh))) {
     168        Assign * t1 = process(lh, marker, pb);
     169        Assign * t2 = process(rh, marker, pb);
     170        return pb.createAssign("intersect", pb.createAnd(pb.createVar(t1), pb.createVar(t2)));
     171    }
     172    throw std::runtime_error("Unsupported Intersect operands: " + Printer_RE::PrintRE(x));
     173}
     174
    163175inline Assign * RE_Compiler::process(Rep * rep, Assign * marker, PabloBlock & pb) {
    164176    int lb = rep->getLB();
  • icGREP/icgrep-devel/icgrep/re/re_compiler.h

    r4283 r4298  
    4646    pablo::Assign * process(Rep * rep, pablo::Assign *marker, pablo::PabloBlock & pb);
    4747    pablo::Assign * process(Diff * diff, pablo::Assign * marker, pablo::PabloBlock & cg);
     48    pablo::Assign * process(Intersect * x, pablo::Assign * marker, pablo::PabloBlock & cg);
    4849    pablo::Assign * consecutive(pablo::Assign * repeated,  int repeated_lgth, int repeat_count, pablo::PabloBlock & pb);
    4950    static bool isFixedLength(RE * regexp);
  • icGREP/icgrep-devel/icgrep/re/re_parser.cpp

    r4272 r4298  
    1212#include <re/re_start.h>
    1313#include <re/re_diff.h>
     14#include <re/re_intersect.h>
    1415#include <re/parsefailure.h>
    1516#include <algorithm>
Note: See TracChangeset for help on using the changeset viewer.