Ignore:
Timestamp:
Jul 23, 2016, 1:04:44 PM (3 years ago)
Author:
cameron
Message:

Use dynamic size_t determination

File:
1 edited

Legend:

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

    r5099 r5106  
    2525       
    2626    const unsigned segmentSize = codegen::SegmentSize;
    27     Type * const int64ty = iBuilder->getInt64Ty();
     27    Type * const size_ty = iBuilder->getSizeTy();
    2828
    2929    // Create the basic blocks for the loop.
     
    4747        iBuilder->CreateBr(segmentCondBlock);
    4848        iBuilder->SetInsertPoint(segmentCondBlock);
    49         PHINode * remainingBytes = iBuilder->CreatePHI(int64ty, 2, "remainingBytes");
     49        PHINode * remainingBytes = iBuilder->CreatePHI(size_ty, 2, "remainingBytes");
    5050        remainingBytes->addIncoming(fileSize, entryBlock);
    51         PHINode * blockNo = iBuilder->CreatePHI(int64ty, 2, "blockNo");
    52         blockNo->addIncoming(iBuilder->getInt64(0), entryBlock);
     51        PHINode * blockNo = iBuilder->CreatePHI(size_ty, 2, "blockNo");
     52        blockNo->addIncoming(ConstantInt::get(size_ty, 0), entryBlock);
    5353       
    54         Constant * const step = ConstantInt::get(int64ty, iBuilder->getBitBlockWidth() * segmentSize);
     54        Constant * const step = ConstantInt::get(size_ty, iBuilder->getBitBlockWidth() * segmentSize);
    5555        Value * segmentCondTest = iBuilder->CreateICmpULT(remainingBytes, step);
    5656        iBuilder->CreateCondBr(segmentCondTest, fullCondBlock, segmentBodyBlock);
    5757       
    5858        iBuilder->SetInsertPoint(segmentBodyBlock);
    59         Value * segBlocks = ConstantInt::get(int64ty, segmentSize);
     59        Value * segBlocks = ConstantInt::get(size_ty, segmentSize);
    6060        Value * rslt = kernels[0]->createDoSegmentCall(instances[0], segBlocks);
    6161        for (unsigned i = 1; i < kernels.size(); i++) {
     
    7171    } else {
    7272        initialBufferSize = fileSize;
    73         initialBlockNo = ConstantInt::get(int64ty, 0);
     73        initialBlockNo = ConstantInt::get(size_ty, 0);
    7474        initialBlock = entryBlock;
    7575        iBuilder->CreateBr(fullCondBlock);
     
    7777   
    7878    iBuilder->SetInsertPoint(fullCondBlock);
    79     PHINode * remainingBytes = iBuilder->CreatePHI(int64ty, 2, "remainingBytes");
     79    PHINode * remainingBytes = iBuilder->CreatePHI(size_ty, 2, "remainingBytes");
    8080    remainingBytes->addIncoming(initialBufferSize, initialBlock);
    81     PHINode * blockNo = iBuilder->CreatePHI(int64ty, 2, "blockNo");
     81    PHINode * blockNo = iBuilder->CreatePHI(size_ty, 2, "blockNo");
    8282    blockNo->addIncoming(initialBlockNo, initialBlock);
    8383   
    84     Constant * const step = ConstantInt::get(int64ty, iBuilder->getBitBlockWidth());
     84    Constant * const step = ConstantInt::get(size_ty, iBuilder->getBitBlockWidth());
    8585    Value * fullCondTest = iBuilder->CreateICmpULT(remainingBytes, step);
    8686    iBuilder->CreateCondBr(fullCondTest, finalBlock, fullBodyBlock);
     
    8888    // Full Block Pipeline loop
    8989    iBuilder->SetInsertPoint(fullBodyBlock);
    90     rslt = kernels[0]->createDoSegmentCall(instances[0], ConstantInt::get(int64ty, 1));
     90    rslt = kernels[0]->createDoSegmentCall(instances[0], ConstantInt::get(size_ty, 1));
    9191    for (unsigned i = 1; i < kernels.size(); i++) {
    92         rslt = kernels[i]->createDoSegmentCall(instances[i], rslt->getType()->isVoidTy() ? ConstantInt::get(int64ty, 1) : rslt);
     92        rslt = kernels[i]->createDoSegmentCall(instances[i], rslt->getType()->isVoidTy() ? ConstantInt::get(size_ty, 1) : rslt);
    9393    }
    9494   
    9595    remainingBytes->addIncoming(iBuilder->CreateSub(remainingBytes, step), fullBodyBlock);
    96     blockNo->addIncoming(iBuilder->CreateAdd(blockNo, iBuilder->getInt64(1)), fullBodyBlock);
     96    blockNo->addIncoming(iBuilder->CreateAdd(blockNo, ConstantInt::get(size_ty, 1)), fullBodyBlock);
    9797    iBuilder->CreateBr(fullCondBlock);
    9898   
Note: See TracChangeset for help on using the changeset viewer.