Ignore:
Timestamp:
May 10, 2016, 12:12:41 AM (3 years ago)
Author:
nmedfort
Message:

UnicodeSet? bug fix and compile warning clean-up.

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

Legend:

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

    r5033 r5037  
    4343llvm_map_components_to_libnames(REQ_LLVM_LIBRARIES mcjit native IRReader) # ipo
    4444
    45 message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
     45message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION} in ${LLVM_ROOT_DIR}")
    4646
    4747# Check if boost has been installed on this system.
     
    176176
    177177#Disable RunTime Type Information
    178 IF (MSVC) # using Visual Studio C++ 
     178IF (MSVC) # using Visual Studio C++
    179179  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR-")
    180180ELSE() # using Clang, GCC, Intel C++, etc
     
    185185SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
    186186
    187 
    188187SET(CMAKE_REQUIRED_FLAGS)
    189188
     
    198197
    199198SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3 -DNDEBUG")
    200 IF (${CMAKE_SYSTEM} MATCHES "Linux")
    201     SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -g -fsanitize=address -fno-omit-frame-pointer")
    202 ENDIF()
     199SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -g -fsanitize=address -fno-omit-frame-pointer")
    203200
    204201add_test(
  • icGREP/icgrep-devel/icgrep/IDISA/idisa_sse_builder.cpp

    r5014 r5037  
    4949        }
    5050    }
    51     int fieldCount = mBitBlockWidth/fw;
     51    const unsigned fieldCount = mBitBlockWidth / fw;
    5252    if ((fieldCount > 4) && (fieldCount <= 16)) {
    5353        Value * pmovmskb_func = Intrinsic::getDeclaration(mMod, Intrinsic::x86_sse2_pmovmskb_128);
  • icGREP/icgrep-devel/icgrep/IDISA/idisa_target.cpp

    r5033 r5037  
    88#include <IDISA/idisa_sse_builder.h>
    99#include <IDISA/idisa_i64_builder.h>
    10 
    1110
    1211// Dynamic processor detection
     
    2019IDISA_Builder * GetIDISA_Builder(Module * mod) {
    2120    bool hasAVX2 = (strncmp(lGetSystemISA(), "avx2", 4) == 0);
    22    
    2321    unsigned theBlockSize = codegen::BlockSize;  // from command line
    2422   
  • icGREP/icgrep-devel/icgrep/UCD/resolve_properties.cpp

    r4829 r5037  
    161161    }
    162162    assert (functionName.length() > 0);
    163     return std::move(functionName);
     163    return functionName;
    164164}
    165165
  • icGREP/icgrep-devel/icgrep/UCD/unicode_set.cpp

    r4982 r5037  
    4242
    4343
    44 UnicodeSet::Allocator UnicodeSet::mAllocator;
     44UnicodeSet::RunAllocator UnicodeSet::mRunAllocator;
     45UnicodeSet::QuadAllocator UnicodeSet::mQuadAllocator;
    4546
    4647const size_t QUAD_BITS = (8 * sizeof(bitquad_t));
     
    478479    }
    479480
     481    //this->dump(llvm::errs()); llvm::errs() << " + [" << lo << ',' << hi << "]\n"; llvm::errs().flush();
     482
    480483    // Create a temporary run and quad set for the given range
    481484    std::vector<run_t> runs;
     
    490493    length_t length = 0;
    491494    run_type_t type = Empty;
     495
    492496    // Advance past any full runs prior to the lo_index
    493497    for (;;) {
     498        assert (ri != mRuns.cend());
    494499        std::tie(type, length) = *ri;
     500        //llvm::errs() << std::distance(mRuns.cbegin(), ri) << ") type=" << (int)(type) << ", length=" << length << ", lo_index=" << lo_index << ", hi_index=" << hi_index << "\n"; llvm::errs().flush();
    495501        if (lo_index < length) {
    496502            break;
    497503        }
    498504        if (type == Mixed) {
     505            assert (std::distance(qi, mQuads.cend()) >= length);
    499506            qi += length;
    500507        }
     
    504511    }
    505512
     513    //llvm::errs() << "* " << std::distance(mRuns.cbegin(), ri) << ") type=" << (int)(type) << ", length=" << length << ", lo_index=" << lo_index << ", hi_index=" << hi_index << "\n"; llvm::errs().flush();
     514
    506515    // Now record the runs and any quads prior to lo_index
    507     runs.assign(mRuns.cbegin(), ri);
     516    runs.assign(mRuns.cbegin(), ri++);
    508517    if (lo_index) {
    509518        runs.push_back(std::make_pair(type, lo_index));
    510519        if (type == Mixed) {
     520            assert (std::distance(qi, mQuads.cend()) >= lo_index);
    511521            qi += lo_index;
    512522        }
     
    528538        }
    529539        if (type == Mixed) {
     540            assert (std::distance(qi, mQuads.cend()) > 0);
    530541            lo_quad |= *qi++;
    531542        }
     
    533544    }
    534545    --length;
     546
     547    //llvm::errs() << "* " << std::distance(mRuns.cbegin(), ri) << ") type=" << (int)(type) << ", length=" << length << ", lo_index=" << lo_index << ", hi_index=" << hi_index << "\n"; llvm::errs().flush();
    535548
    536549    // Now check if we need to write out any Full blocks between the lo and hi code points; adjust our position
     
    540553        append_run(Full, hi_index - 1, runs);
    541554        // Advance past original quads that were filled in
    542         for (;;) {
     555        while (ri != mRuns.cend()) {
    543556            if (type == Mixed) {
     557                assert (std::distance(qi, mQuads.cend()) >= length);
    544558                qi += length;
    545559            }
    546             std::tie(type, length) = *++ri;
     560            std::tie(type, length) = *ri++;
     561            //llvm::errs() << std::distance(mRuns.cbegin(), ri) << ") type=" << (int)(type) << ", length=" << length << ", lo_index=" << lo_index << ", hi_index=" << hi_index << "\n"; llvm::errs().flush();
    547562            if (hi_index < length) {
    548563                break;
     
    556571        } else {
    557572            if (type == Mixed) {
     573                assert (std::distance(qi, mQuads.cend()) > hi_index);
    558574                qi += hi_index;
    559575                hi_quad |= *qi++;
     
    563579    }
    564580
     581    //llvm::errs() << "* " << std::distance(mRuns.cbegin(), ri) << ") type=" << (int)(type) << ", length=" << length << ", lo_index=" << lo_index << ", hi_index=" << hi_index << "\n";
     582
     583    //llvm::errs() << "* remaining=" << std::distance(ri, mRuns.cend()) << "\n";
     584
     585    //llvm::errs().flush();
     586
    565587    // And append any remaining values from the original data
    566588    append_run(type, length - hi_index, runs);
    567     runs.insert(runs.end(), ++ri, mRuns.cend());
     589    assert ("We wrote all the runs but still have remaining quads?" && (ri != mRuns.cend() || qi == mQuads.cend()));
     590    runs.insert(runs.end(), ri, mRuns.cend());
    568591    quads.insert(quads.end(), qi, mQuads.cend());
    569 
    570592    assert (verify(runs, quads));
    571593
     
    751773 ** ------------------------------------------------------------------------------------------------------------- */
    752774UnicodeSet::UnicodeSet()
    753 : mRuns(reinterpret_cast<RunAllocator &>(mAllocator))
    754 , mQuads(reinterpret_cast<QuadAllocator &>(mAllocator))
     775: mRuns(mRunAllocator)
     776, mQuads(mQuadAllocator)
    755777{
    756778    append_run(Empty, UNICODE_QUAD_COUNT, mRuns);
     
    762784 ** ------------------------------------------------------------------------------------------------------------- */
    763785UnicodeSet::UnicodeSet(const codepoint_t codepoint)
    764 : mRuns(reinterpret_cast<RunAllocator &>(mAllocator))
    765 , mQuads(reinterpret_cast<QuadAllocator &>(mAllocator))
     786: mRuns(mRunAllocator)
     787, mQuads(mQuadAllocator)
    766788{
    767789    const codepoint_t quad_no = codepoint / QUAD_BITS;
     
    776798 ** ------------------------------------------------------------------------------------------------------------- */
    777799UnicodeSet::UnicodeSet(const codepoint_t lo, const codepoint_t hi)
    778 : mRuns(reinterpret_cast<RunAllocator &>(mAllocator))
    779 , mQuads(reinterpret_cast<QuadAllocator &>(mAllocator))
     800: mRuns(mRunAllocator)
     801, mQuads(mQuadAllocator)
    780802{
    781803    const codepoint_t lo_index = lo / QUAD_BITS;
     
    857879 ** ------------------------------------------------------------------------------------------------------------- */
    858880UnicodeSet::UnicodeSet(std::initializer_list<interval_t>::iterator begin, std::initializer_list<interval_t>::iterator end)
    859 : mRuns(0, {Empty, 0}, reinterpret_cast<RunAllocator &>(mAllocator))
    860 , mQuads(0, 0, reinterpret_cast<QuadAllocator &>(mAllocator))
     881: mRuns(0, {Empty, 0}, mRunAllocator)
     882, mQuads(0, 0, mQuadAllocator)
    861883{
    862884    convertIntervalRangesToSparseSet(begin, end, mRuns, mQuads);
     
    867889 ** ------------------------------------------------------------------------------------------------------------- */
    868890UnicodeSet::UnicodeSet(const std::vector<interval_t>::iterator begin, const std::vector<interval_t>::iterator end)
    869 : mRuns(0, {Empty, 0}, reinterpret_cast<RunAllocator &>(mAllocator))
    870 , mQuads(0, 0, reinterpret_cast<QuadAllocator &>(mAllocator))
     891: mRuns(0, {Empty, 0}, mRunAllocator)
     892, mQuads(0, 0, mQuadAllocator)
    871893{
    872894    convertIntervalRangesToSparseSet(begin, end, mRuns, mQuads);
     
    877899 ** ------------------------------------------------------------------------------------------------------------- */
    878900UnicodeSet::UnicodeSet(const UnicodeSet & other)
    879 : mRuns(other.mRuns, reinterpret_cast<RunAllocator &>(mAllocator))
    880 , mQuads(other.mQuads, reinterpret_cast<QuadAllocator &>(mAllocator))
     901: mRuns(other.mRuns, mRunAllocator)
     902, mQuads(other.mQuads, mQuadAllocator)
    881903{
    882904    assert (verify(mRuns, mQuads));
     
    887909 ** ------------------------------------------------------------------------------------------------------------- */
    888910UnicodeSet::UnicodeSet(std::initializer_list<run_t> r, std::initializer_list<bitquad_t> q)
    889 : mRuns(r.begin(), r.end(), reinterpret_cast<RunAllocator &>(mAllocator))
    890 , mQuads(q.begin(), q.end(), reinterpret_cast<QuadAllocator &>(mAllocator))
     911: mRuns(r.begin(), r.end(), mRunAllocator)
     912, mQuads(q.begin(), q.end(), mQuadAllocator)
    891913{
    892914    assert (verify(mRuns, mQuads));
     
    897919 ** ------------------------------------------------------------------------------------------------------------- */
    898920inline UnicodeSet::UnicodeSet(std::vector<run_t> && r, std::vector<bitquad_t> && q)
    899 : mRuns(r.begin(), r.end(), reinterpret_cast<RunAllocator &>(mAllocator))
    900 , mQuads(q.begin(), q.end(), reinterpret_cast<QuadAllocator &>(mAllocator))
     921: mRuns(r.begin(), r.end(), mRunAllocator)
     922, mQuads(q.begin(), q.end(), mQuadAllocator)
    901923{
    902924    assert (verify(mRuns, mQuads));
  • icGREP/icgrep-devel/icgrep/UCD/unicode_set.h

    r4983 r5037  
    4949    using interval_t = std::pair<codepoint_t, codepoint_t>;
    5050
    51     using Allocator = SlabAllocator<uint32_t>;
    52     using RunAllocator = Allocator::rebind<run_t>::other;
    53     using QuadAllocator = Allocator::rebind<bitquad_t>::other;
     51    using RunAllocator = SlabAllocator<run_t>;
     52    using QuadAllocator = SlabAllocator<bitquad_t>;
    5453
    5554    using RunVector = std::vector<run_t, RunAllocator>;
     
    196195private:
    197196
    198     RunVector           mRuns;
    199     QuadVector          mQuads;
    200     static Allocator    mAllocator;
     197    RunVector               mRuns;
     198    QuadVector              mQuads;
     199    static RunAllocator     mRunAllocator;
     200    static QuadAllocator    mQuadAllocator;
    201201};
    202202
  • icGREP/icgrep-devel/icgrep/cc/cc_compiler.cpp

    r5035 r5037  
    218218      Handling this as a special case avoids an overflow issue with n+1 requiring more than N bits.
    219219    */
    220     if ((n + 1) == (1 << N)) {
     220    if ((n + 1) == (1UL << N)) {
    221221        return pb.createOnes(); //True.
    222222    }
     
    237237}
    238238
    239 inline Var * CC_Compiler::getBasisVar(const int i) const {
    240     assert (i >= 0 && i < mEncoding.getBits());
     239inline Var * CC_Compiler::getBasisVar(const unsigned i) const {
     240    assert (i < mEncoding.getBits());
    241241    return mBasisBit[mEncoding.getBits() - i - 1];
    242242}
  • icGREP/icgrep-devel/icgrep/cc/cc_compiler.h

    r4815 r5037  
    4646
    4747private:
    48     pablo::Var * getBasisVar(const int n) const;
     48    pablo::Var * getBasisVar(const unsigned n) const;
    4949    template<typename PabloBlockOrBuilder>
    5050    pablo::PabloAST * bit_pattern_expr(const unsigned pattern, unsigned selected_bits, PabloBlockOrBuilder & pb);
  • icGREP/icgrep-devel/icgrep/grep_engine.cpp

    r5033 r5037  
    8484}
    8585
    86 void GrepEngine::doGrep(const std::string & fileName, const int fileIdx, bool CountOnly, std::vector<int> & total_CountOnly) {
    87     const path file(fileName);
     86void GrepEngine::doGrep(const std::string & fileName, const int fileIdx, bool CountOnly, std::vector<uint64_t> & total_CountOnly) {
     87    path file(fileName);
    8888    if (exists(file)) {
    8989        if (is_directory(file)) {
     
    9595    }
    9696
    97     const size_t fileSize = file_size(file);
     97    const auto fileSize = file_size(file);
    9898    if (fileSize > 0) {
    99         mapped_file_source file;
    10099        try {
    101             file.open(fileName);
    102         } catch (std::exception &e) {
     100            mapped_file_source source(fileName, fileSize, 0);
     101            char * fileBuffer = const_cast<char *>(source.data());
     102            if (CountOnly) {
     103                total_CountOnly[fileIdx] = mGrepFunction_CountOnly(fileBuffer, fileSize, fileIdx, finalLineIsUnterminated(fileBuffer, fileSize));
     104            } else {
     105                mGrepFunction(fileBuffer, fileSize, fileIdx, finalLineIsUnterminated(fileBuffer, fileSize));
     106            }
     107            source.close();
     108        } catch (std::exception & e) {
    103109            throw std::runtime_error("Boost mmap error: " + fileName + ": " + e.what());
    104110        }
    105         char * fileBuffer = const_cast<char *>(file.data());
    106         if(CountOnly){
    107             total_CountOnly[fileIdx] = mGrepFunction_CountOnly(fileBuffer, fileSize, fileIdx, finalLineIsUnterminated(fileBuffer, fileSize));
    108         }
    109         else{
    110             mGrepFunction(fileBuffer, fileSize, fileIdx, finalLineIsUnterminated(fileBuffer, fileSize));
    111         }
    112         file.close();
    113     }
    114     else {
    115         if(CountOnly) {
     111    } else {
     112        if(CountOnly) {
    116113            mGrepFunction_CountOnly(nullptr, 0, fileIdx, false);
    117         }
    118         else{
    119             mGrepFunction(nullptr, 0, fileIdx, false);
    120         }
     114        } else {
     115            mGrepFunction(nullptr, 0, fileIdx, false);
     116        }
    121117    }
    122118}
     
    147143    verifyModule(*M, &dbgs());
    148144    #endif
     145
    149146    mEngine->finalizeObject();
    150147    delete idb;
    151148
    152     if(CountOnly){
     149    if (CountOnly) {
    153150        mGrepFunction_CountOnly = reinterpret_cast<GrepFunctionType_CountOnly>(mEngine->getPointerToFunction(grepIR));
    154     }
    155     else{
     151    } else {
    156152        mGrepFunction = reinterpret_cast<GrepFunctionType>(mEngine->getPointerToFunction(grepIR));
    157153    }
     
    193189    resultStrs = new std::stringstream[n];
    194190    total_count = new int[n];
    195     for (int i=0; i<inputFiles.size(); i++){
     191    for (unsigned i = 0; i < inputFiles.size(); ++i){
    196192        total_count[i] = 0;
    197193    }
     
    249245}
    250246
    251 void PrintResult(bool CountOnly, std::vector<int> & total_CountOnly){
     247void PrintResult(bool CountOnly, std::vector<uint64_t> & total_CountOnly){
    252248    if(CountOnly){
    253249        if (!ShowFileNames) {
    254             for (int i=0; i<inputFiles.size(); i++){
     250            for (unsigned i = 0; i < inputFiles.size(); ++i){
    255251                std::cout << total_CountOnly[i] << std::endl;
    256252            }
    257253        }
    258254        else {
    259             for (int i=0; i<inputFiles.size(); i++){
     255            for (unsigned i = 0; i < inputFiles.size(); ++i){
    260256                std::cout << inputFiles[i] << ':' << total_CountOnly[i] << std::endl;
    261257            };
     
    264260    }
    265261   
    266     std::string out;
    267     for (int i=0; i<inputFiles.size(); i++){
     262    for (unsigned i = 0; i < inputFiles.size(); ++i){
    268263        std::cout << resultStrs[i].str();
    269264    }
  • icGREP/icgrep-devel/icgrep/grep_engine.h

    r5033 r5037  
    1919class GrepEngine {
    2020    typedef void (*GrepFunctionType)(char * byte_data, size_t filesize, const int fileIdx, uint64_t finalLineUnterminated);
    21     typedef int64_t (*GrepFunctionType_CountOnly)(char * byte_data, size_t filesize, const int fileIdx, uint64_t finalLineUnterminated);
     21    typedef uint64_t (*GrepFunctionType_CountOnly)(char * byte_data, size_t filesize, const int fileIdx, uint64_t finalLineUnterminated);
    2222public:
    2323
     
    2828    void grepCodeGen(std::string moduleName, re::RE * re_ast, bool CountOnly, bool isNameExpression = false);
    2929   
    30     void doGrep(const std::string & fileName, const int fileIdx, bool CountOnly, std::vector<int> & total_CountOnly);
     30    void doGrep(const std::string & fileName, const int fileIdx, bool CountOnly, std::vector<uint64_t> &total_CountOnly);
    3131   
    3232    re::CC *  grepCodepoints();
     
    5050
    5151void initResult(std::vector<std::string> filenames);
    52 void PrintResult(bool CountOnly, std::vector<int> & total_CountOnly);
     52void PrintResult(bool CountOnly, std::vector<uint64_t> & total_CountOnly);
    5353
    5454#endif
  • icGREP/icgrep-devel/icgrep/icgrep-devel.files

    r5008 r5037  
    11041104utf8_encoder.h
    11051105utf_encoding.h
     1106cc/cc_compiler.cpp
     1107cc/cc_compiler.h
     1108IDISA/idisa_avx_builder.cpp
     1109IDISA/idisa_avx_builder.h
     1110IDISA/idisa_builder.cpp
     1111IDISA/idisa_builder.h
     1112IDISA/idisa_i64_builder.cpp
     1113IDISA/idisa_i64_builder.h
     1114IDISA/idisa_sse_builder.cpp
     1115IDISA/idisa_sse_builder.h
     1116IDISA/idisa_target.cpp
     1117IDISA/idisa_target.h
     1118kernels/casefold_pipeline.cpp
     1119kernels/casefold_pipeline.h
     1120kernels/deletion.cpp
     1121kernels/deletion.h
     1122kernels/instance.cpp
     1123kernels/instance.h
     1124kernels/kernel.cpp
     1125kernels/kernel.h
     1126kernels/p2s_kernel.cpp
     1127kernels/p2s_kernel.h
     1128kernels/pipeline.cpp
     1129kernels/pipeline.h
     1130kernels/s2p_kernel.cpp
     1131kernels/s2p_kernel.h
     1132kernels/scanmatchgen.cpp
     1133kernels/scanmatchgen.h
     1134kernels/stdout_kernel.cpp
     1135kernels/stdout_kernel.h
     1136kernels/streamset.h
     1137kernels/symboltablepipeline.cpp
     1138kernels/symboltablepipeline.h
     1139kernels/u8u16_pipeline.cpp
     1140kernels/u8u16_pipeline.h
     1141pablo/analysis/pabloverifier.cpp
     1142pablo/analysis/pabloverifier.hpp
     1143pablo/optimizers/booleanreassociationpass.cpp
     1144pablo/optimizers/booleanreassociationpass.h
     1145pablo/optimizers/codemotionpass.cpp
     1146pablo/optimizers/codemotionpass.h
     1147pablo/optimizers/distributivepass.cpp
     1148pablo/optimizers/distributivepass.h
     1149pablo/optimizers/graph-facade.hpp
     1150pablo/optimizers/pablo_automultiplexing.cpp
     1151pablo/optimizers/pablo_automultiplexing.hpp
     1152pablo/optimizers/pablo_bddminimization.cpp
     1153pablo/optimizers/pablo_bddminimization.h
     1154pablo/optimizers/pablo_simplifier.cpp
     1155pablo/optimizers/pablo_simplifier.hpp
     1156pablo/optimizers/schedulingprepass.cpp
     1157pablo/optimizers/schedulingprepass.h
     1158pablo/passes/factorizedfg.cpp
     1159pablo/passes/factorizedfg.h
     1160pablo/passes/flattenassociativedfg.cpp
     1161pablo/passes/flattenassociativedfg.h
     1162pablo/builder.cpp
     1163pablo/builder.hpp
     1164pablo/carry_data.cpp
     1165pablo/carry_data.h
     1166pablo/carry_manager.cpp
     1167pablo/carry_manager.h
     1168pablo/codegenstate.cpp
     1169pablo/codegenstate.h
     1170pablo/expression_map.hpp
     1171pablo/function.cpp
     1172pablo/function.h
     1173pablo/pablo_compiler.cpp
     1174pablo/pablo_compiler.h
     1175pablo/pablo_toolchain.cpp
     1176pablo/pablo_toolchain.h
     1177pablo/pabloAST.cpp
     1178pablo/pabloAST.h
     1179pablo/pe_advance.h
     1180pablo/pe_and.h
     1181pablo/pe_call.h
     1182pablo/pe_count.h
     1183pablo/pe_infile.h
     1184pablo/pe_integer.h
     1185pablo/pe_lookahead.h
     1186pablo/pe_matchstar.h
     1187pablo/pe_next.h
     1188pablo/pe_not.h
     1189pablo/pe_ones.h
     1190pablo/pe_or.h
     1191pablo/pe_scanthru.h
     1192pablo/pe_sel.h
     1193pablo/pe_setithbit.h
     1194pablo/pe_string.h
     1195pablo/pe_var.h
     1196pablo/pe_xor.h
     1197pablo/pe_zeroes.h
     1198pablo/printer_pablos.cpp
     1199pablo/printer_pablos.h
     1200pablo/ps_assign.h
     1201pablo/ps_if.cpp
     1202pablo/ps_if.h
     1203pablo/ps_while.cpp
     1204pablo/ps_while.h
     1205pablo/symbol_generator.cpp
     1206pablo/symbol_generator.h
     1207re/parsefailure.cpp
     1208re/parsefailure.h
     1209re/printer_re.cpp
     1210re/printer_re.h
     1211re/re_alt.h
     1212re/re_analysis.cpp
     1213re/re_analysis.h
     1214re/re_any.h
     1215re/re_assertion.h
     1216re/re_cc.cpp
     1217re/re_cc.h
     1218re/re_compiler.cpp
     1219re/re_compiler.h
     1220re/re_diff.cpp
     1221re/re_diff.h
     1222re/re_end.h
     1223re/re_grapheme_boundary.hpp
     1224re/re_intersect.cpp
     1225re/re_intersect.h
     1226re/re_memoizer.hpp
     1227re/re_name.h
     1228re/re_nullable.cpp
     1229re/re_nullable.h
     1230re/re_parser.cpp
     1231re/re_parser.h
     1232re/re_re.cpp
     1233re/re_re.h
     1234re/re_rep.cpp
     1235re/re_rep.h
     1236re/re_seq.h
     1237re/re_simplifier.cpp
     1238re/re_simplifier.h
     1239re/re_start.h
     1240re/re_toolchain.cpp
     1241re/re_toolchain.h
     1242UCD/Blocks.h
     1243UCD/CaseFolding_txt.cpp
     1244UCD/CaseFolding_txt.h
     1245UCD/DerivedAge.h
     1246UCD/DerivedBidiClass.h
     1247UCD/DerivedBinaryProperties.h
     1248UCD/DerivedCombiningClass.h
     1249UCD/DerivedCoreProperties.h
     1250UCD/DerivedDecompositionType.h
     1251UCD/DerivedGeneralCategory.h
     1252UCD/DerivedJoiningGroup.h
     1253UCD/DerivedJoiningType.h
     1254UCD/DerivedNumericType.h
     1255UCD/EastAsianWidth.h
     1256UCD/GraphemeBreakProperty.h
     1257UCD/HangulSyllableType.h
     1258UCD/LineBreak.h
     1259UCD/PropertyAliases.h
     1260UCD/PropertyObjects.cpp
     1261UCD/PropertyObjects.h
     1262UCD/PropertyObjectTable.h
     1263UCD/PropertyValueAliases.h
     1264UCD/PropList.h
     1265UCD/resolve_properties.cpp
     1266UCD/resolve_properties.h
     1267UCD/ScriptExtensions.h
     1268UCD/Scripts.h
     1269UCD/SentenceBreakProperty.h
     1270UCD/ucd_compiler.cpp
     1271UCD/ucd_compiler.hpp
     1272UCD/unicode_set.cpp
     1273UCD/unicode_set.h
     1274UCD/UnicodeNameData.cpp
     1275UCD/UnicodeNameData.h
     1276UCD/WordBreakProperty.h
     1277util/ispc.cpp
     1278util/papi_helper.hpp
     1279util/slab_allocator.h
     1280casefold.cpp
     1281generate_predefined_ucd_functions.cpp
     1282grep_engine.cpp
     1283grep_engine.h
     1284hrtime.h
     1285icgrep.cpp
     1286object_cache.cpp
     1287object_cache.h
     1288symboltable.cpp
     1289toolchain.cpp
     1290toolchain.h
     1291u8u16.cpp
     1292utf8_encoder.cpp
     1293utf8_encoder.h
     1294utf_encoding.h
     1295wc.cpp
     1296util/ispc.h
  • icGREP/icgrep-devel/icgrep/icgrep.cpp

    r5036 r5037  
    9696}
    9797
    98 std::vector<int> total_CountOnly;
     98std::vector<uint64_t> total_CountOnly;
    9999std::mutex count_mutex;
    100100size_t fileCount;
     
    124124// Returns true if the command line argument shouldn't be passed to icGrep or Grep.
    125125bool isArgUnwantedForAll(char *argument) {
    126 
    127     bool isUnwated = false;
    128126    std::vector<std::string> unwantedFlags = {"-gs"};
    129 
    130     for (int i=0; i<unwantedFlags.size(); i++){   
     127    for (unsigned i = 0; i < unwantedFlags.size(); ++i){
    131128        if (strcmp(argument, unwantedFlags[i].c_str()) == 0) {
    132             isUnwated = true;
    133         }
    134     }
    135 
    136     return isUnwated;
     129            return true;
     130        }
     131    }
     132    return false;
    137133}
    138134// Filters out the command line strings that shouldn't be passed on to Grep
    139135bool isArgUnwantedForGrep(char *argument) {
    140     bool isUnwated = false;
    141136    std::vector<std::string> unwantedFlags = {"-n"};
    142137
    143     for (int i = 0; i < unwantedFlags.size(); i++){
     138    for (unsigned i = 0; i < inputFiles.size(); ++i){
    144139        if (strcmp(argument, unwantedFlags[i].c_str()) == 0) {
    145             isUnwated = true;
    146         }
    147     }
    148 
    149     for (int i = 0; i < inputFiles.size(); i++){    // filter out input content files.
     140            return true;
     141        }
     142    }
     143
     144    for (unsigned i = 0; i < inputFiles.size(); ++i){    // filter out input content files.
    150145        if (strcmp(argument, inputFiles[i].c_str()) == 0) {
    151             isUnwated = true;
    152         }
    153     }
    154 
    155     return isUnwated;
     146            return true;
     147        }
     148    }
     149
     150    return false;
    156151}
    157152// Filters out the command line strings that shouldn't be passed on to IcGrep
     
    160155    std::vector<std::string> unwantedFlags = {"-c"};
    161156
    162     for (int i=0; i<unwantedFlags.size(); i++){
     157    for (unsigned i = 0; i < unwantedFlags.size(); ++i){
    163158        if (strcmp(argument, unwantedFlags[i].c_str()) == 0) {
    164159            isUnwated = true;
     
    180175    // Construct the shell arguments for icgrep and grep
    181176    // by filtering out the command line arguments passed into this process.
    182     for (int i=1; i< argc; i++) {
     177    for (int i = 1; i < argc; i++) {
    183178        if (!isArgUnwantedForAll(argv[i])) {
    184179
     
    220215   
    221216    initResult(inputFiles);
    222     for (int i=0; i<inputFiles.size(); i++){
     217    for (unsigned i=0; i<inputFiles.size(); ++i){
    223218        total_CountOnly.push_back(0);
    224219    }
  • icGREP/icgrep-devel/icgrep/kernels/instance.h

    r5010 r5037  
    4949    }
    5050
    51     llvm::Value * getInputStream(llvm::Value * const index, const unsigned streamOffset = 0) {
     51    llvm::Value * getInputStream(disable_implicit_conversion<llvm::Value *> index, const unsigned streamOffset = 0) {
    5252        return mDefinition->getInputStreamInternal(getInputStreamSet(streamOffset), index);
    5353    }
     
    6161    }
    6262
    63     llvm::Value * getInputScalar(llvm::Value * const index) {
     63    llvm::Value * getInputScalar(disable_implicit_conversion<llvm::Value *> index) {
    6464        return mDefinition->getInputScalarInternal(mInputScalarSet, index);
    6565    }
     
    7979    }
    8080
    81     llvm::Value * getOutputStream(llvm::Value * const index, const unsigned streamOffset = 0) {
     81    llvm::Value * getOutputStream(disable_implicit_conversion<llvm::Value *> index, const unsigned streamOffset = 0) {
    8282        return mDefinition->getOutputStreamInternal(getOutputStreamSet(streamOffset), index);
    8383    }
     
    8989    }
    9090
    91     llvm::Value * getOutputScalar(llvm::Value * const index) {
     91    llvm::Value * getOutputScalar(disable_implicit_conversion<llvm::Value *> index) {
    9292        return mDefinition->getOutputScalarInternal(mOutputScalarSet, index);
    9393    }
  • icGREP/icgrep-devel/icgrep/kernels/kernel.cpp

    r5014 r5037  
    100100
    101101void KernelBuilder::addInputStream(const unsigned fields) {
    102     addInputStream(fields, std::move(mKernelName + "_InputStream_" + std::to_string(mInputStream.size())));
     102    addInputStream(fields, mKernelName + "_InputStream_" + std::to_string(mInputStream.size()));
    103103}
    104104
     
    126126
    127127void KernelBuilder::addInputScalar(Type * const type) {
    128     addInputScalar(type, std::move(mKernelName + "_InputScalar_" + std::to_string(mInputScalar.size())));
     128    addInputScalar(type, mKernelName + "_InputScalar_" + std::to_string(mInputScalar.size()));
    129129}
    130130
  • icGREP/icgrep-devel/icgrep/kernels/kernel.h

    r5008 r5037  
    2929}
    3030
     31template<typename T>
     32struct disable_implicit_conversion {
     33    inline disable_implicit_conversion(T const value) : _value(value) { assert(_value); }
     34    inline disable_implicit_conversion(std::nullptr_t) = delete;
     35    inline disable_implicit_conversion(unsigned) = delete;
     36    operator T() const { return _value; }
     37    T operator-> () const { return _value; }
     38    T get() const { return _value; }
     39private:
     40    T const  _value;
     41};
     42
    3143namespace kernel {
    3244
     
    4153
    4254    KernelBuilder(IDISA::IDISA_Builder * builder, std::string && name, const unsigned defaultBufferSize);
    43 
    44     template<typename T>
    45     struct disable_implicit_conversion {
    46         inline disable_implicit_conversion(T const value) : _value(value) { assert(_value); }
    47         inline disable_implicit_conversion(std::nullptr_t) = delete;
    48         inline disable_implicit_conversion(unsigned) = delete;
    49         operator T() const { return _value; }
    50         T operator-> () const { return _value; }
    51         T get() const { return _value; }
    52     private:
    53         T const  _value;
    54     };
    5555
    5656    unsigned addInternalState(llvm::Type * const type);
  • icGREP/icgrep-devel/icgrep/kernels/pipeline.cpp

    r5035 r5037  
    5757}
    5858
    59 Value * generatePopcount(IDISA::IDISA_Builder * iBuilder, Value * bits) {
     59inline Value * generatePopcount(IDISA::IDISA_Builder * iBuilder, Value * bits) {
    6060    Value * ctpopFunc = Intrinsic::getDeclaration(iBuilder->getModule(), Intrinsic::ctpop, bits->getType());
    61     return iBuilder->CreateCall(ctpopFunc, std::vector<Value *>({bits}));
    62 }
    63 
    64 Value * Cal_Count(Instance * icGrepInstance, IDISA::IDISA_Builder * iBuilder, int mBlockSize) {
    65     const unsigned index = 0;
    66     const unsigned streamOffset = 0;
    67     Value * match = (icGrepInstance->getOutputStream(index, streamOffset));
    68     Value * temp = iBuilder->CreateLoad(match);
    69     Value * matches = iBuilder->CreateBitCast(temp, iBuilder->getIntNTy(mBlockSize));
    70     Value * popcount = generatePopcount(iBuilder, matches);
    71     return popcount;
     61    return iBuilder->CreateCall(ctpopFunc, {bits});
     62}
     63
     64inline Value * Cal_Count(Instance * icGrepInstance, IDISA::IDISA_Builder * iBuilder) {
     65    Value * match = icGrepInstance->getOutputStream(0, 0);
     66    Value * matches = iBuilder->CreateLoad(match, false, "match");
     67    return generatePopcount(iBuilder, matches);
    7268}
    7369
     
    7672    Type * const int8PtrTy = iBuilder->getInt8PtrTy();
    7773    Type * const inputType = PointerType::get(ArrayType::get(StructType::get(mMod->getContext(), std::vector<Type *>({ArrayType::get(mBitBlockType, 8)})), 1), 0);
    78 
    79     Function * const main = cast<Function>(mMod->getOrInsertFunction("Main", Type::getVoidTy(mMod->getContext()), inputType, int64ty, int64ty, iBuilder->getInt1Ty(), nullptr));
     74    Type * const resultTy = CountOnly ? int64ty : iBuilder->getVoidTy();
     75    Function * const main = cast<Function>(mMod->getOrInsertFunction("Main", resultTy, inputType, int64ty, int64ty, iBuilder->getInt1Ty(), nullptr));
    8076    main->setCallingConv(CallingConv::C);
    8177    Function::arg_iterator args = main->arg_begin();
     
    110106    BasicBlock * exitBlock = BasicBlock::Create(mMod->getContext(), "exit", main, 0);
    111107
    112     Value * count = iBuilder->CreateAlloca (Type::getIntNTy(mMod->getContext(), mBlockSize), nullptr, "count");
    113     Value * num = ConstantInt::get(iBuilder->getIntNTy(mBlockSize), 0);
    114     iBuilder->CreateStore(num, count, false);
     108    Value * count = nullptr;
     109    if (CountOnly) {
     110        count = iBuilder->CreateAlloca(mBitBlockType, nullptr, "count");
     111        iBuilder->CreateStore(ConstantInt::getNullValue(mBitBlockType), count);
     112    }
    115113
    116114    Instance * s2pInstance = mS2PKernel->instantiate(inputStream);
    117115    Instance * icGrepInstance = mICgrepKernel->instantiate(s2pInstance->getOutputStreamBuffer());
    118     Instance * scanMatchInstance = mScanMatchKernel->instantiate(icGrepInstance->getOutputStreamBuffer());
     116    Instance * scanMatchInstance = nullptr;
    119117   
    120     if(!CountOnly) {
    121         scanMatchInstance->setInternalState("FileBuf", iBuilder->CreateBitCast(inputStream, int8PtrTy));
    122         scanMatchInstance->setInternalState("FileSize", bufferSize);
    123         scanMatchInstance->setInternalState("FileIdx", fileIdx);
     118    if (!CountOnly) {
     119        scanMatchInstance = mScanMatchKernel->instantiate(icGrepInstance->getOutputStreamBuffer());
     120        scanMatchInstance->setInternalState("FileBuf", iBuilder->CreateBitCast(inputStream, int8PtrTy));
     121        scanMatchInstance->setInternalState("FileSize", bufferSize);
     122        scanMatchInstance->setInternalState("FileIdx", fileIdx);
    124123    }
    125124    Value * initialBufferSize = nullptr;
     
    140139        for (unsigned i = 0; i < segmentSize; ++i) {
    141140            icGrepInstance->CreateDoBlockCall();
    142             if(CountOnly){
    143                 Value * popcount_for = Cal_Count(icGrepInstance, iBuilder, mBlockSize);
    144                 Value * temp_countfor = iBuilder->CreateLoad(count);
    145                 Value * add_for = iBuilder->CreateAdd(temp_countfor, popcount_for);
    146                 iBuilder->CreateStore(add_for, count);
    147             }
    148         }
    149         if(!CountOnly) {
    150             for (unsigned i = 0; i < segmentSize; ++i) {
    151                 scanMatchInstance->CreateDoBlockCall();
    152             }
    153         }
     141            if (CountOnly) {
     142                Value * popcount_for = Cal_Count(icGrepInstance, iBuilder);
     143                Value * temp_countfor = iBuilder->CreateLoad(count);
     144                Value * add_for = iBuilder->CreateAdd(temp_countfor, popcount_for);
     145                iBuilder->CreateStore(add_for, count);
     146            }
     147        }
     148        if (!CountOnly) {
     149            for (unsigned i = 0; i < segmentSize; ++i) {
     150                scanMatchInstance->CreateDoBlockCall();
     151            }
     152        }
    154153        remainingBytes->addIncoming(iBuilder->CreateSub(remainingBytes, step), segmentBodyBlock);
    155154        iBuilder->CreateBr(segmentCondBlock);
     
    173172    s2pInstance->CreateDoBlockCall();
    174173    icGrepInstance->CreateDoBlockCall();
    175     if(CountOnly){
    176         Value * popcount = Cal_Count(icGrepInstance, iBuilder, mBlockSize);   
    177         Value * temp_count = iBuilder->CreateLoad(count);
    178         Value * add = iBuilder->CreateAdd(temp_count, popcount);
    179         iBuilder->CreateStore(add, count);
    180     }
    181 
    182     if(!CountOnly) {
    183         scanMatchInstance->CreateDoBlockCall();
     174    if (CountOnly) {
     175        Value * popcount = Cal_Count(icGrepInstance, iBuilder);
     176        Value * temp_count = iBuilder->CreateLoad(count);
     177        Value * add = iBuilder->CreateAdd(temp_count, popcount);
     178        iBuilder->CreateStore(add, count);
     179    } else {
     180        scanMatchInstance->CreateDoBlockCall();
    184181    }
    185182
     
    228225
    229226    icGrepInstance->CreateDoBlockCall();
    230     if(CountOnly){
    231         Value * popcount1 = Cal_Count(icGrepInstance, iBuilder, mBlockSize);   
    232         Value * temp_count1 = iBuilder->CreateLoad(count);
    233         Value * add1 = iBuilder->CreateAdd(temp_count1, popcount1);
    234         iBuilder->CreateStore(add1, count);
    235     }
    236     if(!CountOnly) {
    237         scanMatchInstance->CreateDoBlockCall();
    238     }
    239     if(CountOnly){
    240         Value * Ret = iBuilder->CreateLoad(count);
    241         iBuilder->CreateRet(Ret);
    242     }
    243     else{
    244         iBuilder->CreateRetVoid();
    245     }
    246 
    247 
     227    if (CountOnly) {
     228        Value * popcount1 = Cal_Count(icGrepInstance, iBuilder);
     229        Value * temp_count1 = iBuilder->CreateLoad(count);
     230        Value * result = iBuilder->CreateAdd(temp_count1, popcount1);
     231        for (unsigned width = (mBlockSize / 64); width > 1; width /= 2) {
     232            std::vector<Constant *> mask(width / 2);
     233            for (unsigned i = 0; i < (width / 2); ++i) {
     234                mask[i] = iBuilder->getInt32(i);
     235            }
     236            Value * const undef = UndefValue::get(VectorType::get(int64ty, width));
     237            Value * const lh = iBuilder->CreateShuffleVector(result, undef, ConstantVector::get(mask));
     238            for (unsigned i = 0; i < (width / 2); ++i) {
     239                mask[i] = iBuilder->getInt32(i + (width / 2));
     240            }
     241            Value * const rh = iBuilder->CreateShuffleVector(result, undef, ConstantVector::get(mask));
     242            result = iBuilder->CreateAdd(lh, rh);
     243        }
     244        iBuilder->CreateRet(iBuilder->CreateExtractElement(result, iBuilder->getInt32(0)));
     245    } else {
     246        scanMatchInstance->CreateDoBlockCall();
     247        iBuilder->CreateRetVoid();
     248    }
    248249    return main;
    249250}
  • icGREP/icgrep-devel/icgrep/kernels/scanmatchgen.cpp

    r5017 r5037  
    237237        Value * matchWord = iBuilder->CreateExtractElement(matchWordVector, ConstantInt::get(T, i));
    238238        Value * recordBreaksWord = iBuilder->CreateExtractElement(breakWordVector, ConstantInt::get(T, i));
    239         Value * wordResult = wordResult = iBuilder->CreateCall(scanWordFunction, std::vector<Value *>({kernelStuctParam, matchWord, recordBreaksWord, scanwordPos, recordStart, recordNum}));
     239        Value * wordResult = iBuilder->CreateCall(scanWordFunction, {kernelStuctParam, matchWord, recordBreaksWord, scanwordPos, recordStart, recordNum});
    240240        scanwordPos = iBuilder->CreateAdd(scanwordPos, ConstantInt::get(T, scanWordBitWidth));
    241241        recordStart = iBuilder->CreateExtractValue(wordResult, std::vector<unsigned>({0}));
  • icGREP/icgrep-devel/icgrep/kernels/symboltablepipeline.cpp

    r5014 r5037  
    444444
    445445        AllocaInst * const buffer = iBuilder->CreateAlloca(gatherVectorType, iBuilder->getInt32(maxCount * 4), "buffer");
    446         Value * end = iBuilder->CreateGEP(buffer, {iBuilder->getInt32(maxCount * 4)});
     446        Value * end = iBuilder->CreateGEP(buffer, iBuilder->getInt32(maxCount * 4));
    447447        Value * size = iBuilder->CreateSub(iBuilder->CreatePtrToInt(end, iBuilder->getInt64Ty()), iBuilder->CreatePtrToInt(buffer, iBuilder->getInt64Ty()));
    448448        iBuilder->CreateMemSet(buffer, iBuilder->getInt8(0), size, 4);
  • icGREP/icgrep-devel/icgrep/pablo/builder.hpp

    r5023 r5037  
    3232
    3333    inline static PabloBuilder Create(PabloBlock * block) noexcept {
    34         return std::move(PabloBuilder(block));
     34        return PabloBuilder(block);
    3535    }
    3636
    3737    inline static PabloBuilder Create(PabloBuilder & builder) noexcept {
    38         return std::move(PabloBuilder(new PabloBlock(builder.mPb->mSymbolGenerator), builder));
     38        return PabloBuilder(new PabloBlock(builder.mPb->mSymbolGenerator), builder);
    3939    }
    4040
  • icGREP/icgrep-devel/icgrep/pablo/carry_manager.cpp

    r4974 r5037  
    242242    Value * countSoFar = iBuilder->CreateAlignedLoad(countPtr, 8);
    243243    Value * fieldCounts = iBuilder->simd_popcount(64, to_count);
    244     for (int i = 0; i < mBitBlockWidth/64; i++) {
     244    for (unsigned i = 0; i < mBitBlockWidth/64; ++i) {
    245245        countSoFar = iBuilder->CreateAdd(countSoFar, iBuilder->mvmd_extract(64, fieldCounts, i));
    246246    }
  • icGREP/icgrep-devel/icgrep/pablo/pabloAST.cpp

    r5023 r5037  
    1414
    1515PabloAST::Allocator PabloAST::mAllocator;
     16PabloAST::VectorAllocator PabloAST::mVectorAllocator;
    1617
    1718/** ------------------------------------------------------------------------------------------------------------- *
  • icGREP/icgrep-devel/icgrep/pablo/pabloAST.h

    r5023 r5037  
    3939
    4040    using Allocator = SlabAllocator<u_int8_t>;
    41     using VectorAllocator = Allocator::rebind<PabloAST *>::other;
     41    using VectorAllocator = SlabAllocator<PabloAST *>;
    4242    using Users = std::vector<PabloAST *, VectorAllocator>;
    4343    using user_iterator = Users::iterator;
     
    125125    inline PabloAST(const ClassTypeId id)
    126126    : mClassTypeId(id)
    127     , mUsers(reinterpret_cast<VectorAllocator &>(mAllocator))
     127    , mUsers(mVectorAllocator)
    128128    {
    129129
     
    135135    }
    136136    static Allocator        mAllocator;
     137    static VectorAllocator  mVectorAllocator;
    137138private:
    138139    const ClassTypeId       mClassTypeId;
  • icGREP/icgrep-devel/icgrep/pablo/ps_if.cpp

    r4896 r5037  
    55namespace pablo {
    66
     7If::DefinedAllocator If::mDefinedAllocator;
     8
    79If::If(PabloAST * expr, const std::initializer_list<Assign *> definedVars, PabloBlock * body)
    810: Statement(ClassTypeId::If, {expr}, nullptr)
    911, mBody(body)
    10 , mDefined(definedVars.begin(), definedVars.end(), reinterpret_cast<DefinedAllocator &>(mAllocator)) {
     12, mDefined(definedVars.begin(), definedVars.end(), mDefinedAllocator) {
    1113    // Conceptually, having a defined var X is identical to having:
    1214    //
     
    3032: Statement(ClassTypeId::If, {expr}, nullptr)
    3133, mBody(body)
    32 , mDefined(definedVars.begin(), definedVars.end(), reinterpret_cast<DefinedAllocator &>(mAllocator)) {
     34, mDefined(definedVars.begin(), definedVars.end(), mDefinedAllocator) {
    3335    mBody->setBranch(this);
    3436    mBody->setParent(getParent());
  • icGREP/icgrep-devel/icgrep/pablo/ps_if.h

    r4870 r5037  
    2020    friend class Simplifier;
    2121public:
    22     using DefinedAllocator = VectorAllocator::rebind<Assign *>::other;
     22    using DefinedAllocator = SlabAllocator<Assign *>;
    2323    using DefinedVars = std::vector<Assign *, DefinedAllocator>;
    2424
     
    5454    If(PabloAST * expr, const std::vector<Assign *> & definedVars, PabloBlock * body);
    5555private:
    56     PabloBlock *    mBody;
    57     DefinedVars     mDefined;
     56    PabloBlock *            mBody;
     57    DefinedVars             mDefined;
     58    static DefinedAllocator mDefinedAllocator;
    5859};
    5960
  • icGREP/icgrep-devel/icgrep/pablo/ps_while.cpp

    r4896 r5037  
    44namespace pablo {
    55
     6While::VariantAllocator While::mVariantAllocator;
     7
    68While::While(PabloAST * expr, const std::initializer_list<Next *> nextVars, PabloBlock * body)
    79: Statement(ClassTypeId::While, {expr}, nullptr)
    810, mBody(body)
    9 , mVariant(nextVars.begin(), nextVars.end(), reinterpret_cast<NextAllocator &>(mAllocator)) {
     11, mVariant(nextVars.begin(), nextVars.end(), mVariantAllocator) {
    1012    mBody->setBranch(this);
    1113    mBody->setParent(getParent());
     
    1921: Statement(ClassTypeId::While, {expr}, nullptr)
    2022, mBody(body)
    21 , mVariant(nextVars.begin(), nextVars.end(), reinterpret_cast<NextAllocator &>(mAllocator)) {
     23, mVariant(nextVars.begin(), nextVars.end(), mVariantAllocator) {
    2224    mBody->setBranch(this);
    2325    mBody->setParent(getParent());
  • icGREP/icgrep-devel/icgrep/pablo/ps_while.h

    r4876 r5037  
    1818public:
    1919
    20     using NextAllocator = VectorAllocator::rebind<Next*>::other;
    21     using Variants = std::vector<Next *, NextAllocator>;
     20    using VariantAllocator = SlabAllocator<Next *>;
     21    using Variants = std::vector<Next *, VariantAllocator>;
    2222
    2323    static inline bool classof(const PabloAST * e) {
     
    5050
    5151private:
    52     PabloBlock *    mBody;
    53     Variants        mVariant;
     52    PabloBlock *            mBody;
     53    Variants                mVariant;
     54    static VariantAllocator mVariantAllocator;
    5455};
    5556
  • icGREP/icgrep-devel/icgrep/re/printer_re.cpp

    r4841 r5037  
    148148        retVal = "???";
    149149    }
    150     return std::move(retVal);
     150    return retVal;
    151151}
  • icGREP/icgrep-devel/icgrep/re/re_cc.h

    r4983 r5037  
    159159
    160160inline CC * subtractCC(const CC * a, const CC * b) {
    161     return new CC(std::move(*a - *b));
     161    return new CC(*a - *b);
    162162}
    163163
    164164inline CC * intersectCC(const CC * a, const CC * b) {
    165     return new CC(std::move(*a & *b));
     165    return new CC(*a & *b);
    166166}
    167167
  • icGREP/icgrep-devel/icgrep/re/re_compiler.cpp

    r5030 r5037  
    160160                        } else {
    161161                        #endif
    162                             name->setDefinition(makeCC(std::move(UCD::resolveUnicodeSet(name))));
     162                            name->setDefinition(makeCC(UCD::resolveUnicodeSet(name)));
    163163                        #ifndef DISABLE_PREGENERATED_UCD_FUNCTIONS
    164164                        }
  • icGREP/icgrep-devel/icgrep/re/re_memoizer.hpp

    r4823 r5037  
    66
    77namespace re {
    8 
    9 namespace {
    108
    119struct MemoizerComparator {
     
    1917    }
    2018};
    21 
    22 }
    2319
    2420struct Memoizer : public std::set<RE *, MemoizerComparator> {
  • icGREP/icgrep-devel/icgrep/re/re_parser.cpp

    r4947 r5037  
    502502        }
    503503        // We have a property-name = value expression
    504         return createName(std::move(canonicalize(start, prop_end)), std::move(canonicalize(val_start, mCursor.pos())));
    505     }
    506     return createName(std::move(canonicalize(start, mCursor.pos())));
     504        return createName(canonicalize(start, prop_end), canonicalize(val_start, mCursor.pos()));
     505    }
     506    return createName(canonicalize(start, mCursor.pos()));
    507507}
    508508
     
    589589    // a following hyphen can indicate set subtraction.
    590590    enum {NoItem, CodepointItem, RangeItem, SetItem, BrackettedSetItem} lastItemKind = NoItem;
    591     codepoint_t lastCodepointItem;
    592 
     591
     592    codepoint_t lastCodepointItem = 0;
    593593    bool havePendingOperation = false;
    594     CharsetOperatorKind pendingOperationKind;
    595     RE * pendingOperand;
     594    CharsetOperatorKind pendingOperationKind = intersectOp;
     595    RE * pendingOperand = nullptr;
    596596
    597597    // If the first character after the [ is a ^ (caret) then the matching character class is complemented.
     
    865865        }
    866866        else {
    867             value = (value * 16) | ((t | 32) - 'a') + 10;
     867            value = ((value * 16) | ((t | 32) - 'a')) + 10;
    868868        }
    869869        ++mCursor;
  • icGREP/icgrep-devel/icgrep/re/re_re.cpp

    r4860 r5037  
    33namespace re {
    44RE::Allocator RE::mAllocator;
     5RE::VectorAllocator RE::mVectorAllocator;
    56}
  • icGREP/icgrep-devel/icgrep/re/re_re.h

    r4983 r5037  
    3939public:
    4040    using Allocator = SlabAllocator<u_int8_t>;
    41     using VectorAllocator = Allocator::rebind<RE *>::other;
     41    using VectorAllocator = SlabAllocator<RE *>;
    4242    enum class ClassTypeId : unsigned {
    4343        Alt
     
    7272
    7373    static Allocator mAllocator;
     74    static VectorAllocator mVectorAllocator;
    7475};
    7576
     
    8283    inline Vector(const ClassTypeId id)
    8384    : RE(id)
    84     , std::vector<RE*, RE::VectorAllocator>(reinterpret_cast<VectorAllocator &>(mAllocator))
     85    , std::vector<RE*, RE::VectorAllocator>(mVectorAllocator)
    8586    {
    8687
     
    8889    inline Vector(const ClassTypeId id, const iterator begin, const iterator end)
    8990    : RE(id)
    90     , std::vector<RE*, RE::VectorAllocator>(begin, end, reinterpret_cast<VectorAllocator &>(mAllocator)) {
     91    , std::vector<RE*, RE::VectorAllocator>(begin, end, mVectorAllocator) {
    9192
    9293    }
  • icGREP/icgrep-devel/icgrep/toolchain.cpp

    r5033 r5037  
    6969
    7070    std::string errMessage;
    71     EngineBuilder builder(std::move(std::unique_ptr<Module>(m)));
     71    EngineBuilder builder{std::unique_ptr<Module>(m)};
    7272    builder.setErrorStr(&errMessage);
    7373    builder.setMCPU(sys::getHostCPUName());
    7474    TargetOptions opts = InitTargetOptionsFromCodeGenFlags();
    75     #ifndef NDEBUG
    76     opts.JITEmitDebugInfo = 1;
    77     #endif
    7875    builder.setTargetOptions(opts);
    7976    CodeGenOpt::Level optLevel = CodeGenOpt::Level::None;
  • icGREP/icgrep-devel/icgrep/util/ispc.cpp

    r5033 r5037  
    3737
    3838#include "ispc.h"
    39 #include <stdlib.h>
     39#include <stdexcept>
    4040
    4141///////////////////////////////////////////////////////////////////////////
     
    4343
    4444#if !defined(ISPC_IS_WINDOWS) && !defined(__arm__)
    45 static void __cpuid(int info[4], int infoType) {
    46     __asm__ __volatile__ ("cpuid"
    47                           : "=a" (info[0]), "=b" (info[1]), "=c" (info[2]), "=d" (info[3])
    48                           : "0" (infoType));
     45#include <cpuid.h> // supplied by clang and gcc
     46static inline void cpuid(int info[4], int level) {
     47    __cpuid(level, info[0], info[1], info[2], info[3]);
    4948}
    5049
    51 /* Save %ebx in case it's the PIC register */
    52 static void __cpuidex(int info[4], int level, int count) {
    53   __asm__ __volatile__ ("xchg{l}\t{%%}ebx, %1\n\t"
    54                         "cpuid\n\t"
    55                         "xchg{l}\t{%%}ebx, %1\n\t"
    56                         : "=a" (info[0]), "=r" (info[1]), "=c" (info[2]), "=d" (info[3])
    57                         : "0" (level), "2" (count));
     50static void cpuid_count(int info[4], int level, int count) {
     51    __cpuid_count(level, count, info[0], info[1], info[2], info[3]);
     52}
     53#else
     54static inline void cpuid(int info[4], int level) {
     55    __cpuid(info, level);
     56}
     57
     58static void cpuid_count(int info[4], int level, int count) {
     59    __cpuidex(info, level, count);
    5860}
    5961#endif // !ISPC_IS_WINDOWS && !__ARM__
     
    98100#else
    99101    int info[4];
    100     __cpuid(info, 1);
     102    cpuid(info, 1);
    101103
    102104    int info2[4];
    103105    // Call cpuid with eax=7, ecx=0
    104     __cpuidex(info2, 7, 0);
     106    cpuid_count(info2, 7, 0);
    105107
    106108    if ((info[2] & (1 << 27)) != 0 &&  // OSXSAVE
     
    148150        return "sse2-i32x4";
    149151    else {
    150         //Error(SourcePos(), "Unable to detect supported SSE/AVX ISA.  Exiting.");
    151        
    152         exit(1);
     152        throw std::runtime_error("Unable to detect supported SSE/AVX ISA.");
    153153    }
    154154#endif
Note: See TracChangeset for help on using the changeset viewer.