Ignore:
Timestamp:
Aug 10, 2016, 3:16:16 PM (3 years ago)
Author:
cameron
Message:

Including addrSpace as part of basePtr type

File:
1 edited

Legend:

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

    r5122 r5123  
    1818}
    1919
    20 llvm::Type * StreamSetBuffer::getStreamSetBlockType() {
    21     return mStreamSetType.getStreamSetBlockType(iBuilder);
     20llvm::PointerType * StreamSetBuffer::getStreamBufferPointerType() {
     21    return PointerType::get(mStreamSetType.getStreamSetBlockType(iBuilder), 0);
    2222}
    2323
     
    2929
    3030llvm::Value * SingleBlockBuffer::allocateBuffer() {
    31     mStreamSetBufferPtr = iBuilder->CreateAlloca(getStreamSetBlockType());
     31    mStreamSetBufferPtr = iBuilder->CreateAlloca(mStreamSetType.getStreamSetBlockType(iBuilder));
    3232    return mStreamSetBufferPtr;
    3333}
     
    4646
    4747void ExternalUnboundedBuffer::setStreamSetBuffer(llvm::Value * ptr) {
    48     PointerType * t = PointerType::get(getStreamSetBlockType(), mAddrSpace);
     48    PointerType * t = PointerType::get(mStreamSetType.getStreamSetBlockType(iBuilder), mAddrSpace);
    4949   
    5050    mStreamSetBufferPtr = iBuilder->CreatePointerBitCastOrAddrSpaceCast(ptr, t);
    5151    std::cerr << "mStreamSetBufferPtr\n";
     52}
     53
     54llvm::PointerType * ExternalUnboundedBuffer::getStreamBufferPointerType() {
     55    return PointerType::get(mStreamSetType.getStreamSetBlockType(iBuilder), mAddrSpace);
    5256}
    5357
     
    5761
    5862llvm::Value * ExternalUnboundedBuffer::getStreamSetBlockPointer(llvm::Value * bufferBasePtr, llvm::Value * blockNo) {
    59     PointerType * t = PointerType::get(getStreamSetBlockType(), mAddrSpace);
     63    PointerType * t = getStreamBufferPointerType();
    6064    return iBuilder->CreateGEP(iBuilder->CreatePointerBitCastOrAddrSpaceCast(bufferBasePtr, t), {blockNo});
    6165}
     
    6973
    7074llvm::Value * CircularBuffer::allocateBuffer() {
    71     mStreamSetBufferPtr = iBuilder->CreateAlloca(getStreamSetBlockType(), ConstantInt::get(iBuilder->getSizeTy(), mBufferBlocks));
     75    mStreamSetBufferPtr = iBuilder->CreateAlloca(mStreamSetType.getStreamSetBlockType(iBuilder), ConstantInt::get(iBuilder->getSizeTy(), mBufferBlocks));
    7276    return mStreamSetBufferPtr;
    7377}
    7478
    7579llvm::Value * CircularBuffer::getStreamSetBlockPointer(llvm::Value * bufferBasePtr, llvm::Value * blockNo) {
    76     return iBuilder->CreateGEP(getStreamSetBlockType(), bufferBasePtr, {iBuilder->CreateAnd(blockNo, ConstantInt::get(iBuilder->getSizeTy(), mBufferBlocks-1))});
     80    return iBuilder->CreateGEP(mStreamSetType.getStreamSetBlockType(iBuilder), bufferBasePtr, {iBuilder->CreateAnd(blockNo, ConstantInt::get(iBuilder->getSizeTy(), mBufferBlocks-1))});
    7781}
    7882
Note: See TracChangeset for help on using the changeset viewer.