Ignore:
Timestamp:
May 6, 2017, 4:05:05 PM (2 years ago)
Author:
nmedfort
Message:

Continued refactoring work.

File:
1 edited

Legend:

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

    r5422 r5435  
    3636namespace {
    3737
    38 Value * countForwardZeroes(IDISA::IDISA_Builder * iBuilder, Value * bits) {
    39     Value * cttzFunc = Intrinsic::getDeclaration(iBuilder->getModule(),
    40             Intrinsic::cttz, iBuilder->getSizeTy());
    41     // The last argument is is_zero_undef.  We'd like it to be false (defined)
    42     // so that cttz(0) == width.
    43     return iBuilder->CreateCall(cttzFunc, {bits, iBuilder->getFalse()});
    44 }
    45 
    46 #if 0
    47 Value * countReverseZeroes(IDISA::IDISA_Builder * iBuilder, Value * bits) {
    48     Value * ctlzFunc = Intrinsic::getDeclaration(iBuilder->getModule(),
    49             Intrinsic::ctlz, iBuilder->getSizeTy());
    50     // The last argument is is_zero_undef.  We'd like it to be false (defined)
    51     // so that ctlz(0) == width.
    52     return iBuilder->CreateCall(ctlzFunc, {bits, iBuilder->getFalse()});
    53 }
    54 #endif
    55 
    56 Value * generateBitswap(IDISA::IDISA_Builder * iBuilder, Value * v) {
     38Value * generateBitswap(IDISA::IDISA_Builder * const iBuilder, Value * v) {
    5739    Value * bswapFunc = Intrinsic::getDeclaration(iBuilder->getModule(),
    5840            Intrinsic::bswap, v->getType());
     
    6042}
    6143
    62 Value * selectMin(IDISA::IDISA_Builder * iBuilder, Value * a, Value * b) {
     44Value * selectMin(IDISA::IDISA_Builder * const iBuilder, Value * a, Value * b) {
    6345    return iBuilder->CreateSelect(iBuilder->CreateICmpULT(a, b), a, b);
    6446}
    6547
    66 #if 0
    67 Value * selectMax(IDISA::IDISA_Builder * iBuilder, Value * a, Value * b) {
    68     return iBuilder->CreateSelect(iBuilder->CreateICmpUGT(a, b), a, b);
    69 }
    70 #endif
    71 
    72 Value * createStackVar(IDISA::IDISA_Builder * iBuilder, Type * type, StringRef name, Value * initializer = nullptr) {
     48Value * createStackVar(IDISA::IDISA_Builder * const iBuilder, Type * type, StringRef name, Value * initializer = nullptr) {
    7349    Value * var = iBuilder->CreateAlloca(type, nullptr, name);
    7450    if (initializer) {
     
    8056}
    8157
    82 void incStackVar(IDISA::IDISA_Builder * iBuilder, Value * svar, Value * increment = nullptr) {
     58void incStackVar(IDISA::IDISA_Builder * const iBuilder, Value * svar, Value * increment = nullptr) {
    8359    Value * value = iBuilder->CreateLoad(svar);
    8460    if (increment) {
     
    9066}
    9167
    92 Value * getOutputPtr(IDISA::IDISA_Builder * iBuilder, Value * blockStartPtr, Value * offset) {
     68Value * getOutputPtr(IDISA::IDISA_Builder * const iBuilder, Value * blockStartPtr, Value * offset) {
    9369    return iBuilder->CreateGEP(
    9470            iBuilder->CreatePointerCast(blockStartPtr, iBuilder->getInt32Ty()->getPointerTo()),
     
    528504    Value * literalLen = iBuilder->CreateLoad(sTempLength);
    529505    Value * literalExtEnd = iBuilder->CreateTrunc(
    530         countForwardZeroes(iBuilder, iBuilder->CreateNot(iBuilder->CreateLoad(sExtender))),
    531         iBuilder->getInt32Ty()
    532         );
     506                iBuilder->CreateCountForwardZeroes(iBuilder->CreateNot(iBuilder->CreateLoad(sExtender))),
     507                iBuilder->getInt32Ty());
    533508    printRTDebugInt("wordOffset", wordOffset);
    534509    printRTDebugInt("literalExtEnd", literalExtEnd);
     
    649624    Value * matchLen = iBuilder->CreateLoad(sTempLength);
    650625    Value * matchExtEnd = iBuilder->CreateTrunc(
    651         countForwardZeroes(iBuilder, iBuilder->CreateNot(iBuilder->CreateLoad(sExtender))),
     626        iBuilder->CreateCountForwardZeroes(iBuilder->CreateNot(iBuilder->CreateLoad(sExtender))),
    652627        iBuilder->getInt32Ty()
    653628        );
     
    739714}
    740715
    741 LZ4IndexDecoderKernel::LZ4IndexDecoderKernel(IDISA::IDISA_Builder * iBuilder)
    742 : BlockOrientedKernel(iBuilder, "lz4IndexDecoder",
     716LZ4IndexDecoderKernel::LZ4IndexDecoderKernel(const std::unique_ptr<IDISA::IDISA_Builder> & iBuilder)
     717: BlockOrientedKernel("lz4IndexDecoder",
    743718    // Inputs
    744719    {Binding{iBuilder->getStreamSetTy(1, 8), "byteStream"},
Note: See TracChangeset for help on using the changeset viewer.