Ignore:
Timestamp:
Jun 29, 2015, 3:53:32 PM (4 years ago)
Author:
nmedfort
Message:

Temporary check-in

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

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/CMakeLists.txt

    r4618 r4623  
    108108add_executable(icgrep icgrep.cpp do_grep.cpp compiler.cpp)
    109109
     110target_link_libraries (PabloADT ${REQ_LLVM_LIBRARIES})
    110111target_link_libraries (CCADT PabloADT RegExpADT)
    111 target_link_libraries (PabloADT ${REQ_LLVM_LIBRARIES})
     112target_link_libraries (UCDlib PabloADT CCADT)
     113target_link_libraries (RegExpADT PabloADT CCADT UCDlib)
    112114target_link_libraries (icgrep UCDlib PabloADT RegExpADT CCADT ${REQ_LLVM_LIBRARIES})
    113115
  • icGREP/icgrep-devel/icgrep/UCD/ucd_compiler.cpp

    r4622 r4623  
    11#include "ucd_compiler.hpp"
     2#include <cc/cc_compiler.h>
     3#include <UCD/unicode_set.h>
    24#include <utf8_encoder.h>
    35
     
    1416 * @return the output stream with a 1-bit in any position of a character in the unicode set
    1517 ** ------------------------------------------------------------------------------------------------------------- */
    16 inline PabloAST * UCDCompiler::generateWithIfHierarchy(const RangeList & ifRanges, const UnicodeSet & set, PabloBuilder & entry) {
     18PabloAST * UCDCompiler::generateWithIfHierarchy(const RangeList & ifRanges, const UnicodeSet & set, PabloBuilder & entry) {
    1719    return generateWithIfHierarchy(ifRanges, set, 0, CC::UNICODE_MAX, entry);
    1820}
     
    328330 * @return the output stream with a 1-bit in any position of a character in the unicode set
    329331 ** ------------------------------------------------------------------------------------------------------------- */
    330 inline PabloAST * UCDCompiler::generateWithDefaultIfHierarchy(const UnicodeSet & set, PabloBuilder & entry) {
    331 
    332     const RangeList ifRanges = {
     332PabloAST * UCDCompiler::generateWithDefaultIfHierarchy(const UnicodeSet & set, PabloBuilder & entry) {
     333
     334    const RangeList defaultIfHierachy = {
    333335        // Non-ASCII
    334336        {0x80, 0x10FFFF},
     
    417419        {0x10000, 0x10FFFF}};
    418420
    419     return generateWithIfHierarchy(ifRanges, set, entry);
     421    return generateWithIfHierarchy(defaultIfHierachy, set, entry);
    420422}
    421423
  • icGREP/icgrep-devel/icgrep/UCD/ucd_compiler.hpp

    r4622 r4623  
    33
    44#include <vector>
    5 #include <cc/cc_compiler.h>
    65#include <re/re_cc.h>
    7 #include <UCD/unicode_set.h>
    8 #include <unordered_map>
    96
    10 class Encoding;
     7namespace cc {
     8    class CC_Compiler;
     9}
     10
     11namespace pablo {
     12    class PabloBuilder;
     13    class PabloAST;
     14}
    1115
    1216namespace UCD {
     17
     18class UnicodeSet;
    1319
    1420class UCDCompiler {
     
    3844
    3945    PabloAST * ifTestCompiler(const codepoint_t lo, const codepoint_t hi, PabloBuilder & block);
     46
    4047    PabloAST * ifTestCompiler(const codepoint_t lo, const codepoint_t hi, const unsigned byte_no, PabloBuilder & block, PabloAST * target);
    4148
  • icGREP/icgrep-devel/icgrep/re/re_compiler.cpp

    r4622 r4623  
    2121#include <cc/cc_namemap.hpp>
    2222#include <pablo/codegenstate.h>
    23 #include <UCD/ucd_compiler.hpp>
    24 
     23#include <UCD/DerivedGeneralCategory.h>
    2524#include <assert.h>
    2625#include <stdexcept>
     
    3534static cl::opt<bool> DisableMatchStar("disable-matchstar", cl::init(false),
    3635                     cl::desc("disable MatchStar optimization"), cl::cat(fREcompilationOptions));
    37 static cl::opt<bool> DisableUnicodeMatchStar("disable-Unicode-matchstar", cl::init(false),
     36static cl::opt<bool> DisableUnicodeMatchStar("disable-unicode-matchstar", cl::init(false),
    3837                     cl::desc("disable Unicode MatchStar optimization"), cl::cat(fREcompilationOptions));
    39 
    40 static cl::opt<bool> DisableUnicodeLineBreak("disable-Unicode-linebreak", cl::init(false),
     38static cl::opt<bool> DisableUnicodeLineBreak("disable-unicode-linebreak", cl::init(false),
    4139                     cl::desc("disable Unicode line breaks - use LF only"), cl::cat(fREcompilationOptions));
     40static cl::opt<bool> DisablePregeneratedUnicode("disable-pregenerated-unicode", cl::init(false),
     41                     cl::desc("disable use of pregenerated Unicode character class sets"), cl::cat(fREcompilationOptions));
    4242
    4343
     
    4949RE_Compiler::RE_Compiler(cc::CC_Compiler & ccCompiler)
    5050: mCCCompiler(ccCompiler)
    51 , mPB(ccCompiler.getBuilder().getPabloBlock(), ccCompiler.getBuilder())
    5251, mLineFeed(nullptr)
     52, mCRLF(nullptr)
     53, mUnicodeLineBreak(nullptr)
    5354, mInitial(nullptr)
    5455, mNonFinal(nullptr)
    5556, mFinal(nullptr)
     57, mWhileTest(nullptr)
    5658, mStarDepth(0)
     59, mPB(ccCompiler.getBuilder().getPabloBlock(), ccCompiler.getBuilder())
     60, mUCDCompiler(ccCompiler)
    5761{
    5862
     
    265269    }
    266270    else if (name->getType() == Name::Type::UnicodeProperty) {
    267         var = mPB.createCall(name->getName());
    268         // UCD::UCDCompiler ucdCompiler(mCCCompiler);
     271        if (DisablePregeneratedUnicode) {
     272            // Note: using a fixed set while testing whether the UCD compiler works.
     273            var = mUCDCompiler.generateWithDefaultIfHierarchy(UCD::GC_ns::z_Set, pb);
     274        }
     275        else {
     276            var = mPB.createCall(name->getName());
     277        }
    269278    }
    270279    else {
    271280        throw std::runtime_error("Unresolved name " + name->getName());
    272281    }
    273 
    274282    var = pb.createAnd(var, pb.createNot(UNICODE_LINE_BREAK ? mUnicodeLineBreak : mLineFeed));
    275283    name->setCompiled(var);
  • icGREP/icgrep-devel/icgrep/re/re_compiler.h

    r4622 r4623  
    1212#include <cc/cc_compiler.h>
    1313#include <pablo/builder.hpp>
     14#include <UCD/ucd_compiler.hpp>
    1415#include <string>
    1516#include <list>
     
    8687
    8788    cc::CC_Compiler &                               mCCCompiler;
    88     pablo::PabloBuilder                             mPB;
    8989    pablo::Assign *                                 mLineFeed;
    9090    pablo::PabloAST *                               mCRLF;
     
    9595    pablo::PabloAST *                               mWhileTest;
    9696    int                                             mStarDepth;
     97    pablo::PabloBuilder                             mPB;
     98    UCD::UCDCompiler                                mUCDCompiler;
    9799};
    98100
Note: See TracChangeset for help on using the changeset viewer.