Changeset 4544


Ignore:
Timestamp:
May 6, 2015, 8:27:36 AM (4 years ago)
Author:
cameron
Message:

Tracing options; make all command line options static

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

Legend:

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

    r4538 r4544  
    11/*
    2  *  Copyright (c) 2014 International Characters.
     2 *  Copyright (c) 2015 International Characters.
    33 *  This software is licensed to the public under the Open Software License 3.0.
    44 *  icgrep is a trademark of International Characters.
     
    1616
    1717#include "llvm/Support/CommandLine.h"
     18
     19static cl::OptionCategory aRegexSourceOptions("Regular Expression Options",
     20                                       "These options control the regular expression source.");
     21
     22static cl::OptionCategory bGrepOutputOptions("Output Options",
     23                                      "These options control the output.");
     24
     25static cl::list<std::string> inputFiles(cl::Positional, cl::desc("<regex> <input file ...>"), cl::OneOrMore);
     26
     27static cl::opt<bool> CountOnly("c", cl::desc("Count and display the matching lines per file only."), cl::cat(bGrepOutputOptions));
     28static cl::alias CountOnlyLong("count", cl::desc("Alias for -c"), cl::aliasopt(CountOnly));
     29static cl::opt<bool> NormalizeLineBreaks("normalize-line-breaks", cl::desc("Normalize line breaks to std::endl."), cl::init(false),  cl::cat(bGrepOutputOptions));
     30
     31static cl::opt<bool> ShowFileNames("H", cl::desc("Show the file name with each matching line."), cl::cat(bGrepOutputOptions));
     32static cl::alias ShowFileNamesLong("with-filename", cl::desc("Alias for -H"), cl::aliasopt(ShowFileNames));
     33
     34static cl::opt<bool> CaseInsensitive("i", cl::desc("Ignore case distinctions in the pattern and the file."), cl::cat(aRegexSourceOptions));
     35static cl::opt<bool> ShowLineNumbers("n", cl::desc("Show the line number with each matching line."), cl::cat(bGrepOutputOptions));
     36static cl::alias ShowLineNumbersLong("line-number", cl::desc("Alias for -n"), cl::aliasopt(ShowLineNumbers));
     37
     38static cl::list<std::string> regexVector("e", cl::desc("Regular expression"), cl::ZeroOrMore, cl::cat(aRegexSourceOptions));
     39static cl::opt<std::string> RegexFilename("f", cl::desc("Take regular expressions (one per line) from a file"), cl::value_desc("regex file"), cl::init(""), cl::cat(aRegexSourceOptions));
     40
     41
     42
    1843
    1944int main(int argc, char *argv[]) {
     
    4469    Map["verify-scev"]->setHiddenFlag(cl::Hidden);
    4570   
     71    cl::ParseCommandLineOptions(argc, argv);
    4672   
    47     cl::OptionCategory aRegexSourceOptions("Regular Expression Options",
    48                                           "These options control the regular expression source.");
    49    
    50     cl::OptionCategory bGrepOutputOptions("Output Options",
    51                                          "These options control the output.");
    5273   
    5374    int firstInputFile = 1;  // Normal case when first positional arg is a regex.
    54     cl::list<std::string> inputFiles(cl::Positional, cl::desc("<regex> <input file ...>"), cl::OneOrMore);
    55    
    56     cl::opt<bool> CountOnly("c", cl::desc("Count and display the matching lines per file only."), cl::cat(bGrepOutputOptions));
    57     cl::alias CountOnlyLong("count", cl::desc("Alias for -c"), cl::aliasopt(CountOnly));
    58     cl::opt<bool> NormalizeLineBreaks("normalize-line-breaks", cl::desc("Normalize line breaks to std::endl."), cl::init(false),  cl::cat(bGrepOutputOptions));
    59    
    60     cl::opt<bool> ShowFileNames("H", cl::desc("Show the file name with each matching line."), cl::cat(bGrepOutputOptions));
    61     cl::alias ShowFileNamesLong("with-filename", cl::desc("Alias for -H"), cl::aliasopt(ShowFileNames));
    62    
    63     cl::opt<bool> CaseInsensitive("i", cl::desc("Ignore case distinctions in the pattern and the file."), cl::cat(aRegexSourceOptions));
    64     cl::opt<bool> ShowLineNumbers("n", cl::desc("Show the line number with each matching line."), cl::cat(bGrepOutputOptions));
    65     cl::alias ShowLineNumbersLong("line-number", cl::desc("Alias for -n"), cl::aliasopt(ShowLineNumbers));
    66    
    67     cl::list<std::string> regexVector("e", cl::desc("Regular expression"), cl::ZeroOrMore, cl::cat(aRegexSourceOptions));
    68    
    69     cl::opt<std::string> RegexFilename("f", cl::desc("Take regular expressions (one per line) from a file"), cl::value_desc("regex file"), cl::init(""), cl::cat(aRegexSourceOptions));
    70  
    71     // Does -b mean the byte offset of the line, or the byte offset of the match start within the line?
    72     //static cl::opt<bool>ShowByteOffsets("b", cl::desc("Show the byte offset with each matching line."));
    73     //cl::alias ShowByteOffsetsLong("-byte-offset", cl::desc("Alias for -b"), cl::aliasopt(ShowByteOffsets));
    7475
    7576    Encoding encoding(Encoding::Type::UTF_8, 8);
    7677
    77     cl::ParseCommandLineOptions(argc, argv);
    7878   
    7979    //std::vector<std::string> regexVector;
  • icGREP/icgrep-devel/icgrep/pablo/pablo_compiler.cpp

    r4543 r4544  
    4747#include <iostream>
    4848
    49 cl::OptionCategory eIRDumpOptions("LLVM IR Dump Options", "These options control dumping of LLVM IR.");
     49static cl::OptionCategory eIRDumpOptions("LLVM IR Dump Options", "These options control dumping of LLVM IR.");
    5050static cl::opt<bool> DumpGeneratedIR("dump-generated-IR", cl::init(false), cl::desc("print LLVM IR generated by RE compilation"), cl::cat(eIRDumpOptions));
     51
     52static cl::OptionCategory fTracingOptions("Run-time Tracing Options", "These options control execution traces.");
     53static cl::opt<bool> TraceNext("trace-next-nodes", cl::init(false), cl::desc("Generate dynamic traces of executed Next nodes (while control variables)."), cl::cat(fTracingOptions));
     54static cl::opt<bool> DumpTrace("dump-trace", cl::init(false), cl::desc("Generate dynamic traces of executed assignments."), cl::cat(fTracingOptions));
    5155
    5256extern "C" {
     
    638642    if (const Assign * assign = dyn_cast<const Assign>(stmt)) {
    639643        Value * expr = compileExpression(assign->getExpr());
     644        if (DumpTrace) {
     645            genPrintRegister(assign->getName()->to_string(), expr);
     646        }
    640647        mMarkerMap[assign] = expr;
    641648        if (LLVM_UNLIKELY(assign->isOutputAssignment())) {
     
    645652    else if (const Next * next = dyn_cast<const Next>(stmt)) {
    646653        Value * expr = compileExpression(next->getExpr());
     654        if (TraceNext) {
     655            genPrintRegister(next->getInitial()->getName()->to_string(), expr);
     656        }
    647657        mMarkerMap[next->getInitial()] = expr;
    648658    }
  • icGREP/icgrep-devel/icgrep/re/re_compiler.cpp

    r4520 r4544  
    2626
    2727#include "llvm/Support/CommandLine.h"
    28 cl::OptionCategory fREcompilationOptions("Regex Compilation Options",
     28static cl::OptionCategory fREcompilationOptions("Regex Compilation Options",
    2929                                      "These options control the compilation of regular expressions to Pablo.");
    3030
Note: See TracChangeset for help on using the changeset viewer.