Ignore:
Timestamp:
Dec 21, 2017, 9:01:44 PM (17 months ago)
Author:
cameron
Message:

makeByte uses the Byte alphabet

Location:
icGREP/icgrep-devel/icgrep/kernels
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/kernels/grep_kernel.cpp

    r5793 r5797  
    1717#include <pablo/pe_count.h>
    1818#include <pablo/pe_matchstar.h>
    19 #include "cc/cc_compiler.h"         // for CC_Compiler
    20 
     19#include <cc/cc_compiler.h>         // for CC_Compiler
     20#include <cc/alphabet.h>
    2121#include <llvm/Support/raw_ostream.h>
    2222
     
    4242    auto & pb = ccc.getBuilder();
    4343    Zeroes * const ZEROES = pb.createZeroes();
    44     PabloAST * const u8pfx = ccc.compileCC(makeCC(0xC0, 0xFF));
     44    PabloAST * const u8pfx = ccc.compileCC(makeByte(0xC0, 0xFF));
    4545
    4646
     
    5252
    5353    pb.createIf(u8pfx, it);
    54     PabloAST * const u8pfx2 = ccc.compileCC(makeCC(0xC2, 0xDF), it);
    55     PabloAST * const u8pfx3 = ccc.compileCC(makeCC(0xE0, 0xEF), it);
    56     PabloAST * const u8pfx4 = ccc.compileCC(makeCC(0xF0, 0xF4), it);
    57     PabloAST * const u8suffix = ccc.compileCC("u8suffix", makeCC(0x80, 0xBF), it);
     54    PabloAST * const u8pfx2 = ccc.compileCC(makeByte(0xC2, 0xDF), it);
     55    PabloAST * const u8pfx3 = ccc.compileCC(makeByte(0xE0, 0xEF), it);
     56    PabloAST * const u8pfx4 = ccc.compileCC(makeByte(0xF0, 0xF4), it);
     57    PabloAST * const u8suffix = ccc.compileCC("u8suffix", makeByte(0x80, 0xBF), it);
    5858   
    5959    //
     
    7474    PabloAST * const u8scope3X = it3.createOr(u8scope32, u8scope33);
    7575    it3.createAssign(anyscope, it3.createOr(anyscope, u8scope3X));
    76     PabloAST * const E0_invalid = it3.createAnd(it3.createAdvance(ccc.compileCC(makeCC(0xE0), it3), 1), ccc.compileCC(makeCC(0x80, 0x9F), it3));
    77     PabloAST * const ED_invalid = it3.createAnd(it3.createAdvance(ccc.compileCC(makeCC(0xED), it3), 1), ccc.compileCC(makeCC(0xA0, 0xBF), it3));
     76    PabloAST * const E0_invalid = it3.createAnd(it3.createAdvance(ccc.compileCC(makeByte(0xE0), it3), 1), ccc.compileCC(makeByte(0x80, 0x9F), it3));
     77    PabloAST * const ED_invalid = it3.createAnd(it3.createAdvance(ccc.compileCC(makeByte(0xED), it3), 1), ccc.compileCC(makeByte(0xA0, 0xBF), it3));
    7878    PabloAST * const EX_invalid = it3.createOr(E0_invalid, ED_invalid);
    7979    it3.createAssign(EF_invalid, EX_invalid);
     
    9191    PabloAST * const u8scope4X = it4.createOr(u8scope4nonfinal, u8scope44);
    9292    it4.createAssign(anyscope, it4.createOr(anyscope, u8scope4X));
    93     PabloAST * const F0_invalid = it4.createAnd(it4.createAdvance(ccc.compileCC(makeCC(0xF0), it4), 1), ccc.compileCC(makeCC(0x80, 0x8F), it4));
    94     PabloAST * const F4_invalid = it4.createAnd(it4.createAdvance(ccc.compileCC(makeCC(0xF4), it4), 1), ccc.compileCC(makeCC(0x90, 0xBF), it4));
     93    PabloAST * const F0_invalid = it4.createAnd(it4.createAdvance(ccc.compileCC(makeByte(0xF0), it4), 1), ccc.compileCC(makeByte(0x80, 0x8F), it4));
     94    PabloAST * const F4_invalid = it4.createAnd(it4.createAdvance(ccc.compileCC(makeByte(0xF4), it4), 1), ccc.compileCC(makeByte(0x90, 0xBF), it4));
    9595    PabloAST * const FX_invalid = it4.createOr(F0_invalid, F4_invalid);
    9696    it4.createAssign(EF_invalid, it4.createOr(EF_invalid, FX_invalid));
     
    112112    it.createAssign(nonFinal, it.createAnd(nonFinal, u8valid));
    113113   
    114     PabloAST * u8single = pb.createAnd(ccc.compileCC(makeCC(0x00, 0x7F)), pb.createNot(u8invalid));
     114    PabloAST * u8single = pb.createAnd(ccc.compileCC(makeByte(0x00, 0x7F)), pb.createNot(u8invalid));
    115115    PabloAST * const initial = pb.createOr(u8single, valid_pfx, "initial");
    116116    PabloAST * const final = pb.createNot(pb.createOr(nonFinal, u8invalid), "final");
     
    137137    auto & pb = ccc.getBuilder();
    138138   
    139     PabloAST * u16hi_hi_surrogate = ccc.compileCC(makeCC(0xD800, 0xDBFF));    //u16hi_hi_surrogate = [\xD8-\xDB]
    140     PabloAST * u16hi_lo_surrogate = ccc.compileCC(makeCC(0xDC00, 0xDFFF));    //u16hi_lo_surrogate = [\xDC-\xDF]
     139    PabloAST * u16hi_hi_surrogate = ccc.compileCC(makeCC(0xD800, 0xDBFF, &cc::UTF16));    //u16hi_hi_surrogate = [\xD8-\xDB]
     140    PabloAST * u16hi_lo_surrogate = ccc.compileCC(makeCC(0xDC00, 0xDFFF, &cc::UTF16));    //u16hi_lo_surrogate = [\xDC-\xDF]
    141141   
    142142    PabloAST * invalidTemp = pb.createAdvance(u16hi_hi_surrogate, 1, "InvalidTemp");
     
    146146    PabloAST * nonFinal = pb.createAnd(u16hi_hi_surrogate, u16valid, "nonfinal");
    147147
    148     PabloAST * u16single_temp = pb.createOr(ccc.compileCC(makeCC(0x0000, 0xD7FF)), ccc.compileCC(makeCC(0xE000, 0xFFFF)));
     148    PabloAST * u16single_temp = pb.createOr(ccc.compileCC(makeCC(0x0000, 0xD7FF, &cc::UTF16)), ccc.compileCC(makeCC(0xE000, 0xFFFF, &cc::UTF16)));
    149149    PabloAST * u16single = pb.createAnd(u16single_temp, pb.createNot(u16invalid));
    150150
  • icGREP/icgrep-devel/icgrep/kernels/linebreak_kernel.cpp

    r5793 r5797  
    3535    CC_Compiler ccc(this, getInput(0));
    3636    auto & pb = ccc.getBuilder();
    37     PabloAST * LF = ccc.compileCC("LF", makeCC(0x0A), pb);
     37    PabloAST * LF = ccc.compileCC("LF", makeByte(0x0A), pb);
    3838    pb.createAssign(pb.createExtract(getOutput(0), pb.getInteger(0)), LF);
    3939}
     
    5757
    5858    PabloAST * const LF = pb.createExtract(getInput(1), ZERO, "LF");
    59     PabloAST * const CR = ccc.compileCC(makeCC(0x0D));
    60     PabloAST * const LF_VT_FF_CR = ccc.compileCC("LF,VT,FF,CR", makeCC(0x0A, 0x0D), pb);
     59    PabloAST * const CR = ccc.compileCC(makeByte(0x0D));
     60    PabloAST * const LF_VT_FF_CR = ccc.compileCC("LF,VT,FF,CR", makeByte(0x0A, 0x0D), pb);
    6161    Var * const LineBreak = pb.createVar("LineBreak", LF_VT_FF_CR);
    6262
     
    7474
    7575    // Check for Unicode Line Breaks
    76     PabloAST * u8pfx = ccc.compileCC(makeCC(0xC0, 0xFF));
     76    PabloAST * u8pfx = ccc.compileCC(makeByte(0xC0, 0xFF));
    7777    PabloBuilder it = PabloBuilder::Create(pb);
    7878    pb.createIf(u8pfx, it);
    79     PabloAST * u8pfx2 = ccc.compileCC(makeCC(0xC2, 0xDF), it);
    80     PabloAST * u8pfx3 = ccc.compileCC(makeCC(0xE0, 0xEF), it);
     79    PabloAST * u8pfx2 = ccc.compileCC(makeByte(0xC2, 0xDF), it);
     80    PabloAST * u8pfx3 = ccc.compileCC(makeByte(0xE0, 0xEF), it);
    8181
    8282    // Two-byte sequences
    8383    PabloBuilder it2 = PabloBuilder::Create(it);
    8484    it.createIf(u8pfx2, it2);
    85     PabloAST * NEL = it2.createAnd(it2.createAdvance(ccc.compileCC(makeCC(0xC2), it2), 1), ccc.compileCC(makeCC(0x85), it2), "NEL");
     85    PabloAST * NEL = it2.createAnd(it2.createAdvance(ccc.compileCC(makeByte(0xC2), it2), 1), ccc.compileCC(makeByte(0x85), it2), "NEL");
    8686    it2.createAssign(LineBreak, it2.createOr(LineBreak, NEL));
    8787
     
    8989    PabloBuilder it3 = PabloBuilder::Create(it);
    9090    it.createIf(u8pfx3, it3);
    91     PabloAST * E2_80 = it3.createAnd(it3.createAdvance(ccc.compileCC(makeCC(0xE2), it3), 1), ccc.compileCC(makeCC(0x80), it3));
    92     PabloAST * LS_PS = it3.createAnd(it3.createAdvance(E2_80, 1), ccc.compileCC(makeCC(0xA8,0xA9), it3), "LS_PS");
     91    PabloAST * E2_80 = it3.createAnd(it3.createAdvance(ccc.compileCC(makeByte(0xE2), it3), 1), ccc.compileCC(makeByte(0x80), it3));
     92    PabloAST * LS_PS = it3.createAnd(it3.createAdvance(E2_80, 1), ccc.compileCC(makeByte(0xA8,0xA9), it3), "LS_PS");
    9393    it3.createAssign(LineBreak, it3.createOr(LineBreak, LS_PS));
    9494
Note: See TracChangeset for help on using the changeset viewer.