Ignore:
Timestamp:
Aug 28, 2017, 4:00:17 PM (23 months ago)
Author:
nmedfort
Message:

Bug fixes for multigrep mode. Optional PabloKernel? branch hit counter added. Minor optimizations.

File:
1 edited

Legend:

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

    r5310 r5620  
    1212#include <pablo/builder.hpp>
    1313#include <pablo/pablo_kernel.h>
     14
    1415
    1516using namespace re;
     
    3334   
    3435   
    35     CC_Compiler::CC_Compiler(pablo::PabloKernel * kernel, pablo::Var * basisBits)
    36     : mBuilder(kernel->getEntryBlock())
    37     , mEncodingBits(basisBits->getType()->getArrayNumElements())
    38     , mBasisBit(mEncodingBits) {
    39         for (unsigned i = 0; i != mEncodingBits; i++) {
    40             mBasisBit[i] = mBuilder.createExtract(basisBits, mBuilder.getInteger(i)); assert (mBasisBit[i]);
    41         }
    42         mEncodingMask = (static_cast<unsigned>(1) << mEncodingBits) - static_cast<unsigned>(1);
    43     }
    44    
    45    
    46 
    47 PabloAST * CC_Compiler::compileCC(const std::string & canonicalName, const CC *cc, PabloBlock & block) {
     36CC_Compiler::CC_Compiler(pablo::PabloKernel * kernel, pablo::Var * basisBits)
     37: mBuilder(kernel->getEntryBlock())
     38, mEncodingBits(basisBits->getType()->getArrayNumElements())
     39, mBasisBit(mEncodingBits) {
     40    for (unsigned i = 0; i != mEncodingBits; i++) {
     41        mBasisBit[i] = mBuilder.createExtract(basisBits, mBuilder.getInteger(i)); assert (mBasisBit[i]);
     42    }
     43    mEncodingMask = (static_cast<unsigned>(1) << mEncodingBits) - static_cast<unsigned>(1);
     44}
     45
     46PabloAST * CC_Compiler::compileCC(const std::string & canonicalName, const CC *cc, PabloBlock & block) {   
    4847    PabloAST * const var = charset_expr(cc, block);
    4948    if (LLVM_LIKELY(isa<Statement>(var))) {
     
    155154    for (codepoint_t diff_bits = n1 ^ n2; diff_bits; diff_count++, diff_bits >>= 1);
    156155
    157     if ((n2 < n1) || (diff_count > mEncodingBits))
    158     {
    159         throw std::runtime_error("Bad Range: [" + std::to_string(n1) + "," + std::to_string(n2) + "]");
     156    if ((n2 < n1) || (diff_count > mEncodingBits)) {
     157        throw std::runtime_error("Bad Range: [" + std::to_string(n1) + "," +
     158                                 std::to_string(n2) + "] for " +
     159                                 std::to_string(mEncodingBits) + "-bit encoding");
    160160    }
    161161
Note: See TracChangeset for help on using the changeset viewer.