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

Use dynamic size_t determination

Location:
icGREP/icgrep-devel/icgrep
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/IDISA/idisa_builder.cpp

    r5084 r5106  
    8383    Constant * printRegister = mMod->getFunction("PrintInt");
    8484    if (LLVM_UNLIKELY(printRegister == nullptr)) {
    85         FunctionType *FT = FunctionType::get(getVoidTy(), { PointerType::get(getInt8Ty(), 0), getInt64Ty() }, false);
     85        FunctionType *FT = FunctionType::get(getVoidTy(), { PointerType::get(getInt8Ty(), 0), getSizeTy() }, false);
    8686        Function * function = Function::Create(FT, Function::InternalLinkage, "PrintInt", mMod);
    8787        auto arg = function->arg_begin();
     
    104104    Value * num = nullptr;
    105105    if (value->getType()->isPointerTy()) {
    106         num = CreatePtrToInt(value, getInt64Ty());
     106        num = CreatePtrToInt(value, getSizeTy());
    107107    } else {
    108         num = CreateZExtOrBitCast(value, getInt64Ty());
     108        num = CreateZExtOrBitCast(value, getSizeTy());
    109109    }
    110110    assert (num->getType()->isIntegerTy());
  • icGREP/icgrep-devel/icgrep/IDISA/idisa_builder.h

    r5073 r5106  
    1212#include <llvm/IR/Value.h>
    1313#include <llvm/IR/IRBuilder.h>
     14#include <llvm/Support/Host.h>
     15#include <llvm/ADT/Triple.h>
    1416
    1517using namespace llvm;
     
    6264        return mOneInitializer;
    6365    }
     66   
    6467
    6568    LoadInst * CreateBlockAlignedLoad(Value * const ptr);
     
    122125    Value * fwCast(unsigned fw, Value * a);
    123126   
     127    inline llvm::Type * getSizeTy() {return Triple(llvm::sys::getProcessTriple()).isArch32Bit() ? getInt32Ty() : getInt64Ty();}
     128   
    124129protected:
    125130    Module * mMod;
     
    156161    CreateBlockAlignedStore(value, CreateGEP(ptr, indicies));
    157162}
     163   
    158164
    159165}
  • icGREP/icgrep-devel/icgrep/grep_engine.cpp

    r5102 r5106  
    8282bool isUTF_16 = false;
    8383
    84 void GrepEngine::doGrep(const std::string & fileName, const int fileIdx, bool CountOnly, std::vector<uint64_t> & total_CountOnly, bool UTF_16) {
     84void GrepEngine::doGrep(const std::string & fileName, const int fileIdx, bool CountOnly, std::vector<size_t> & total_CountOnly, bool UTF_16) {
    8585    boost::filesystem::path file(fileName);
    8686    if (exists(file)) {
     
    109109    } else {
    110110        if (CountOnly) {
    111             mGrepFunction_CountOnly(nullptr, 0, fileIdx);
     111            total_CountOnly[fileIdx] = mGrepFunction_CountOnly(nullptr, 0, fileIdx);
    112112        } else {
    113113            mGrepFunction(nullptr, 0, fileIdx);
     
    134134    mIsNameExpression = isNameExpression;
    135135
    136     Type * const int64ty = iBuilder->getInt64Ty();
     136    Type * const size_ty = iBuilder->getSizeTy();
    137137    Type * const int8PtrTy = iBuilder->getInt8PtrTy();
    138138    Type * const inputType = PointerType::get(ArrayType::get(ArrayType::get(iBuilder->getBitBlockType(), (UTF_16 ? 16 : 8)), 1), 0);
    139     Type * const resultTy = CountOnly ? int64ty : iBuilder->getVoidTy();
    140     Function * const mainFn = cast<Function>(M->getOrInsertFunction("Main", resultTy, inputType, int64ty, int64ty, nullptr));
     139    Type * const resultTy = CountOnly ? size_ty : iBuilder->getVoidTy();
     140    Function * const mainFn = cast<Function>(M->getOrInsertFunction("Main", resultTy, inputType, size_ty, size_ty, nullptr));
    141141    mainFn->setCallingConv(CallingConv::C);
    142142    iBuilder->SetInsertPoint(BasicBlock::Create(M->getContext(), "entry", mainFn, 0));
     
    177177    }
    178178    else {
    179         kernel::scanMatchKernel scanMatchK(iBuilder, MatchResults, 64, false);
     179        kernel::scanMatchKernel scanMatchK(iBuilder, MatchResults, false);
    180180        scanMatchK.generateKernel();
    181181               
     
    242242
    243243extern "C" {
    244     void wrapped_report_match(uint64_t lineNum, uint64_t line_start, uint64_t line_end, const char * buffer, uint64_t filesize, int fileIdx) {
     244    void wrapped_report_match(size_t lineNum, size_t line_start, size_t line_end, const char * buffer, size_t filesize, int fileIdx) {
    245245        int index = isUTF_16 ? 2 : 1;
    246246        int idx = fileIdx;
     
    302302}
    303303
    304 void PrintResult(bool CountOnly, std::vector<uint64_t> & total_CountOnly){
     304void PrintResult(bool CountOnly, std::vector<size_t> & total_CountOnly){
    305305    if(CountOnly){
    306306        if (!ShowFileNames) {
     
    325325
    326326extern "C" {
    327     void insert_codepoints(uint64_t lineNum, uint64_t line_start, uint64_t line_end, const char * buffer) {
     327    void insert_codepoints(size_t lineNum, size_t line_start, size_t line_end, const char * buffer) {
    328328        re::codepoint_t c = 0;
    329329        ssize_t line_pos = line_start;
  • icGREP/icgrep-devel/icgrep/kernels/interface.cpp

    r5103 r5106  
    5353   
    5454    std::vector<Type *> doBlockParameters = {selfType};
    55     std::vector<Type *> finalBlockParameters = {selfType, iBuilder->getInt64Ty()};
     55    std::vector<Type *> finalBlockParameters = {selfType, iBuilder->getSizeTy()};
    5656    /*
    5757    for (auto inputSet : mStreamSetInputs) {
     
    109109    */
    110110    // Create the doSegment function prototype.
    111     std::vector<Type *> doSegmentParameters = {selfType, iBuilder->getInt64Ty()};
     111    std::vector<Type *> doSegmentParameters = {selfType, iBuilder->getSizeTy()};
    112112    FunctionType * doSegmentFunctionType = FunctionType::get(mDoBlockReturnType, doSegmentParameters, false);
    113113    std::string doSegmentName = mKernelName + doSegment_suffix;
  • icGREP/icgrep-devel/icgrep/kernels/kernel.cpp

    r5104 r5106  
    3737void KernelBuilder::prepareKernel() {
    3838    if (!mDoBlockReturnType) mDoBlockReturnType = iBuilder->getVoidTy();
    39     addScalar(iBuilder->getInt64Ty(), blockNoScalar);
     39    addScalar(iBuilder->getSizeTy(), blockNoScalar);
    4040    int streamSetNo = 0;
    4141    for (auto sSet : mStreamSetInputs) {
     
    154154    iBuilder->SetInsertPoint(blockLoop);
    155155    if (mDoBlockReturnType->isVoidTy()) {
    156         PHINode * blocksRemaining = iBuilder->CreatePHI(iBuilder->getInt64Ty(), 2, "blocksRemaining");
     156        PHINode * blocksRemaining = iBuilder->CreatePHI(iBuilder->getSizeTy(), 2, "blocksRemaining");
    157157        blocksRemaining->addIncoming(blocksToDo, entryBlock);
    158158       
     
    160160       
    161161        iBuilder->CreateCall(doBlockFunction, {self});
    162         setScalarField(self, blockNoScalar, iBuilder->CreateAdd(blockNo, iBuilder->getInt64(1)));
    163         blocksToDo = iBuilder->CreateSub(blocksRemaining, iBuilder->getInt64(1));
     162        setScalarField(self, blockNoScalar, iBuilder->CreateAdd(blockNo, ConstantInt::get(iBuilder->getSizeTy(), 1)));
     163        blocksToDo = iBuilder->CreateSub(blocksRemaining, ConstantInt::get(iBuilder->getSizeTy(), 1));
    164164        blocksRemaining->addIncoming(blocksToDo, blockLoop);
    165         Value * notDone = iBuilder->CreateICmpUGT(blocksToDo, iBuilder->getInt64(0));
     165        Value * notDone = iBuilder->CreateICmpUGT(blocksToDo, ConstantInt::get(iBuilder->getSizeTy(), 0));
    166166        iBuilder->CreateCondBr(notDone, blockLoop, blocksDone);
    167167       
     
    170170    }
    171171    else {
    172         PHINode * blocksRemaining = iBuilder->CreatePHI(iBuilder->getInt64Ty(), 2, "blocksRemaining");
     172        PHINode * blocksRemaining = iBuilder->CreatePHI(iBuilder->getSizeTy(), 2, "blocksRemaining");
    173173        blocksRemaining->addIncoming(blocksToDo, entryBlock);
    174174        PHINode * total = iBuilder->CreatePHI(mDoBlockReturnType, 2, "resultTotal");
     
    179179       
    180180        Value * rslt = iBuilder->CreateCall(doBlockFunction, {self});
    181         setScalarField(self, blockNoScalar, iBuilder->CreateAdd(blockNo, iBuilder->getInt64(1)));
    182         blocksToDo = iBuilder->CreateSub(blocksRemaining, iBuilder->getInt64(1));
     181        setScalarField(self, blockNoScalar, iBuilder->CreateAdd(blockNo, ConstantInt::get(iBuilder->getSizeTy(), 1)));
     182        blocksToDo = iBuilder->CreateSub(blocksRemaining, ConstantInt::get(iBuilder->getSizeTy(), 1));
    183183        blocksRemaining->addIncoming(blocksToDo, blockLoop);
    184         Value * notDone = iBuilder->CreateICmpUGT(blocksToDo, iBuilder->getInt64(0));
     184        Value * notDone = iBuilder->CreateICmpUGT(blocksToDo, ConstantInt::get(iBuilder->getSizeTy(), 0));
    185185        Value * totalSoFar = iBuilder->CreateAdd(total, rslt);
    186186        total->addIncoming(totalSoFar, blockLoop);
  • 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   
  • icGREP/icgrep-devel/icgrep/kernels/s2p_kernel.cpp

    r5104 r5106  
    138138    BasicBlock * exitBlock = BasicBlock::Create(iBuilder->getContext(), "exit", finalBlockFunction, 0);
    139139   
    140     Value * emptyBlockCond = iBuilder->CreateICmpEQ(remainingBytes, ConstantInt::get(iBuilder->getInt64Ty(), 0));
     140    Value * emptyBlockCond = iBuilder->CreateICmpEQ(remainingBytes, ConstantInt::get(iBuilder->getSizeTy(), 0));
    141141    iBuilder->CreateCondBr(emptyBlockCond, finalEmptyBlock, finalPartialBlock);
    142142    iBuilder->SetInsertPoint(finalPartialBlock);
  • icGREP/icgrep-devel/icgrep/kernels/scanmatchgen.h

    r5102 r5106  
    88#include "streamset.h"
    99#include "kernel.h"
     10#include <llvm/Support/Host.h>
     11#include <llvm/ADT/Triple.h>
    1012
    1113namespace llvm { class Module; class Function;}
     
    1719class scanMatchKernel : public KernelBuilder {
    1820public:
    19     scanMatchKernel(IDISA::IDISA_Builder * iBuilder, parabix::StreamSetBuffer& matchResults, unsigned scanwordBitWidth, bool isNameExpression) :
     21    scanMatchKernel(IDISA::IDISA_Builder * iBuilder, parabix::StreamSetBuffer& matchResults, bool isNameExpression) :
    2022    KernelBuilder(iBuilder, "scanMatch",
    2123                  {StreamSetBinding{matchResults, "matchResults"}},
    2224                    {},
    23                     {ScalarBinding{iBuilder->getInt8PtrTy(), "FileBuf"}, ScalarBinding{iBuilder->getInt64Ty(), "FileSize"}, ScalarBinding{iBuilder->getInt64Ty(), "FileIdx"}},
     25                    {ScalarBinding{iBuilder->getInt8PtrTy(), "FileBuf"}, ScalarBinding{iBuilder->getSizeTy(), "FileSize"}, ScalarBinding{iBuilder->getSizeTy(), "FileIdx"}},
    2426                    {},
    25                     {ScalarBinding{iBuilder->getInt64Ty(), "BlockNo"}, ScalarBinding{iBuilder->getInt64Ty(), "LineStart"}, ScalarBinding{iBuilder->getInt64Ty(), "LineNum"}}),
     27                    {ScalarBinding{iBuilder->getSizeTy(), "BlockNo"}, ScalarBinding{iBuilder->getSizeTy(), "LineStart"}, ScalarBinding{iBuilder->getSizeTy(), "LineNum"}}),
    2628
    27     mScanwordBitWidth(scanwordBitWidth),
     29    mScanwordBitWidth(Triple(llvm::sys::getProcessTriple()).isArch32Bit() ? 32 : 64),
    2830    mIsNameExpression(isNameExpression) {}
    2931       
  • icGREP/icgrep-devel/icgrep/kernels/stdout_kernel.cpp

    r5100 r5106  
    3939    Value * self = getParameter(doBlockFunction, "self");
    4040    Value * blockNo = getScalarField(self, blockNoScalar);
    41     Value * inputStreamBlock = getCircularBufferBlockPointer(self, "inputStreamSet", blockNo);
     41    Value * inputStreamBlock = getStreamSetBlockPtr(self, "inputStreamSet", blockNo);
    4242
    4343    Value * bufferPtr = getScalarField(self, "bufferPtr");
  • icGREP/icgrep-devel/icgrep/kernels/stdout_kernel.h

    r5100 r5106  
    1616class stdOutKernel : public KernelBuilder {
    1717public:
    18     stdOutKernel(IDISA::IDISA_Builder * iBuilder, unsigned codeUnitWidth) :
     18    stdOutKernel(IDISA::IDISA_Builder * iBuilder, unsigned codeUnitWidth, parabix::StreamSetBuffer & codeUnitBuffer) :
    1919    KernelBuilder(iBuilder, "stdout",
    20                   {StreamSetBinding{StreamSetType(1, codeUnitWidth), "codeUnitBuffer"}}, {}, {}, {}, {}) {
    21         mStreamType = PointerType::get(StreamSetType(1, codeUnitWidth).getStreamSetBlockType(iBuilder), 0);
     20                  {StreamSetBinding{codeUnitBuffer, "codeUnitBuffer"}}, {}, {}, {}, {}) {
     21        mStreamType = PointerType::get(parabix::StreamSetType(1, codeUnitWidth).getStreamSetBlockType(iBuilder), 0);
    2222        mScalarInputs = {ScalarBinding{mStreamType , "bufferPtr"}};
    2323    }
  • icGREP/icgrep-devel/icgrep/kernels/streamset.cpp

    r5100 r5106  
    2323// Single Block Buffer
    2424
    25 uint64_t SingleBlockBuffer::getBufferSize() {
     25size_t SingleBlockBuffer::getBufferSize() {
    2626    return 1; //iBuilder->getBitBlockWidth();
    2727}
     
    4040// External Unbounded Buffer
    4141
    42 uint64_t ExternalUnboundedBuffer::getBufferSize() {
     42size_t ExternalUnboundedBuffer::getBufferSize() {
    4343    return 0;
    4444}
     
    5555// Circular Stack Allocated Buffer
    5656
    57 uint64_t CircularBuffer::getBufferSize() {
     57size_t CircularBuffer::getBufferSize() {
    5858    return mBufferBlocks; // * iBuilder->getBitBlockWidth();
    5959}
    6060
    6161llvm::Value * CircularBuffer::allocateBuffer() {
    62     mStreamSetBufferPtr = iBuilder->CreateAlloca(getStreamSetBlockType(), iBuilder->getInt64(mBufferBlocks));
     62    mStreamSetBufferPtr = iBuilder->CreateAlloca(getStreamSetBlockType(), ConstantInt::get(iBuilder->getSizeTy(), mBufferBlocks));
    6363    return mStreamSetBufferPtr;
    6464}
    6565
    6666llvm::Value * CircularBuffer::getStreamSetBlockPointer(llvm::Value * bufferBasePtr, llvm::Value * blockNo) {
    67     return iBuilder->CreateGEP(getStreamSetBlockType(), bufferBasePtr, {iBuilder->CreateAnd(blockNo, iBuilder->getInt64(mBufferBlocks-1))});
     67    return iBuilder->CreateGEP(getStreamSetBlockType(), bufferBasePtr, {iBuilder->CreateAnd(blockNo, ConstantInt::get(iBuilder->getSizeTy(), mBufferBlocks-1))});
    6868}
    6969
  • icGREP/icgrep-devel/icgrep/kernels/streamset.h

    r5100 r5106  
    3636    llvm::Type * getStreamSetBlockType();
    3737
    38     virtual uint64_t getBufferSize() = 0;
     38    virtual size_t getBufferSize() = 0;
    3939   
    4040    virtual llvm::Value * allocateBuffer() = 0;
     
    5454    IDISA::IDISA_Builder * iBuilder;
    5555    StreamSetType mStreamSetType;
    56     uint64_t mBufferBlocks;
     56    size_t mBufferBlocks;
    5757    int mAddrSpace;
    5858    llvm::Value * mStreamSetBufferPtr;
     
    6868    StreamSetBuffer(BufferKind::BlockBuffer, b, ss_type) {}
    6969   
    70     uint64_t getBufferSize() override;
     70    size_t getBufferSize() override;
    7171    llvm::Value * allocateBuffer() override;
    7272    llvm::Value * getStreamSetBlockPointer(llvm::Value * bufferBasePtr, llvm::Value * blockNo) override;
     
    8484    void setStreamSetBuffer(llvm::Value * ptr) {mStreamSetBufferPtr = ptr;}
    8585   
    86     uint64_t getBufferSize() override;
     86    size_t getBufferSize() override;
    8787    // Can't allocate - raise an error. */
    8888    llvm::Value * allocateBuffer() override;
     
    9494    static inline bool classof(const StreamSetBuffer * b) {return b->getBufferKind() == BufferKind::CircularBuffer;}
    9595 
    96     CircularBuffer(IDISA::IDISA_Builder * b, StreamSetType ss_type, uint64_t bufferBlocks) :
     96    CircularBuffer(IDISA::IDISA_Builder * b, StreamSetType ss_type, size_t bufferBlocks) :
    9797        StreamSetBuffer(BufferKind::CircularBuffer, b, ss_type) {
    9898            mBufferBlocks = bufferBlocks;
     
    102102        }
    103103
    104     uint64_t getBufferSize() override;
     104    size_t getBufferSize() override;
    105105    llvm::Value * allocateBuffer() override;
    106106    llvm::Value * getStreamSetBlockPointer(llvm::Value * bufferBasePtr, llvm::Value * blockNo) override;
  • 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
  • icGREP/icgrep-devel/icgrep/pablo/carry_manager.cpp

    r5096 r5106  
    4444    mSelf = selfPtr;
    4545   
    46     Value * cdArrayPtr = iBuilder->CreateGEP(mSelf, {iBuilder->getInt64(0), mKernelBuilder->getScalarIndex("carries")});
     46    Value * cdArrayPtr = iBuilder->CreateGEP(mSelf, {ConstantInt::get(iBuilder->getSizeTy(), 0), mKernelBuilder->getScalarIndex("carries")});
    4747#ifndef NDEBUG
    48     iBuilder->CallPrintInt("cdArrayPtr", iBuilder->CreatePtrToInt(cdArrayPtr, iBuilder->getInt64Ty()));
     48    iBuilder->CallPrintInt("cdArrayPtr", iBuilder->CreatePtrToInt(cdArrayPtr, iBuilder->getSizeTy()));
    4949#endif
    5050    mCarryPackBasePtr = iBuilder->CreateBitCast(cdArrayPtr, PointerType::get(mCarryPackType, 0));
     
    179179 ** ------------------------------------------------------------------------------------------------------------- */
    180180Value * CarryManager::longAdvanceCarryInCarryOut(const unsigned index, const unsigned shiftAmount, Value * const value) {
    181     Value * advBaseIndex = iBuilder->getInt64(index);
     181    Value * advBaseIndex = ConstantInt::get(iBuilder->getSizeTy(), index);
    182182    if (shiftAmount <= mBitBlockWidth) {
    183183        // special case using a single buffer entry and the carry_out value.
     
    197197    const unsigned advanceEntries = mCarryInfo->longAdvanceEntries(shiftAmount);
    198198    const unsigned bufsize = mCarryInfo->longAdvanceBufferSize(shiftAmount);
    199     Value * indexMask = iBuilder->getInt64(bufsize - 1);  // A mask to implement circular buffer indexing
     199    Value * indexMask = ConstantInt::get(iBuilder->getSizeTy(), bufsize - 1);  // A mask to implement circular buffer indexing
    200200    Value * blockIndex = mKernelBuilder->getScalarField(mSelf, blockNoScalar);
    201     Value * loadIndex0 = iBuilder->CreateAdd(iBuilder->CreateAnd(iBuilder->CreateSub(blockIndex, iBuilder->getInt64(advanceEntries)), indexMask), advBaseIndex);
     201    Value * loadIndex0 = iBuilder->CreateAdd(iBuilder->CreateAnd(iBuilder->CreateSub(blockIndex, ConstantInt::get(iBuilder->getSizeTy(), advanceEntries)), indexMask), advBaseIndex);
    202202    Value * storeIndex = iBuilder->CreateAdd(iBuilder->CreateAnd(blockIndex, indexMask), advBaseIndex);
    203203    Value * carry_block0 = iBuilder->CreateBlockAlignedLoad(iBuilder->CreateGEP(mCarryBitBlockPtr, loadIndex0));
     
    209209    }
    210210    // Otherwise we need to combine data from the two oldest blocks.
    211     Value * loadIndex1 = iBuilder->CreateAdd(iBuilder->CreateAnd(iBuilder->CreateSub(blockIndex, iBuilder->getInt64(advanceEntries-1)), indexMask), advBaseIndex);
     211    Value * loadIndex1 = iBuilder->CreateAdd(iBuilder->CreateAnd(iBuilder->CreateSub(blockIndex, ConstantInt::get(iBuilder->getSizeTy(), advanceEntries-1)), indexMask), advBaseIndex);
    212212    Value * carry_block1 = iBuilder->CreateBlockAlignedLoad(iBuilder->CreateGEP(mCarryBitBlockPtr, loadIndex1));
    213213    Value* block0_shr = iBuilder->CreateLShr(iBuilder->CreateBitCast(carry_block0, iBuilder->getIntNTy(mBitBlockWidth)), mBitBlockWidth - block_shift);
     
    477477    assert (packIndex < mCarryInPack.size());
    478478    if (mCarryInPack[packIndex] == nullptr) {
    479         Value * const packPtr = iBuilder->CreateGEP(mCarryPackBasePtr, iBuilder->getInt64(packIndex));
     479        Value * const packPtr = iBuilder->CreateGEP(mCarryPackBasePtr, ConstantInt::get(iBuilder->getSizeTy(), packIndex));
    480480        assert (packIndex < mCarryPackPtr.size());
    481481        mCarryPackPtr[packIndex] = packPtr;
  • icGREP/icgrep-devel/icgrep/pablo/pablo_kernel.cpp

    r5102 r5106  
    5353std::vector<ScalarBinding> PabloKernel::accumBindings(std::vector<std::string> accum_names) {
    5454    std::vector<ScalarBinding> vec;
    55     Type * accum_t = iBuilder->getInt64Ty();
     55    Type * accum_t = iBuilder->getSizeTy();
    5656    for (auto a : accum_names) {
    5757        vec.push_back(ScalarBinding{accum_t, a});
Note: See TracChangeset for help on using the changeset viewer.