Ignore:
Timestamp:
Jan 15, 2018, 4:48:02 PM (16 months ago)
Author:
nmedfort
Message:

Revised RE_Minimizer to use alphabets + minor optimizations to RE functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/re/re_toolchain.cpp

    r5817 r5835  
    2424#include <re/grapheme_clusters.h>
    2525#include <llvm/Support/raw_ostream.h>
     26#include <toolchain/toolchain.h>
    2627
    2728using namespace pablo;
     
    3233static cl::OptionCategory RegexOptions("Regex Toolchain Options",
    3334                                              "These options control the regular expression transformation and compilation.");
    34 const cl::OptionCategory * re_toolchain_flags() {
     35const cl::OptionCategory * LLVM_READONLY re_toolchain_flags() {
    3536    return &RegexOptions;
    3637}
     
    5152                              CL_ENUM_VAL_SENTINEL), cl::cat(RegexOptions));
    5253
    53 bool AlgorithmOptionIsSet(RE_AlgorithmFlags flag) {
     54bool LLVM_READONLY AlgorithmOptionIsSet(RE_AlgorithmFlags flag) {
    5455    return AlgorithmOptions.isSet(flag);
    5556}
     
    8990
    9091RE * regular_expression_passes(RE * r) {
    91     std::vector<re::CC *> charclasses;
     92
    9293    //Optimization passes to simplify the AST.
    9394    r = RE_Nullable::removeNullablePrefix(r);
     
    106107    r = re::resolveNames(r);
    107108    if (PrintOptions.isSet(ShowAllREs)) {
    108         errs() << "resolveNames:\n" << Printer_RE::PrintRE(r) << '\n';
     109        errs() << "Resolve Names:\n" << Printer_RE::PrintRE(r) << '\n';
    109110    }
    110 
    111     r = RE_Simplifier::simplify(r);
     111    if (codegen::OptLevel > 1) {
     112        r = RE_Minimizer::minimize(r);
     113    } else {
     114        r = RE_Simplifier::simplify(r);
     115    }
    112116    if (PrintOptions.isSet(ShowAllREs) || PrintOptions.isSet(ShowSimplifiedREs)) {
    113117        //Print to the terminal the AST that was generated by the simplifier.
    114118        errs() << "Simplifier:\n" << Printer_RE::PrintRE(r) << '\n';
    115119    }
     120
    116121    return r;
    117122}
     123
    118124}
Note: See TracChangeset for help on using the changeset viewer.