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/symboltablepipeline.cpp

    r5037 r5106  
    239239
    240240    Value * blockPos = iBuilder->CreateLoad(kBuilder->getBlockNo());
    241     blockPos = iBuilder->CreateMul(blockPos, iBuilder->getInt64(iBuilder->getBitBlockWidth()));
     241    blockPos = iBuilder->CreateMul(blockPos, ConstantInt::get(iBuilder->getSizeTy(), iBuilder->getBitBlockWidth()));
    242242
    243243    iBuilder->CreateBr(groupCond);
     
    275275    // START OUTER COND
    276276    iBuilder->SetInsertPoint(startOuterCond);
    277     PHINode * startBlockOffset = iBuilder->CreatePHI(iBuilder->getInt64Ty(), 2);
     277    PHINode * startBlockOffset = iBuilder->CreatePHI(iBuilder->getSizeTy(), 2);
    278278    startBlockOffset->addIncoming(blockPos, groupBody);
    279279    PHINode * startIndexPhi1 = iBuilder->CreatePHI(startIndex->getType(), 2, "startIndexPhi1");
    280280    startIndexPhi1->addIncoming(startIndex, groupBody);
    281     PHINode * startIV = iBuilder->CreatePHI(iBuilder->getInt64Ty(), 2);
    282     startIV->addIncoming(iBuilder->getInt64(0), groupBody);
    283     Value * startOuterTest = iBuilder->CreateICmpNE(startIV, iBuilder->getInt64(fieldCount));
     281    PHINode * startIV = iBuilder->CreatePHI(iBuilder->getSizeTy(), 2);
     282    startIV->addIncoming(ConstantInt::get(iBuilder->getSizeTy(), 0), groupBody);
     283    Value * startOuterTest = iBuilder->CreateICmpNE(startIV, ConstantInt::get(iBuilder->getSizeTy(), fieldCount));
    284284    iBuilder->CreateCondBr(startOuterTest, startOuterBody, endOuterCond);
    285285
     
    287287    iBuilder->SetInsertPoint(startOuterBody);
    288288    Value * startField = iBuilder->CreateExtractElement(startStream, startIV);
    289     startIV->addIncoming(iBuilder->CreateAdd(startIV, iBuilder->getInt64(1)), startInnerCond);
    290     startBlockOffset->addIncoming(iBuilder->CreateAdd(startBlockOffset, iBuilder->getInt64(scanWordBitWidth)), startInnerCond);
     289    startIV->addIncoming(iBuilder->CreateAdd(startIV, ConstantInt::get(iBuilder->getSizeTy(), 1)), startInnerCond);
     290    startBlockOffset->addIncoming(iBuilder->CreateAdd(startBlockOffset, ConstantInt::get(iBuilder->getSizeTy(), scanWordBitWidth)), startInnerCond);
    291291    iBuilder->CreateBr(startInnerCond);
    292292
     
    312312    // END POINT OUTER COND
    313313    iBuilder->SetInsertPoint(endOuterCond);
    314     PHINode * endBlockOffset = iBuilder->CreatePHI(iBuilder->getInt64Ty(), 2);
     314    PHINode * endBlockOffset = iBuilder->CreatePHI(iBuilder->getSizeTy(), 2);
    315315    endBlockOffset->addIncoming(blockPos, startOuterCond);
    316316    PHINode * endIndexPhi1 = iBuilder->CreatePHI(endIndex->getType(), 2);
     
    318318    PHINode * startIndexPhi3 = iBuilder->CreatePHI(startIndex->getType(), 2, "startIndexPhi3");
    319319    startIndexPhi3->addIncoming(startIndexPhi1, startOuterCond);
    320     PHINode * endIV = iBuilder->CreatePHI(iBuilder->getInt64Ty(), 2);
    321     endIV->addIncoming(iBuilder->getInt64(0), startOuterCond);
    322     Value * endOuterTest = iBuilder->CreateICmpNE(endIV, iBuilder->getInt64(fieldCount));
     320    PHINode * endIV = iBuilder->CreatePHI(iBuilder->getSizeTy(), 2);
     321    endIV->addIncoming(ConstantInt::get(iBuilder->getSizeTy(), 0), startOuterCond);
     322    Value * endOuterTest = iBuilder->CreateICmpNE(endIV, ConstantInt::get(iBuilder->getSizeTy(), fieldCount));
    323323    iBuilder->CreateCondBr(endOuterTest, endOuterBody, nextGroup);
    324324
     
    326326    iBuilder->SetInsertPoint(endOuterBody);
    327327    Value * endField = iBuilder->CreateExtractElement(endStream, endIV);
    328     endIV->addIncoming(iBuilder->CreateAdd(endIV, iBuilder->getInt64(1)), endInnerCond);
    329     endBlockOffset->addIncoming(iBuilder->CreateAdd(endBlockOffset, iBuilder->getInt64(scanWordBitWidth)), endInnerCond);
     328    endIV->addIncoming(iBuilder->CreateAdd(endIV, ConstantInt::get(iBuilder->getSizeTy(), 1)), endInnerCond);
     329    endBlockOffset->addIncoming(iBuilder->CreateAdd(endBlockOffset, ConstantInt::get(iBuilder->getSizeTy(), scanWordBitWidth)), endInnerCond);
    330330    iBuilder->CreateBr(endInnerCond);
    331331
     
    445445        AllocaInst * const buffer = iBuilder->CreateAlloca(gatherVectorType, iBuilder->getInt32(maxCount * 4), "buffer");
    446446        Value * end = iBuilder->CreateGEP(buffer, iBuilder->getInt32(maxCount * 4));
    447         Value * size = iBuilder->CreateSub(iBuilder->CreatePtrToInt(end, iBuilder->getInt64Ty()), iBuilder->CreatePtrToInt(buffer, iBuilder->getInt64Ty()));
     447        Value * size = iBuilder->CreateSub(iBuilder->CreatePtrToInt(end, iBuilder->getSizeTy()), iBuilder->CreatePtrToInt(buffer, iBuilder->getSizeTy()));
    448448        iBuilder->CreateMemSet(buffer, iBuilder->getInt8(0), size, 4);
    449449        Value * const transposed = iBuilder->CreateBitCast(buffer, transposedVectorType->getPointerTo(), "transposed");
     
    645645Function * SymbolTableBuilder::ExecuteKernels(){
    646646
    647     Type * intType = iBuilder->getInt64Ty();
     647    Type * intType = iBuilder->getSizeTy();
    648648
    649649    Type * inputType = PointerType::get(ArrayType::get(StructType::get(mMod->getContext(), std::vector<Type *>({ArrayType::get(mBitBlockType, 8)})), 1), 0);
     
    684684    const unsigned leadingBlocks = (mLongestLookahead + iBuilder->getBitBlockWidth() - 1) / iBuilder->getBitBlockWidth();
    685685
    686     Value * const requiredBytes = iBuilder->getInt64(mBlockSize * leadingBlocks);
    687     Value * const blockSize = iBuilder->getInt64(mBlockSize);
     686    Value * const requiredBytes = ConstantInt::get(iBuilder->getSizeTy(), mBlockSize * leadingBlocks);
     687    Value * const blockSize = ConstantInt::get(iBuilder->getSizeTy(), mBlockSize);
    688688
    689689    // First compute any necessary leading blocks to allow the sorting kernel access to the "future" data produced by
     
    732732    remainingBytes3->addIncoming(bufferSize, partialLeadingCond);
    733733    remainingBytes3->addIncoming(remainingBytes2, regularCondBlock);
    734     Value * partialBlockCond = iBuilder->CreateICmpSGT(remainingBytes3, iBuilder->getInt64(0));
     734    Value * partialBlockCond = iBuilder->CreateICmpSGT(remainingBytes3, ConstantInt::get(iBuilder->getSizeTy(), 0));
    735735    iBuilder->CreateCondBr(partialBlockCond, partialBodyBlock, flushLengthGroupsBlock);
    736736
Note: See TracChangeset for help on using the changeset viewer.