Changeset 3974 for icGREP


Ignore:
Timestamp:
Aug 8, 2014, 12:25:18 PM (5 years ago)
Author:
daled
Message:

Removing old artifacts.

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

Legend:

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

    r3955 r3974  
    4343
    4444
     45
    4546#include_directories("${PROJECT_BINARY_DIR}")
    4647include_directories("${PROJECT_SOURCE_DIR}")
     
    5051 
    5152# add the executable
    52 add_executable(icgrep icgrep.cpp llvm_gen.cpp llvm_gen_helper.cpp utf_encoding.cpp unicode_categories.cpp cc_codegenobject.cpp  cc_compiler.cpp  cc_compiler_helper.cpp re_simplifier.cpp re_reducer.cpp re_nullable.cpp re_compiler.cpp pbix_compiler.cpp  symbol_generator.cpp utf8_encoder.cpp)
     53add_executable(icgrep icgrep.cpp llvm_gen.cpp categories_Nd.h llvm_gen_helper.cpp utf_encoding.cpp unicode_categories.cpp cc_codegenobject.cpp  cc_compiler.cpp  cc_compiler_helper.cpp re_simplifier.cpp re_reducer.cpp re_nullable.cpp re_compiler.cpp pbix_compiler.cpp  symbol_generator.cpp utf8_encoder.cpp)
    5354
    5455target_link_libraries (icgrep PabloADT RegExpADT ${REQ_LLVM_LIBRARIES})
  • icGREP/icgrep-devel/icgrep/pbix_compiler.cpp

    r3965 r3974  
    5959    std::string gs_m0 = symgen.gensym("start_marker");
    6060    cg_state.stmtsl.push_back(new Assign(gs_m0, new All(1)));
    61     cg_state.newsym = gs_m0;
    62 
    63     //Set the 'internal.initial' bit stream for the utf-8 multi-byte encoding.
    64     std::string gs_initial = symgen.gensym("internal.initial");
    65     m_name_map.insert(make_pair("internal.initial", gs_initial));
    66     cg_state.stmtsl.push_back(new Assign(gs_initial, new Or(new Or( new Or( new And(new Var(m_name_map.find("UTF8-Prefix2")->second),
    67         new Var(cg_state.newsym)),  new And(new Var(m_name_map.find("UTF8-SingleByte")->second), new Var(cg_state.newsym))),
    68         new And(new Var(m_name_map.find("UTF8-Prefix3")->second), new Var(cg_state.newsym))),
    69         new And(new Var(m_name_map.find("UTF8-Prefix4")->second), new Var(cg_state.newsym)))));
    70     cg_state.newsym = gs_initial;
    71 
    72     //Set the 'internal.nonfinal' bit stream for the utf-8 multi-byte encoding.
    73     cg_state.newsym = gs_m0;
    74     std::string gs_nonfinal = symgen.gensym("internal.nonfinal");
    75     m_name_map.insert(make_pair("internal.nonfinal", gs_nonfinal));
    76     cg_state.stmtsl.push_back(new Assign(gs_nonfinal, new Or(new Or(new Or(new Or(new Or( new And(new Var(m_name_map.find("UTF8-Prefix3")->second),
    77         new Var(cg_state.newsym)),  new And(new Var(m_name_map.find("UTF8-Prefix2")->second), new Var(cg_state.newsym))),
    78         new Advance( new And(new Var(m_name_map.find("UTF8-Prefix3")->second), new Var(cg_state.newsym)))),
    79         new And(new Var(m_name_map.find("UTF8-Prefix4")->second), new Var(cg_state.newsym))), new Advance(
    80         new And(new Var(m_name_map.find("UTF8-Prefix4")->second), new Var(cg_state.newsym)))), new Advance(
    81         new Advance( new And(new Var(m_name_map.find("UTF8-Prefix4")->second), new Var(cg_state.newsym)))))));
    82     cg_state.newsym = gs_nonfinal;
     61
     62    if (unicode_re(re))
     63    {
     64        cg_state.newsym = gs_m0;
     65        //Set the 'internal.initial' bit stream for the utf-8 multi-byte encoding.
     66        std::string gs_initial = symgen.gensym("internal.initial");
     67        m_name_map.insert(make_pair("internal.initial", gs_initial));
     68        cg_state.stmtsl.push_back(new Assign(gs_initial, new Or(new Or( new Or( new And(new Var(m_name_map.find("UTF8-Prefix2")->second),
     69            new Var(cg_state.newsym)),  new And(new Var(m_name_map.find("UTF8-SingleByte")->second), new Var(cg_state.newsym))),
     70            new And(new Var(m_name_map.find("UTF8-Prefix3")->second), new Var(cg_state.newsym))),
     71            new And(new Var(m_name_map.find("UTF8-Prefix4")->second), new Var(cg_state.newsym)))));
     72        cg_state.newsym = gs_initial;
     73
     74        //Set the 'internal.nonfinal' bit stream for the utf-8 multi-byte encoding.
     75        cg_state.newsym = gs_m0;
     76        std::string gs_nonfinal = symgen.gensym("internal.nonfinal");
     77        m_name_map.insert(make_pair("internal.nonfinal", gs_nonfinal));
     78        cg_state.stmtsl.push_back(new Assign(gs_nonfinal, new Or(new Or(new Or(new Or(new Or( new And(new Var(m_name_map.find("UTF8-Prefix3")->second),
     79            new Var(cg_state.newsym)),  new And(new Var(m_name_map.find("UTF8-Prefix2")->second), new Var(cg_state.newsym))),
     80            new Advance( new And(new Var(m_name_map.find("UTF8-Prefix3")->second), new Var(cg_state.newsym)))),
     81            new And(new Var(m_name_map.find("UTF8-Prefix4")->second), new Var(cg_state.newsym))), new Advance(
     82            new And(new Var(m_name_map.find("UTF8-Prefix4")->second), new Var(cg_state.newsym)))), new Advance(
     83            new Advance( new And(new Var(m_name_map.find("UTF8-Prefix4")->second), new Var(cg_state.newsym)))))));
     84        cg_state.newsym = gs_nonfinal;
     85    }
    8386
    8487    cg_state.newsym = gs_m0;
     
    268271}
    269272
     273bool Pbix_Compiler::unicode_re(RE *re)
     274{
     275    bool found = false;
     276
     277    return unicode_re_helper(re, found);
     278}
     279
     280bool Pbix_Compiler::unicode_re_helper(RE *re, bool found)
     281{
     282    if (!found)
     283    {
     284        if (Name* name = dynamic_cast<Name*>(re))
     285        {
     286            if ((name->getType() == Name::UnicodeCategory) || (name->getType() == Name::Unicode))
     287            {
     288                found = true;
     289            }
     290        }
     291        else if (Seq* re_seq = dynamic_cast<Seq*>(re))
     292        {
     293            std::list<RE*>::iterator it;
     294            for (it = re_seq->GetREList()->begin(); it != re_seq->GetREList()->end(); ++it)
     295            {
     296                found = unicode_re_helper(*it, found);
     297                if (found) break;
     298            }
     299        }
     300        else if (Alt* re_alt = dynamic_cast<Alt*>(re))
     301        {
     302            std::list<RE*>::iterator it;
     303            for (it = re_alt->GetREList()->begin(); it != re_alt->GetREList()->end(); ++it)
     304            {
     305                found = unicode_re_helper(*it, found);
     306                if (found) break;
     307            }
     308        }
     309        else if (Rep* rep = dynamic_cast<Rep*>(re))
     310        {
     311            found = unicode_re_helper(rep->getRE(), found);
     312        }
     313    }
     314
     315    return found;
     316}
  • icGREP/icgrep-devel/icgrep/pbix_compiler.h

    r3955 r3974  
    6565    CodeGenState Alt_helper(std::list<RE*>* lst, std::list<RE*>::const_iterator it, CodeGenState cg_state);
    6666
     67    bool unicode_re(RE* re);
     68    bool unicode_re_helper(RE* re, bool found);
     69
    6770    SymbolGenerator symgen;
    6871    std::map<std::string, std::string> m_name_map;
  • icGREP/icgrep-devel/icgrep/re_compiler.cpp

    r3961 r3974  
    3636
    3737    //Print to the terminal the AST that was generated by the parser before adding the UTF encoding:
    38     //std::cout << "\nParser:\n" + Printer_RE::PrintRE(re_ast) + "\n" << std::endl;
     38    std::cout << "\nParser:\n" + Printer_RE::PrintRE(re_ast) + "\n" << std::endl;
    3939
    4040    //Add the UTF encoding.
     
    5353
    5454    //Print to the terminal the AST that was generated by the utf8 encoder.
    55     //std::cout << "\nUTF8-encoder:\n" + Printer_RE::PrintRE(re_ast) + "\n" << std::endl;
     55    std::cout << "\nUTF8-encoder:\n" + Printer_RE::PrintRE(re_ast) + "\n" << std::endl;
    5656
    5757    //Optimization passes to simplify the AST.
     
    5959
    6060    //Print to the terminal the AST that was generated by the simplifier.
    61     //std::cout << "\nSimplifier:\n" + Printer_RE::PrintRE(re_ast) + "\n" << std::endl;
     61    std::cout << "\nSimplifier:\n" + Printer_RE::PrintRE(re_ast) + "\n" << std::endl;
    6262
    6363    //Map all of the unique character classes in order to reduce redundancy.
     
    6666
    6767    //Print to the terminal the AST with the reduced REs.
    68     //std::cout << "\nReducer:\n" + Printer_RE::PrintRE(re_ast) + "\n" << std::endl;
     68    std::cout << "\nReducer:\n" + Printer_RE::PrintRE(re_ast) + "\n" << std::endl;
    6969
    7070    //Build our list of predefined characters.
Note: See TracChangeset for help on using the changeset viewer.