Ignore:
Timestamp:
Apr 8, 2016, 3:33:27 PM (3 years ago)
Author:
nmedfort
Message:

Potential fix for Mac compilers.

File:
1 edited

Legend:

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

    r5000 r5008  
    7373
    7474    inline llvm::Value * getInternalState(const std::string & name) {
    75         return getInternalState(mKernelStateParam, name);
     75        return getInternalStateInternal(mKernelStateParam, name);
    7676    }
    7777
    7878    inline void setInternalState(const std::string & name, llvm::Value * value) {
    79         setInternalState(mKernelStateParam, name, value);
     79        setInternalStateInternal(mKernelStateParam, name, value);
    8080    }
    8181
    8282    inline llvm::Value * getInternalState(const unsigned index) {
    8383        assert (index < mInternalState.size());
    84         return getInternalState(mKernelStateParam, iBuilder->getInt32(index));
     84        return getInternalStateInternal(mKernelStateParam, iBuilder->getInt32(index));
    8585    }
    8686
    8787    inline llvm::Value * getInternalState(disable_implicit_conversion<llvm::Value *> const index) {
    88         return getInternalState(mKernelStateParam, index);
     88        return getInternalStateInternal(mKernelStateParam, index);
    8989    }
    9090
    9191    void setInternalState(const unsigned index, llvm::Value * value) {
    9292        assert (index < mInternalState.size());
    93         setInternalState(mKernelStateParam, iBuilder->getInt32(index), value);
     93        setInternalStateInternal(mKernelStateParam, iBuilder->getInt32(index), value);
    9494    }
    9595
    9696    void setInternalState(disable_implicit_conversion<llvm::Value *> const index, llvm::Value * value) {
    97         setInternalState(mKernelStateParam, index, value);
    98     }
     97        setInternalStateInternal(mKernelStateParam, index, value);
     98    }
     99
    99100    inline llvm::Type * getKernelStateType() const{
    100101        return mKernelStateType;
     
    102103
    103104    inline llvm::Value * getInputStream(const unsigned index, const unsigned streamOffset = 0) {
    104         assert (index < getNumOfInputStreams());
    105         return getInputStream(iBuilder->getInt32(index), streamOffset);
     105        return getInputStreamInternal(getInputStreamParam(streamOffset), iBuilder->getInt32(index));
    106106    }
    107107
    108108    inline llvm::Value * getInputStream(disable_implicit_conversion<llvm::Value *> index, const unsigned streamOffset = 0) {
    109         const auto f = mInputStreamParam.find(streamOffset);
    110         if (LLVM_UNLIKELY(f == mInputStreamParam.end())) {
    111             throw std::runtime_error("Kernel compilation error: No input stream parameter for stream offset " + std::to_string(streamOffset));
    112         }
    113         return getInputStream(f->second, index);
     109        return getInputStreamInternal(getInputStreamParam(streamOffset), index);
    114110    }
    115111
     
    124120    inline llvm::Value * getInputScalar(const unsigned index) {
    125121        assert (index < getNumOfInputScalars());
    126         return getInputScalar(iBuilder->getInt32(index));
     122        return getInputScalarInternal(mInputScalarParam, iBuilder->getInt32(index));
    127123    }
    128124
    129125    inline llvm::Value * getInputScalar(disable_implicit_conversion<llvm::Value *> const index) {
    130         return getInputScalar(mInputScalarParam, index);
     126        return getInputScalarInternal(mInputScalarParam, index);
    131127    }
    132128
     
    141137    inline llvm::Value * getOutputStream(const unsigned index) {
    142138        assert (index < getNumOfOutputStreams());
    143         return getOutputStream(mOutputStreamParam, iBuilder->getInt32(index));
     139        return getOutputStreamInternal(mOutputStreamParam, iBuilder->getInt32(index));
    144140    }
    145141
    146142    inline llvm::Value * getOutputStream(disable_implicit_conversion<llvm::Value *> const index) {
    147         return getOutputStream(mOutputStreamParam, index);
     143        return getOutputStreamInternal(mOutputStreamParam, index);
    148144    }
    149145
     
    158154    inline llvm::Value * getOutputScalar(const unsigned index) {
    159155        assert (index < getNumOfOutputScalars());
    160         return getOutputScalar(mOutputScalarParam, iBuilder->getInt32(index));
     156        return getOutputScalarInternal(mOutputScalarParam, iBuilder->getInt32(index));
    161157    }
    162158
    163159    inline llvm::Value * getOutputScalar(disable_implicit_conversion<llvm::Value *> const index) {
    164         return getOutputScalar(mOutputScalarParam, index);
     160        return getOutputScalarInternal(mOutputScalarParam, index);
    165161    }
    166162
     
    174170
    175171    inline llvm::Value * getBlockNo() {
    176         return getBlockNo(mKernelStateParam);
     172        return getBlockNoInternal(mKernelStateParam);
    177173    }
    178174
     
    201197    Type * packDataTypes(const std::vector<llvm::Type *> & types);
    202198
    203     llvm::Value * getInputStream(llvm::Value * const inputStreamSet, disable_implicit_conversion<llvm::Value *> index);
    204 
    205     llvm::Value * getInputScalar(llvm::Value * const inputScalarSet, disable_implicit_conversion<llvm::Value *> index);
    206 
    207     llvm::Value * getInternalState(llvm::Value * const kernelState, const std::string & name);
    208 
    209     void setInternalState(llvm::Value * const kernelState, const std::string & name, llvm::Value * const value);
    210 
    211     llvm::Value * getInternalState(llvm::Value * const kernelState, disable_implicit_conversion<llvm::Value *> index);
    212 
    213     void setInternalState(llvm::Value * const kernelState, const unsigned index, llvm::Value * const value);
    214 
    215     void setInternalState(llvm::Value * const kernelState, disable_implicit_conversion<llvm::Value *> index, llvm::Value * const value);
    216 
    217     llvm::Value * getOutputStream(llvm::Value * const outputStreamSet, disable_implicit_conversion<llvm::Value *> index);
    218 
    219     llvm::Value * getOutputScalar(llvm::Value * const outputScalarSet, disable_implicit_conversion<llvm::Value *> index);
    220 
    221     llvm::Value * getBlockNo(llvm::Value * const instance);
     199    llvm::Value * getInputStreamInternal(llvm::Value * const inputStreamSet, disable_implicit_conversion<llvm::Value *> index);
     200
     201    llvm::Value * getInputScalarInternal(llvm::Value * const inputScalarSet, disable_implicit_conversion<llvm::Value *> index);
     202
     203    llvm::Value * getInternalStateInternal(llvm::Value * const kernelState, const std::string & name);
     204
     205    void setInternalStateInternal(llvm::Value * const kernelState, const std::string & name, llvm::Value * const value);
     206
     207    llvm::Value * getInternalStateInternal(llvm::Value * const kernelState, disable_implicit_conversion<llvm::Value *> index);
     208
     209    void setInternalStateInternal(llvm::Value * const kernelState, const unsigned index, llvm::Value * const value);
     210
     211    void setInternalStateInternal(llvm::Value * const kernelState, disable_implicit_conversion<llvm::Value *> index, llvm::Value * const value);
     212
     213    llvm::Value * getOutputStreamInternal(llvm::Value * const outputStreamSet, disable_implicit_conversion<llvm::Value *> index);
     214
     215    llvm::Value * getOutputScalarInternal(llvm::Value * const outputScalarSet, disable_implicit_conversion<llvm::Value *> index);
     216
     217    llvm::Value * getBlockNoInternal(llvm::Value * const instance) {
     218        return getInternalStateInternal(instance, mBlockNoIndex);
     219    }
    222220
    223221    llvm::Function * getOutputStreamSetFunction() const;
     222
     223    llvm::Value * getInputStreamParam(const unsigned streamOffset) const;
    224224
    225225    const std::vector<unsigned> & getInputStreamOffsets() const {
     
    269269}
    270270
    271 inline llvm::Value * KernelBuilder::getBlockNo(llvm::Value * const instance) {
    272     return getInternalState(instance, mBlockNoIndex);
    273 }
    274 
    275271inline unsigned KernelBuilder::getDefaultBufferSize() const {
    276272    return mDefaultBufferSize;
Note: See TracChangeset for help on using the changeset viewer.