Ignore:
Timestamp:
Jan 5, 2017, 3:54:40 PM (3 years ago)
Author:
nmedfort
Message:

Code clean up to enforce proper calling order of KernelBuilder? methods

File:
1 edited

Legend:

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

    r5238 r5246  
    4040}
    4141               
    42 void p2sKernel::generateDoBlockMethod() {
     42void p2sKernel::generateDoBlockMethod() const {
    4343    auto savePoint = iBuilder->saveIP();
    4444    Module * m = iBuilder->getModule();
     
    6666}
    6767       
    68 void p2sKernel_withCompressedOutput::generateDoBlockMethod() {
     68void p2sKernel_withCompressedOutput::generateDoBlockMethod() const {
    6969    auto savePoint = iBuilder->saveIP();
    7070    Module * m = iBuilder->getModule();
     
    8282    Value * byteStreamBlock_ptr = getStreamSetBlockPtr(self, "byteStream", blockNo);
    8383   
    84     Value * p_bitblock[8];
     84    Value * basisBits[8];
    8585    for (unsigned i = 0; i < 8; i++) {
    86         p_bitblock[i] = iBuilder->CreateBlockAlignedLoad(basisBitsBlock_ptr, {iBuilder->getInt32(0), iBuilder->getInt32(i)});
    87     }
    88     Value * s_bytepack[8];
    89     p2s(iBuilder, p_bitblock, s_bytepack);
     86        basisBits[i] = iBuilder->CreateBlockAlignedLoad(basisBitsBlock_ptr, {iBuilder->getInt32(0), iBuilder->getInt32(i)});
     87    }
     88    Value * bytePack[8];
     89    p2s(iBuilder, basisBits, bytePack);
    9090   
    9191    unsigned units_per_register = iBuilder->getBitBlockWidth()/8;
     
    9797   
    9898    for (unsigned j = 0; j < 8; ++j) {
    99         iBuilder->CreateAlignedStore(s_bytepack[j], iBuilder->CreateBitCast(iBuilder->CreateGEP(output_ptr, offset), bitBlockPtrTy), 1);
     99        iBuilder->CreateAlignedStore(bytePack[j], iBuilder->CreateBitCast(iBuilder->CreateGEP(output_ptr, offset), bitBlockPtrTy), 1);
    100100        offset = iBuilder->CreateZExt(iBuilder->CreateExtractElement(unit_counts, iBuilder->getInt32(j)), i32);
    101101    }
     
    104104}
    105105
    106 void p2s_16Kernel::generateDoBlockMethod() {
     106void p2s_16Kernel::generateDoBlockMethod() const {
    107107    auto savePoint = iBuilder->saveIP();
    108108    Module * m = iBuilder->getModule();
     
    141141}
    142142
    143 void p2s_16Kernel_withCompressedOutput::generateDoBlockMethod() {
     143void p2s_16Kernel_withCompressedOutput::generateDoBlockMethod() const {
    144144    auto savePoint = iBuilder->saveIP();
    145145    Module * m = iBuilder->getModule();
     
    150150
    151151    iBuilder->SetInsertPoint(BasicBlock::Create(iBuilder->getContext(), "entry", doBlockFunction, 0));
    152     Constant * stride = ConstantInt::get(iBuilder->getSizeTy(), iBuilder->getStride());
     152    Constant * stride = iBuilder->getSize(iBuilder->getStride());
    153153
    154154    Value * self = getParameter(doBlockFunction, "self");
     
    199199}
    200200
    201 void p2s_16Kernel_withCompressedOutput::generateFinalBlockMethod() {
     201void p2s_16Kernel_withCompressedOutput::generateFinalBlockMethod() const {
    202202    auto savePoint = iBuilder->saveIP();
    203203    Module * m = iBuilder->getModule();
Note: See TracChangeset for help on using the changeset viewer.