Ignore:
Timestamp:
Jul 2, 2015, 4:51:32 PM (4 years ago)
Author:
nmedfort
Message:

Fix for SCX and updated property objects.

File:
1 edited

Legend:

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

    r4629 r4631  
    1818 ** ------------------------------------------------------------------------------------------------------------- */
    1919PabloAST * UCDCompiler::generateWithIfHierarchy(const RangeList & ifRanges, const UnicodeSet & set, PabloBuilder & entry) {
     20    // Pregenerate the suffix var outside of the if ranges. The DCE pass will either eliminate it if it's not used or the
     21    // code sinking pass will move appropriately into an inner if block.
     22    mSuffixVar = mCharacterClassCompiler.compileCC(makeCC(0x80, 0xBF), entry);
    2023    return generateWithIfHierarchy(ifRanges, set, 0, CC::UNICODE_MAX, entry);
    2124}
     
    4043    const auto outer = outerRanges(enclosed);
    4144    const auto inner = innerRanges(enclosed);
    42 
    4345    for (const auto range : outer) {
    4446        codepoint_t lo, hi;
     
    104106            // Use the byte class compiler to generate matches for these codepoints.
    105107            const auto bytes = byteDefinitions(ranges, byte_no);
    106             PabloAST * testVar = mCharacterClassCompiler.compileCC(makeCC(bytes), block);
     108            PabloAST * var = mCharacterClassCompiler.compileCC(makeCC(bytes), block);
    107109            if (byte_no > 1) {
    108                 testVar = block.createAnd(testVar, block.createAdvance(makePrefix(lo, byte_no, block, prefix), 1));
    109             }
    110             target = block.createOr(target, testVar);
     110                var = block.createAnd(var, block.createAdvance(makePrefix(lo, byte_no, block, prefix), 1));
     111            }
     112            target = block.createOr(target, var);
    111113        }
    112114        else {
     
    132134                            var = block.createAnd(block.createAdvance(prefix, 1), var);
    133135                        }
    134                         PabloAST * suffixVar = mCharacterClassCompiler.compileCC(mSuffix, block);
    135                         for (auto i = byte_no; i < UTF8_Encoder::length(lo); ++i) {
    136                             var = block.createAnd(suffixVar, block.createAdvance(var, 1));
     136                        for (unsigned i = byte_no; i != UTF8_Encoder::length(lo); ++i) {
     137                            var = block.createAnd(mSuffixVar, block.createAdvance(var, 1));
    137138                        }
    138139                        target = block.createOr(target, var);
     
    140141                }
    141142                else { // lbyte == hbyte
    142                     PabloAST * byteVar = mCharacterClassCompiler.compileCC(makeCC(lo_byte, hi_byte), block);
    143                     PabloAST * infix = byteVar;
     143                    PabloAST * var = mCharacterClassCompiler.compileCC(makeCC(lo_byte, hi_byte), block);
    144144                    if (byte_no > 1) {
    145                         infix = block.createAnd(block.createAdvance(prefix ? prefix : byteVar, 1), byteVar);
     145                        var = block.createAnd(block.createAdvance(prefix ? prefix : var, 1), var);
    146146                    }
    147147                    if (byte_no < UTF8_Encoder::length(lo)) {
    148                         target = sequenceGenerator(lo, hi, byte_no + 1, block, target, infix);
     148                        target = sequenceGenerator(lo, hi, byte_no + 1, block, target, var);
    149149                    }
    150150                }
     
    152152        }
    153153    }
    154 
    155154    return target;
    156155}
     
    431430//    llvm::raw_os_ostream out(std::cerr);
    432431
     432//    set.dump(out);
     433
    433434//    for (auto range : set) {
    434435//        out << range.first << ',' << range.second << "\n";
     
    445446UCDCompiler::UCDCompiler(cc::CC_Compiler & ccCompiler)
    446447: mCharacterClassCompiler(ccCompiler)
    447 , mSuffix(makeCC(0x80, 0xBF)) { }
    448 
    449 }
     448, mSuffixVar(nullptr) { }
     449
     450}
Note: See TracChangeset for help on using the changeset viewer.