Changeset 4820


Ignore:
Timestamp:
Oct 4, 2015, 9:11:55 PM (2 years ago)
Author:
nmedfort
Message:

Removed CC_NameMap

Location:
icGREP/icgrep-devel/icgrep
Files:
2 deleted
8 edited

Legend:

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

    r4801 r4820  
    7878add_library(RegExpADT re/re_re.cpp re/re_cc.cpp re/re_rep.cpp re/re_diff.cpp re/re_intersect.cpp re/printer_re.cpp)
    7979add_library(RegExpCompiler re/re_parser.cpp re/parsefailure.cpp re/re_nullable.cpp re/re_simplifier.cpp re/re_compiler.cpp re/re_analysis.cpp)
    80 add_library(CCADT cc/cc_namemap.cpp cc/cc_compiler.cpp utf8_encoder.cpp UCD/CaseFolding_txt.cpp)
     80add_library(CCADT cc/cc_compiler.cpp utf8_encoder.cpp UCD/CaseFolding_txt.cpp)
    8181add_library(UCDlib UCD/unicode_set.cpp UCD/ucd_compiler.cpp UCD/PropertyObjects.cpp UCD/resolve_properties.cpp)
    8282
  • icGREP/icgrep-devel/icgrep/UCD/resolve_properties.cpp

    r4814 r4820  
    1010#include <re/re_diff.h>
    1111#include <re/re_parser.h>
    12 #include <cc/cc_namemap.hpp>
    1312#include "UCD/PropertyAliases.h"
    1413#include "UCD/PropertyObjects.h"
  • icGREP/icgrep-devel/icgrep/cc/cc_compiler.cpp

    r4815 r4820  
    1717#include <re/re_intersect.h>
    1818#include <re/re_assertion.h>
    19 #include <cc/cc_namemap.hpp>
    2019#include <pablo/codegenstate.h>
    2120#include <pablo/builder.hpp>
  • icGREP/icgrep-devel/icgrep/icgrep-devel.files

    r4814 r4820  
    374374re/re_rep.cpp
    375375re/re_alt.h
     376re/re_parser.cpp
     377re/re_name.h
     378re/re_parser.h
     379re/re_memoizer.hpp
     380re/re_compiler.cpp
     381re/re_cc.h
     382re/re_cc.cpp
     383re/re_compiler.h
     384re/re_nullable.cpp
     385re/printer_re.cpp
     386re/re_analysis.cpp
     387re/re_diff.h
     388re/re_assertion.h
     389re/re_re.h
     390re/re_end.h
     391re/re_simplifier.h
     392re/re_diff.cpp
     393re/re_re.cpp
     394re/re_intersect.h
     395re/re_simplifier.cpp
     396re/re_nullable.h
     397re/re_start.h
     398re/parsefailure.h
     399re/re_intersect.cpp
     400re/re_seq.h
     401re/parsefailure.cpp
     402re/re_any.h
     403re/re_rep.h
     404re/printer_re.h
     405re/re_analysis.h
     406re/re_rep.cpp
     407re/re_alt.h
  • icGREP/icgrep-devel/icgrep/pablo/pablo_compiler.cpp

    r4816 r4820  
    1111#include <pablo/printer_pablos.h>
    1212#include <pablo/function.h>
    13 #include <cc/cc_namemap.hpp>
    1413#include <re/re_name.h>
    1514#include <stdexcept>
  • icGREP/icgrep-devel/icgrep/re/re_compiler.cpp

    r4819 r4820  
    1818#include <re/re_assertion.h>
    1919#include <re/re_analysis.h>
     20#include <re/re_memoizer.hpp>
    2021#include <re/printer_re.h>
    21 #include <cc/cc_namemap.hpp>
    2222#include <pablo/codegenstate.h>
    2323#include <UCD/ucd_compiler.hpp>
     
    194194RE * RE_Compiler::resolveUnicodeProperties(RE * re) {
    195195
    196     using PropertyMap = std::map<std::string, RE *>;
    197     using NamespacedPropertyMap = std::map<std::pair<std::string, std::string>, RE *>;
    198     using NameMap = UCD::UCDCompiler::NameMap;
    199 
    200     PropertyMap                 propertyMap;
    201     NamespacedPropertyMap       namespacedPropertyMap;
    202     NameMap                     nameMap;
     196    Memoizer memoizer;
    203197
    204198    std::function<RE*(RE*)> resolve = [&](RE * re) -> RE * {
    205199        if (Name * name = dyn_cast<Name>(re)) {
    206             if (LLVM_LIKELY(name->getDefinition() != nullptr)) {
    207                 name->setDefinition(resolve(name->getDefinition()));
    208             } else if (LLVM_LIKELY(name->getType() == Name::Type::UnicodeProperty)) {
    209                 // Attempt to look up an equivalently named Name object
    210                 if (name->hasNamespace()) {
    211                     const auto f = namespacedPropertyMap.find(std::make_pair(name->getNamespace(), name->getName()));
    212                     if (f != namespacedPropertyMap.end()) {
    213                         if (f->second != name) {
    214                             return f->second;
     200            auto f = memoizer.find(name);
     201            if (f == memoizer.end()) {
     202                if (LLVM_LIKELY(name->getDefinition() != nullptr)) {
     203                    name->setDefinition(resolve(name->getDefinition()));
     204                } else if (LLVM_LIKELY(name->getType() == Name::Type::UnicodeProperty)) {
     205                    if (UCD::resolvePropertyDefinition(name)) {
     206                        resolve(name->getDefinition());
     207                    } else {
     208                        #ifndef DISABLE_PREGENERATED_UCD_FUNCTIONS
     209                        if (UsePregeneratedUnicode) {
     210                            const std::string functionName = UCD::resolvePropertyFunction(name);
     211                            const UCD::ExternalProperty & ep = UCD::resolveExternalProperty(functionName);
     212                            Call * call = mPB.createCall(Prototype::Create(functionName, std::get<1>(ep), std::get<2>(ep), std::get<0>(ep)), mCCCompiler.getBasisBits());
     213                            name->setCompiled(mPB.createAnd(call, mNonLineBreak));
     214                        } else {
     215                        #endif
     216                            name->setDefinition(makeCC(std::move(UCD::resolveUnicodeSet(name))));
     217                        #ifndef DISABLE_PREGENERATED_UCD_FUNCTIONS
    215218                        }
     219                        #endif
    216220                    }
    217                     namespacedPropertyMap.insert(std::make_pair(std::make_pair(name->getNamespace(), name->getName()), name));
    218221                } else {
    219                     const auto f = propertyMap.find(name->getName());
    220                     if (f != propertyMap.end()) {
    221                         if (f->second != name) {
    222                             return f->second;
    223                         }
    224                     }
    225                     propertyMap.insert(std::make_pair(name->getName(), name));
    226                 }
    227                 if (UCD::resolvePropertyDefinition(name)) {
    228                     resolve(name->getDefinition());
    229                 } else {
    230                     #ifndef DISABLE_PREGENERATED_UCD_FUNCTIONS
    231                     if (UsePregeneratedUnicode) {
    232                         const std::string functionName = UCD::resolvePropertyFunction(name);
    233                         const UCD::ExternalProperty & ep = UCD::resolveExternalProperty(functionName);
    234                         Call * call = mPB.createCall(Prototype::Create(functionName, std::get<1>(ep), std::get<2>(ep), std::get<0>(ep)), mCCCompiler.getBasisBits());
    235                         name->setCompiled(mPB.createAnd(call, mNonLineBreak));
    236                     } else {
    237                     #endif
    238                         name->setDefinition(makeCC(std::move(UCD::resolveUnicodeSet(name))));
    239                     #ifndef DISABLE_PREGENERATED_UCD_FUNCTIONS
    240                     }
    241                     #endif
     222                    throw std::runtime_error("All non-unicode-property Name objects should have been defined prior to Unicode property resolution.");
    242223                }
    243224            } else {
    244                 throw std::runtime_error("All non-unicode-property Name objects should have been defined prior to Unicode property resolution.");
     225                return *f;
    245226            }
    246227        } else if (Seq * seq = dyn_cast<Seq>(re)) {
     
    288269        return re;
    289270    };
     271
     272    UCD::UCDCompiler::NameMap nameMap;
    290273
    291274    std::function<void(RE*)> gather = [&](RE * re) {
  • icGREP/icgrep-devel/icgrep/re/re_memoizer.hpp

    r4819 r4820  
    2222}
    2323
    24 struct Memoizer : private std::set<RE *, MemoizerComparator> {
     24struct Memoizer : public std::set<RE *, MemoizerComparator> {
    2525
    2626    inline Name * memoize(CC * cc) {
  • icGREP/icgrep-devel/icgrep/toolchain.cpp

    r4819 r4820  
    3434#include <utf8_encoder.h>
    3535#include <cc/cc_compiler.h>
    36 #include <cc/cc_namemap.hpp>
    3736#include <pablo/pablo_compiler.h>
    3837#include <pablo/optimizers/pablo_simplifier.hpp>
Note: See TracChangeset for help on using the changeset viewer.