Ignore:
Timestamp:
May 19, 2016, 8:50:15 PM (3 years ago)
Author:
cameron
Message:

Add pablo.atEOF; clean out bit4/6 hack for unterminated final lines in icgrep.

File:
1 edited

Legend:

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

    r5038 r5042  
    102102    BasicBlock * finalPartialBlock = BasicBlock::Create(mMod->getContext(), "partial", main, 0);
    103103    BasicBlock * finalEmptyBlock = BasicBlock::Create(mMod->getContext(), "empty", main, 0);
    104     BasicBlock * endBlock = BasicBlock::Create(mMod->getContext(), "end", main, 0);
    105     BasicBlock * unterminatedBlock = BasicBlock::Create(mMod->getContext(), "unterminated", main, 0);
    106104    BasicBlock * exitBlock = BasicBlock::Create(mMod->getContext(), "exit", main, 0);
    107105
     
    189187
    190188    iBuilder->SetInsertPoint(finalBlock);
    191     Value * const b4 = s2pInstance->getOutputStream(4);
    192     Value * const b6 = s2pInstance->getOutputStream(6);
    193189    Value * emptyBlockCond = iBuilder->CreateICmpEQ(remainingBytes, ConstantInt::get(int64ty, 0));
    194190    iBuilder->CreateCondBr(emptyBlockCond, finalEmptyBlock, finalPartialBlock);
     
    197193    iBuilder->SetInsertPoint(finalPartialBlock);
    198194    s2pInstance->CreateDoBlockCall();
    199     iBuilder->CreateBr(endBlock);
     195    iBuilder->CreateBr(exitBlock);
    200196
    201197    iBuilder->SetInsertPoint(finalEmptyBlock);
    202198    s2pInstance->clearOutputStreamSet();
    203     iBuilder->CreateBr(endBlock);
    204 
    205     iBuilder->SetInsertPoint(endBlock);
    206     Value * isFinalLineUnterminated = iBuilder->CreateICmpEQ(finalLineUnterminated, ConstantInt::getNullValue(finalLineUnterminated->getType()));
    207     iBuilder->CreateCondBr(isFinalLineUnterminated, exitBlock, unterminatedBlock);
    208    
    209     iBuilder->SetInsertPoint(unterminatedBlock);
     199    iBuilder->CreateBr(exitBlock);
     200
     201    iBuilder->SetInsertPoint(exitBlock);
    210202
    211203    Value * remaining = iBuilder->CreateZExt(remainingBytes, iBuilder->getIntNTy(mBlockSize));
    212     Value * EOF_pos = iBuilder->CreateShl(ConstantInt::get(iBuilder->getIntNTy(mBlockSize), 1), remaining);
    213     EOF_pos = iBuilder->CreateBitCast(EOF_pos, mBitBlockType);
    214     Value * EOF_mask = iBuilder->CreateShl(Constant::getAllOnesValue(iBuilder->getIntNTy(mBlockSize)), remaining);
    215         icGrepInstance->setInternalState("EOFmask", iBuilder->CreateBitCast(EOF_mask, mBitBlockType));
    216 
    217 
    218     Value * b4val = iBuilder->CreateBlockAlignedLoad(b4);
    219     b4val = iBuilder->CreateOr(b4val, EOF_pos);
    220     iBuilder->CreateBlockAlignedStore(b4val, b4);
    221 
    222     Value * b6val = iBuilder->CreateBlockAlignedLoad(b6);
    223     b6val = iBuilder->CreateOr(b6val, EOF_pos);
    224     iBuilder->CreateBlockAlignedStore(b6val, b6);
    225 
    226     iBuilder->CreateBr(exitBlock);
    227 
    228     iBuilder->SetInsertPoint(exitBlock);
     204    Value * EOFmark = iBuilder->CreateShl(ConstantInt::get(iBuilder->getIntNTy(mBlockSize), 1), remaining);
     205        icGrepInstance->setInternalState("EOFmark", iBuilder->CreateBitCast(EOFmark, mBitBlockType));
    229206
    230207    icGrepInstance->CreateDoBlockCall();
Note: See TracChangeset for help on using the changeset viewer.