Ignore:
Timestamp:
May 22, 2017, 12:14:19 PM (2 years ago)
Author:
nmedfort
Message:

Restructuring work for the Driver classes. Start of work to eliminate the memory leaks with the ExecutionEngine?. Replaced custom AlignedMalloc? with backend call to std::aligned_malloc. Salvaged some work on DistributionPass? for reevaluation.

File:
1 edited

Legend:

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

    r5458 r5464  
    2020#include <fstream>
    2121#include <string>
    22 #include <boost/uuid/sha1.hpp>
    2322#include <toolchain/toolchain.h>
    2423#include <re/re_toolchain.h>
     
    113112}
    114113
    115 static std::string allREs;
    116114static re::ModeFlagSet globalFlags = 0;
    117115
     
    148146#endif
    149147        REs.push_back(re_ast);
    150         allREs += regexVector[i] + "\n";
    151148    }
    152149
     
    181178
    182179    return REs;
    183 }
    184 
    185 std::string sha1sum(const std::string & str) {
    186     char buffer[41];    // 40 hex-digits and the terminating null
    187     unsigned int digest[5];     // 160 bits in total
    188 
    189     boost::uuids::detail::sha1 sha1;
    190     sha1.process_bytes(str.c_str(), str.size());
    191     sha1.get_digest(digest);
    192     snprintf(buffer, sizeof(buffer), "%.8x%.8x%.8x%.8x%.8x",
    193              digest[0], digest[1], digest[2], digest[3], digest[4]);
    194     return std::string(buffer);
    195180}
    196181
     
    396381    const auto REs = readExpressions();
    397382
    398     std::string module_name = "grepcode:" + sha1sum(allREs) + ":" + std::to_string(globalFlags);
    399    
    400383    if (GrepSupport) {  // Calls icgrep again on command line and passes output to grep.
    401384        pipeIcGrepOutputToGrep(argc, argv);
     
    410393    if (allFiles.empty()) {
    411394
    412         grepEngine.grepCodeGen(module_name, REs, CountOnly, UTF_16, GrepSource::StdIn);
     395        grepEngine.grepCodeGen(REs, CountOnly, UTF_16, GrepSource::StdIn);
    413396        allFiles = { "-" };
    414397        initFileResult(allFiles);
     
    421404       
    422405        if(codegen::NVPTX){
    423             grepEngine.grepCodeGen_nvptx(module_name, REs, CountOnly, UTF_16);
     406            grepEngine.grepCodeGen_nvptx(REs, CountOnly, UTF_16);
    424407            for (unsigned i = 0; i != allFiles.size(); ++i) {
    425408                grepEngine.doGrep(allFiles[i]);
     
    428411        }
    429412        else{
    430             grepEngine.grepCodeGen(module_name, REs, CountOnly, UTF_16, GrepSource::File);
     413            grepEngine.grepCodeGen(REs, CountOnly, UTF_16, GrepSource::File);
    431414        }
    432415
Note: See TracChangeset for help on using the changeset viewer.