Ignore:
Timestamp:
Apr 6, 2016, 1:03:48 PM (4 years ago)
Author:
nmedfort
Message:

Symbol table work

File:
1 edited

Legend:

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

    r5000 r5001  
    2525, mBlockNoIndex(0) {
    2626    assert (mDefaultBufferSize > 0);
    27     mBlockNoIndex = iBuilder->getInt32(addInternalState(builder->getInt64Ty(), "BlockNo"));
    2827}
    2928
     
    114113        return iBuilder->CreateGEP(inputStreamSet, { iBuilder->getInt32(0), index });
    115114    }
    116     #ifndef NDEBUG
    117     iBuilder->getModule()->dump();
    118     #endif
    119115    throw std::runtime_error("Cannot access the input stream with a non-constant value unless all input stream types are identical!");
    120116}
     
    200196 ** ------------------------------------------------------------------------------------------------------------- */
    201197Function * KernelBuilder::prepareFunction(std::vector<unsigned> && inputStreamOffsets) {
     198
     199    mBlockNoIndex = iBuilder->getInt32(addInternalState(iBuilder->getInt64Ty(), "BlockNo"));
    202200
    203201    mKernelStateType = StructType::create(iBuilder->getContext(), mInternalState, mKernelName);
     
    306304 ** ------------------------------------------------------------------------------------------------------------- */
    307305Instance * KernelBuilder::instantiate(std::initializer_list<llvm::Value *> inputStreams) {   
    308     throw std::runtime_error("Not supported!");
    309 //    AllocaInst * inputStruct = iBuilder->CreateAlloca(mInputStreamType);
    310 //    unsigned i = 0;
    311 //    for (Value * inputStream : inputStreams) {
    312 //        Value * ptr = iBuilder->CreateGEP(inputStruct, { iBuilder->getInt32(0), iBuilder->getInt32(i++)});
    313 //        iBuilder->CreateStore(iBuilder->CreatePointerCast(inputStream, ptr);
    314 //    }
    315 //    return instantiate(std::make_pair(inputStruct, 0));
     306    AllocaInst * inputStruct = iBuilder->CreateAlloca(mInputStreamType);
     307    unsigned i = 0;
     308    for (Value * inputStream : inputStreams) {
     309        Value * ptr = iBuilder->CreateGEP(inputStruct, { iBuilder->getInt32(0), iBuilder->getInt32(i++)});
     310        iBuilder->CreateStore(inputStream, ptr);
     311    }
     312    return instantiate(std::make_pair(inputStruct, 0));
    316313}
    317314
Note: See TracChangeset for help on using the changeset viewer.