Changeset 5798


Ignore:
Timestamp:
Dec 21, 2017, 9:42:16 PM (9 months ago)
Author:
cameron
Message:

Use Alphabet=Byte in to_utf8, u8u32, UCD compiler

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

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/UCD/ucd_compiler.cpp

    r5748 r5798  
    11#include "ucd_compiler.hpp"
     2#include <cc/alphabet.h>
    23#include <cc/cc_compiler.h>
    34#include <UCD/unicode_set.h>
     
    145146    // Pregenerate the suffix var outside of the if ranges. The DCE pass will either eliminate it if it's not used or the
    146147    // code sinking pass will move appropriately into an inner if block.
    147     CC *  suffix = makeCC(0x80, 0xBF);
     148    CC *  suffix = makeByte(0x80, 0xBF);
    148149    assert (!suffix->empty());
    149150    mSuffixVar = mCharacterClassCompiler.compileCC(suffix, entry);
     
    256257            // We have a single byte remaining to match for all code points in this CC.
    257258            // Use the byte class compiler to generate matches for these codepoints.
    258             PabloAST * var = mCharacterClassCompiler.compileCC(makeCC(byteDefinitions(ranges, byte_no, isUTF_16)), builder);
     259            PabloAST * var = mCharacterClassCompiler.compileCC(makeCC(byteDefinitions(ranges, byte_no, isUTF_16), &Byte), builder);
    259260            if (byte_no > 1) {
    260261                var = builder.createAnd(var, builder.createAdvance(makePrefix(lo, byte_no, builder, prefix), 1));
     
    278279                        target = sequenceGenerator(mid, hi, byte_no, builder, target, prefix);
    279280                    } else { // we have a prefix group of type (a)
    280                         PabloAST * var = mCharacterClassCompiler.compileCC(makeCC(lo_byte, hi_byte), builder);
     281                        PabloAST * var = mCharacterClassCompiler.compileCC(makeByte(lo_byte, hi_byte), builder);
    281282                        if (byte_no > 1) {
    282283                            var = builder.createAnd(builder.createAdvance(prefix, 1), var);
     
    288289                    }
    289290                } else { // lbyte == hbyte
    290                     PabloAST * var = mCharacterClassCompiler.compileCC(makeCC(lo_byte, hi_byte), builder);
     291                    PabloAST * var = mCharacterClassCompiler.compileCC(makeByte(lo_byte, hi_byte), builder);
    291292                    if (byte_no > 1) {
    292293                        var = builder.createAnd(builder.createAdvance(prefix ? prefix : var, 1), var);
     
    334335            }
    335336        }
    336         PabloAST * cc = mCharacterClassCompiler.compileCC(makeCC(lo_byte, hi_byte), builder);
     337        PabloAST * cc = mCharacterClassCompiler.compileCC(makeByte(lo_byte, hi_byte), builder);
    337338        target = builder.createAnd(cc, target);
    338339    } else if (lo_byte == hi_byte) {
    339         PabloAST * cc = mCharacterClassCompiler.compileCC(makeCC(lo_byte, hi_byte), builder);
     340        PabloAST * cc = mCharacterClassCompiler.compileCC(makeByte(lo_byte, hi_byte), builder);
    340341        target = builder.createAnd(cc, target);
    341342        target = builder.createAdvance(target, 1);
     
    367368    bool isUTF_16 = mCharacterClassCompiler.isUTF_16();
    368369    for (unsigned i = 1; i != byte_no; ++i) {
    369         const CC * const cc = makeCC(encodingByte(cp, i, isUTF_16));
     370        const CC * const cc = makeByte(encodingByte(cp, i, isUTF_16));
    370371        PabloAST * var = mCharacterClassCompiler.compileCC(cc, builder);
    371372        if (i > 1) {
  • icGREP/icgrep-devel/icgrep/kernels/u8u32_kernel.cpp

    r5549 r5798  
    5353    Var * error_mask = main.createVar("error_mask", zeroes);
    5454   
    55     PabloAST * ASCII = ccc.compileCC("ASCII", re::makeCC(0x0, 0x7F), main);
     55    PabloAST * ASCII = ccc.compileCC("ASCII", re::makeByte(0x0, 0x7F), main);
    5656    PabloBuilder ascii = PabloBuilder::Create(main);
    5757    for (int i = 1; i <= 7; i++) {
     
    6060    main.createIf(ASCII, ascii);
    6161   
    62     PabloAST * u8pfx = ccc.compileCC("u8pfx", re::makeCC(0xC0, 0xFF), main);
    63     PabloAST * nonASCII = ccc.compileCC("u8pfx", re::makeCC(0x80, 0xFF), main);
     62    PabloAST * u8pfx = ccc.compileCC("u8pfx", re::makeByte(0xC0, 0xFF), main);
     63    PabloAST * nonASCII = ccc.compileCC("u8pfx", re::makeByte(0x80, 0xFF), main);
    6464    PabloBuilder it = PabloBuilder::Create(main);
    6565    main.createIf(nonASCII, it);
    6666   
    6767    Var * u8invalid = it.createVar("u8invalid", zeroes);
    68     PabloAST * u8pfx2 = ccc.compileCC(re::makeCC(0xC2, 0xDF), it);
    69     PabloAST * u8pfx3 = ccc.compileCC(re::makeCC(0xE0, 0xEF), it);
    70     PabloAST * u8pfx4 = ccc.compileCC(re::makeCC(0xF0, 0xF4), it);
    71     PabloAST * u8suffix = ccc.compileCC("u8suffix", re::makeCC(0x80, 0xBF), it);
     68    PabloAST * u8pfx2 = ccc.compileCC(re::makeByte(0xC2, 0xDF), it);
     69    PabloAST * u8pfx3 = ccc.compileCC(re::makeByte(0xE0, 0xEF), it);
     70    PabloAST * u8pfx4 = ccc.compileCC(re::makeByte(0xF0, 0xF4), it);
     71    PabloAST * u8suffix = ccc.compileCC("u8suffix", re::makeByte(0x80, 0xBF), it);
    7272   
    7373    //
     
    101101    PabloAST * u8scope33 = it3.createAdvance(u8scope32, 1, "u8scope33");
    102102    it3.createAssign(u8scope3X, it3.createOr(u8scope32, u8scope33));
    103     PabloAST * E0_invalid = it3.createAnd(it3.createAdvance(ccc.compileCC(re::makeCC(0xE0), it3), 1), ccc.compileCC(re::makeCC(0x80, 0x9F), it3));
    104     PabloAST * ED_invalid = it3.createAnd(it3.createAdvance(ccc.compileCC(re::makeCC(0xED), it3), 1), ccc.compileCC(re::makeCC(0xA0, 0xBF), it3));
     103    PabloAST * E0_invalid = it3.createAnd(it3.createAdvance(ccc.compileCC(re::makeByte(0xE0), it3), 1), ccc.compileCC(re::makeByte(0x80, 0x9F), it3));
     104    PabloAST * ED_invalid = it3.createAnd(it3.createAdvance(ccc.compileCC(re::makeByte(0xED), it3), 1), ccc.compileCC(re::makeByte(0xA0, 0xBF), it3));
    105105    it3.createAssign(EX_invalid, it3.createOr(E0_invalid, ED_invalid));
    106106   
     
    134134    it4.createAssign(u8scope4nonfinal, it4.createOr(u8scope42, u8scope43));
    135135    it4.createAssign(u8scope4X, it4.createOr(u8scope4nonfinal, u8scope44));
    136     PabloAST * F0_invalid = it4.createAnd(it4.createAdvance(ccc.compileCC(re::makeCC(0xF0), it4), 1), ccc.compileCC(re::makeCC(0x80, 0x8F), it4));
    137     PabloAST * F4_invalid = it4.createAnd(it4.createAdvance(ccc.compileCC(re::makeCC(0xF4), it4), 1), ccc.compileCC(re::makeCC(0x90, 0xBF), it4));
     136    PabloAST * F0_invalid = it4.createAnd(it4.createAdvance(ccc.compileCC(re::makeByte(0xF0), it4), 1), ccc.compileCC(re::makeByte(0x80, 0x8F), it4));
     137    PabloAST * F4_invalid = it4.createAnd(it4.createAdvance(ccc.compileCC(re::makeByte(0xF4), it4), 1), ccc.compileCC(re::makeByte(0x90, 0xBF), it4));
    138138    it4.createAssign(FX_invalid, it4.createOr(F0_invalid, F4_invalid));
    139139
     
    172172    it.createAssign(error_mask, u8invalid);
    173173   
    174     it.createAssign(delmask, it.createOr(it.createOr(del3, del4), ccc.compileCC(re::makeCC(0xC0, 0xFF), it)));
     174    it.createAssign(delmask, it.createOr(it.createOr(del3, del4), ccc.compileCC(re::makeByte(0xC0, 0xFF), it)));
    175175   
    176176    Var * output = this->getOutputStreamVar("u32bit");
  • icGREP/icgrep-devel/icgrep/re/to_utf8.cpp

    r5782 r5798  
    2929    const codepoint_t lunit = UTF<8>::nthCodeUnit(lo, index);
    3030    if (index == lgth) {
    31         return makeCC(lunit, hunit);
     31        return makeByte(lunit, hunit);
    3232    }
    3333    else if (hunit == lunit) {
    34         return makeSeq({makeCC(hunit), rangeCodeUnits(lo, hi, index + 1, lgth)});
     34        return makeSeq({makeByte(hunit), rangeCodeUnits(lo, hi, index + 1, lgth)});
    3535    }
    3636    else {
     
    4545        }
    4646        else {
    47             return makeSeq({makeCC(lunit, hunit), rangeCodeUnits(lo, hi, index + 1, lgth)});
     47            return makeSeq({makeByte(lunit, hunit), rangeCodeUnits(lo, hi, index + 1, lgth)});
    4848        }
    4949    }
Note: See TracChangeset for help on using the changeset viewer.