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

Potential fix for Mac compilers.

File:
1 edited

Legend:

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

    r5001 r5008  
    4949 * @brief getInternalState
    5050 ** ------------------------------------------------------------------------------------------------------------- */
    51 Value * KernelBuilder::getInternalState(Value * const kernelState, disable_implicit_conversion<Value *> index) {
    52     assert (index->getType()->isIntegerTy());   
    53     assert (kernelState->getType()->getPointerElementType() == mKernelStateType);
    54     return iBuilder->CreateGEP(kernelState, {iBuilder->getInt32(0), index});
    55 }
    56 
    57 Value * KernelBuilder::getInternalState(Value * const kernelState, const std::string & name) {
     51Value * KernelBuilder::getInternalStateInternal(Value * const kernelState, const std::string & name) {
    5852    const auto f = mInternalStateNameMap.find(name);
    5953    if (LLVM_UNLIKELY(f == mInternalStateNameMap.end())) {
    6054        throw std::runtime_error("Kernel does not contain internal state " + name);
    6155    }
    62     return getInternalState(kernelState, f->second);
     56    return getInternalStateInternal(kernelState, f->second);
     57}
     58
     59Value * KernelBuilder::getInternalStateInternal(Value * const kernelState, disable_implicit_conversion<Value *> index) {
     60    assert (index->getType()->isIntegerTy());
     61    assert (kernelState->getType()->getPointerElementType() == mKernelStateType);
     62    return iBuilder->CreateGEP(kernelState, {iBuilder->getInt32(0), index});
    6363}
    6464
     
    6666 * @brief setInternalState
    6767 ** ------------------------------------------------------------------------------------------------------------- */
    68 void KernelBuilder::setInternalState(Value * const kernelState, const std::string & name, Value * const value) {
    69     Value * ptr = getInternalState(kernelState, name);
     68void KernelBuilder::setInternalStateInternal(Value * const kernelState, const std::string & name, Value * const value) {
     69    Value * ptr = getInternalStateInternal(kernelState, name);
    7070    assert (ptr->getType()->getPointerElementType() == value->getType());
    7171    if (value->getType() == iBuilder->getBitBlockType()) {
     
    7676}
    7777
    78 void KernelBuilder::setInternalState(Value * const kernelState, disable_implicit_conversion<Value *> index, Value * const value) {
    79     Value * ptr = getInternalState(kernelState, index);
     78void KernelBuilder::setInternalStateInternal(Value * const kernelState, disable_implicit_conversion<Value *> index, Value * const value) {
     79    Value * ptr = getInternalStateInternal(kernelState, index);
    8080    assert (ptr->getType()->getPointerElementType() == value->getType());
    8181    if (value->getType() == iBuilder->getBitBlockType()) {
     
    106106 * @brief getInputStream
    107107 ** ------------------------------------------------------------------------------------------------------------- */
    108 Value * KernelBuilder::getInputStream(Value * const inputStreamSet, disable_implicit_conversion<Value *> index) {
     108Value * KernelBuilder::getInputStreamInternal(Value * const inputStreamSet, disable_implicit_conversion<Value *> index) {
    109109    assert ("Parameters cannot be null!" && (inputStreamSet != nullptr && index != nullptr));
    110110    assert ("Stream index must be an integer!" && index->getType()->isIntegerTy());
     
    132132 * @brief getInputScalar
    133133 ** ------------------------------------------------------------------------------------------------------------- */
    134 Value * KernelBuilder::getInputScalar(Value * const inputScalarSet, disable_implicit_conversion<Value *>) {
     134Value * KernelBuilder::getInputScalarInternal(Value * const inputScalarSet, disable_implicit_conversion<Value *>) {
    135135    assert (inputScalarSet);
    136136    throw std::runtime_error("currently not supported!");
     
    160160 * @brief getOutputStream
    161161 ** ------------------------------------------------------------------------------------------------------------- */
    162 Value * KernelBuilder::getOutputStream(Value * const outputStreamSet, disable_implicit_conversion<Value *> index) {
     162Value * KernelBuilder::getOutputStreamInternal(Value * const outputStreamSet, disable_implicit_conversion<Value *> index) {
    163163    assert ("Parameters cannot be null!" && (outputStreamSet != nullptr && index != nullptr));
    164164    assert ("Stream index must be an integer!" && index->getType()->isIntegerTy());
     
    173173 * @brief getOutputScalar
    174174 ** ------------------------------------------------------------------------------------------------------------- */
    175 Value * KernelBuilder::getOutputScalar(Value * const outputScalarSet, disable_implicit_conversion<Value *> ) {
     175Value * KernelBuilder::getOutputScalarInternal(Value * const, disable_implicit_conversion<Value *> ) {
    176176    throw std::runtime_error("currently not supported!");
    177177}
     
    313313}
    314314
     315Value * KernelBuilder::getInputStreamParam(const unsigned streamOffset) const {
     316    const auto f = mInputStreamParam.find(streamOffset);
     317    if (LLVM_UNLIKELY(f == mInputStreamParam.end())) {
     318        throw std::runtime_error("Kernel compilation error: No input stream parameter for stream offset " + std::to_string(streamOffset));
     319    }
     320    return f->second;
     321}
     322
    315323} // end of namespace kernel
Note: See TracChangeset for help on using the changeset viewer.