Changeset 5008


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

Potential fix for Mac compilers.

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

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/icgrep-devel.files

    r5001 r5008  
    917917kernels/instance.cpp
    918918casefold.cpp
     919cc/cc_compiler.cpp
     920cc/cc_compiler.h
     921IDISA/idisa_avx_builder.cpp
     922IDISA/idisa_avx_builder.h
     923IDISA/idisa_builder.cpp
     924IDISA/idisa_builder.h
     925IDISA/idisa_i64_builder.cpp
     926IDISA/idisa_i64_builder.h
     927IDISA/idisa_sse_builder.cpp
     928IDISA/idisa_sse_builder.h
     929IDISA/idisa_target.cpp
     930IDISA/idisa_target.h
     931kernels/casefold_pipeline.cpp
     932kernels/casefold_pipeline.h
     933kernels/deletion.cpp
     934kernels/deletion.h
     935kernels/instance.cpp
     936kernels/instance.h
     937kernels/kernel.cpp
     938kernels/kernel.h
     939kernels/p2s_kernel.cpp
     940kernels/p2s_kernel.h
     941kernels/pipeline.cpp
     942kernels/pipeline.h
     943kernels/s2p_kernel.cpp
     944kernels/s2p_kernel.h
     945kernels/scanmatchgen.cpp
     946kernels/scanmatchgen.h
     947kernels/stdout_kernel.cpp
     948kernels/stdout_kernel.h
     949kernels/streamset.h
     950kernels/symboltablepipeline.cpp
     951kernels/symboltablepipeline.h
     952kernels/u8u16_pipeline.cpp
     953kernels/u8u16_pipeline.h
     954pablo/analysis/pabloverifier.cpp
     955pablo/analysis/pabloverifier.hpp
     956pablo/optimizers/booleanreassociationpass.cpp
     957pablo/optimizers/booleanreassociationpass.h
     958pablo/optimizers/codemotionpass.cpp
     959pablo/optimizers/codemotionpass.h
     960pablo/optimizers/distributivepass.cpp
     961pablo/optimizers/distributivepass.h
     962pablo/optimizers/graph-facade.hpp
     963pablo/optimizers/pablo_automultiplexing.cpp
     964pablo/optimizers/pablo_automultiplexing.hpp
     965pablo/optimizers/pablo_bddminimization.cpp
     966pablo/optimizers/pablo_bddminimization.h
     967pablo/optimizers/pablo_simplifier.cpp
     968pablo/optimizers/pablo_simplifier.hpp
     969pablo/optimizers/schedulingprepass.cpp
     970pablo/optimizers/schedulingprepass.h
     971pablo/passes/factorizedfg.cpp
     972pablo/passes/factorizedfg.h
     973pablo/passes/flattenassociativedfg.cpp
     974pablo/passes/flattenassociativedfg.h
     975pablo/builder.cpp
     976pablo/builder.hpp
     977pablo/carry_data.cpp
     978pablo/carry_data.h
     979pablo/carry_manager.cpp
     980pablo/carry_manager.h
     981pablo/codegenstate.cpp
     982pablo/codegenstate.h
     983pablo/expression_map.hpp
     984pablo/function.cpp
     985pablo/function.h
     986pablo/pablo_compiler.cpp
     987pablo/pablo_compiler.h
     988pablo/pablo_toolchain.cpp
     989pablo/pablo_toolchain.h
     990pablo/pabloAST.cpp
     991pablo/pabloAST.h
     992pablo/pe_advance.h
     993pablo/pe_and.h
     994pablo/pe_call.h
     995pablo/pe_count.h
     996pablo/pe_integer.h
     997pablo/pe_lookahead.h
     998pablo/pe_matchstar.h
     999pablo/pe_next.h
     1000pablo/pe_not.h
     1001pablo/pe_ones.h
     1002pablo/pe_or.h
     1003pablo/pe_scanthru.h
     1004pablo/pe_sel.h
     1005pablo/pe_setithbit.h
     1006pablo/pe_string.h
     1007pablo/pe_var.h
     1008pablo/pe_xor.h
     1009pablo/pe_zeroes.h
     1010pablo/printer_pablos.cpp
     1011pablo/printer_pablos.h
     1012pablo/ps_assign.h
     1013pablo/ps_if.cpp
     1014pablo/ps_if.h
     1015pablo/ps_while.cpp
     1016pablo/ps_while.h
     1017pablo/symbol_generator.cpp
     1018pablo/symbol_generator.h
     1019re/parsefailure.cpp
     1020re/parsefailure.h
     1021re/printer_re.cpp
     1022re/printer_re.h
     1023re/re_alt.h
     1024re/re_analysis.cpp
     1025re/re_analysis.h
     1026re/re_any.h
     1027re/re_assertion.h
     1028re/re_cc.cpp
     1029re/re_cc.h
     1030re/re_compiler.cpp
     1031re/re_compiler.h
     1032re/re_diff.cpp
     1033re/re_diff.h
     1034re/re_end.h
     1035re/re_grapheme_boundary.hpp
     1036re/re_intersect.cpp
     1037re/re_intersect.h
     1038re/re_memoizer.hpp
     1039re/re_name.h
     1040re/re_nullable.cpp
     1041re/re_nullable.h
     1042re/re_parser.cpp
     1043re/re_parser.h
     1044re/re_re.cpp
     1045re/re_re.h
     1046re/re_rep.cpp
     1047re/re_rep.h
     1048re/re_seq.h
     1049re/re_simplifier.cpp
     1050re/re_simplifier.h
     1051re/re_start.h
     1052re/re_toolchain.cpp
     1053re/re_toolchain.h
     1054UCD/Blocks.h
     1055UCD/CaseFolding_txt.cpp
     1056UCD/CaseFolding_txt.h
     1057UCD/DerivedAge.h
     1058UCD/DerivedBidiClass.h
     1059UCD/DerivedBinaryProperties.h
     1060UCD/DerivedCombiningClass.h
     1061UCD/DerivedCoreProperties.h
     1062UCD/DerivedDecompositionType.h
     1063UCD/DerivedGeneralCategory.h
     1064UCD/DerivedJoiningGroup.h
     1065UCD/DerivedJoiningType.h
     1066UCD/DerivedNumericType.h
     1067UCD/EastAsianWidth.h
     1068UCD/GraphemeBreakProperty.h
     1069UCD/HangulSyllableType.h
     1070UCD/LineBreak.h
     1071UCD/PropertyAliases.h
     1072UCD/PropertyObjects.cpp
     1073UCD/PropertyObjects.h
     1074UCD/PropertyObjectTable.h
     1075UCD/PropertyValueAliases.h
     1076UCD/PropList.h
     1077UCD/resolve_properties.cpp
     1078UCD/resolve_properties.h
     1079UCD/ScriptExtensions.h
     1080UCD/Scripts.h
     1081UCD/SentenceBreakProperty.h
     1082UCD/ucd_compiler.cpp
     1083UCD/ucd_compiler.hpp
     1084UCD/unicode_set.cpp
     1085UCD/unicode_set.h
     1086UCD/UnicodeNameData.cpp
     1087UCD/UnicodeNameData.h
     1088UCD/WordBreakProperty.h
     1089util/ispc.cpp
     1090util/papi_helper.hpp
     1091util/slab_allocator.h
     1092casefold.cpp
     1093grep_engine.cpp
     1094grep_engine.h
     1095hrtime.h
     1096icgrep.cpp
     1097object_cache.cpp
     1098object_cache.h
     1099symboltable.cpp
     1100toolchain.cpp
     1101toolchain.h
     1102u8u16.cpp
     1103utf8_encoder.cpp
     1104utf8_encoder.h
     1105utf_encoding.h
  • icGREP/icgrep-devel/icgrep/kernels/instance.h

    r5000 r5008  
    1818
    1919    llvm::Value * getInternalState(const std::string & name) {
    20         return mDefinition->getInternalState(mKernelState, name);
     20        return mDefinition->getInternalStateInternal(mKernelState, name);
    2121    }
    2222
    2323    void setInternalState(const std::string & name, llvm::Value * value) {
    24         mDefinition->setInternalState(mKernelState, name, value);
     24        mDefinition->setInternalStateInternal(mKernelState, name, value);
    2525    }
    2626
    2727    llvm::Value * getInternalState(const unsigned index) {
    28         return getInternalState(iBuilder->getInt32(index));
     28        return mDefinition->getInternalStateInternal(mKernelState, iBuilder->getInt32(index));
    2929    }
    3030
    3131    llvm::Value * getInternalState(llvm::Value * const index) {
    32         return mDefinition->getInternalState(mKernelState, index);
     32        return mDefinition->getInternalStateInternal(mKernelState, index);
    3333    }
    3434
    3535    void setInternalState(const unsigned index, llvm::Value * value) {
    36         setInternalState(iBuilder->getInt32(index), value);
     36        mDefinition->setInternalStateInternal(mKernelState, iBuilder->getInt32(index), value);
    3737    }
    3838
    3939    void setInternalState(llvm::Value * const index, llvm::Value * value) {
    40         mDefinition->setInternalState(mKernelState, index, value);
     40        mDefinition->setInternalStateInternal(mKernelState, index, value);
    4141    }
    4242
     
    4646
    4747    llvm::Value * getInputStream(const unsigned index, const unsigned streamOffset = 0) {
    48         return getInputStream(iBuilder->getInt32(index), streamOffset);
     48        return mDefinition->getInputStreamInternal(getInputStreamSet(streamOffset), iBuilder->getInt32(index));
    4949    }
    5050
    5151    llvm::Value * getInputStream(llvm::Value * const index, const unsigned streamOffset = 0) {
    52         return mDefinition->getInputStream(getInputStreamSet(streamOffset), index);
     52        return mDefinition->getInputStreamInternal(getInputStreamSet(streamOffset), index);
    5353    }
    5454
     
    5858
    5959    llvm::Value * getInputScalar(const unsigned index) {
    60         return getInputScalar(iBuilder->getInt32(index));
     60        return mDefinition->getInputScalarInternal(mInputScalarSet, iBuilder->getInt32(index));
    6161    }
    6262
    6363    llvm::Value * getInputScalar(llvm::Value * const index) {
    64         return mDefinition->getInputScalar(mInputScalarSet, index);
     64        return mDefinition->getInputScalarInternal(mInputScalarSet, index);
    6565    }
    6666
     
    7474
    7575    llvm::Value * getOutputStream(const unsigned index, const unsigned streamOffset = 0) {
    76         return getOutputStream(iBuilder->getInt32(index), streamOffset);
     76        return mDefinition->getOutputStreamInternal(getOutputStreamSet(streamOffset), iBuilder->getInt32(index));
    7777    }
    7878
    7979    llvm::Value * getOutputStream(llvm::Value * const index, const unsigned streamOffset = 0) {
    80         return mDefinition->getOutputStream(getOutputStreamSet(streamOffset), index);
     80        return mDefinition->getOutputStreamInternal(getOutputStreamSet(streamOffset), index);
    8181    }
    8282
     
    8484
    8585    llvm::Value * getOutputScalar(const unsigned index) {
    86         return getOutputScalar(iBuilder->getInt32(index));
     86        return mDefinition->getOutputScalarInternal(mOutputScalarSet, iBuilder->getInt32(index));
    8787    }
    8888
    8989    llvm::Value * getOutputScalar(llvm::Value * const index) {
    90         return mDefinition->getOutputScalar(mOutputScalarSet, index);
     90        return mDefinition->getOutputScalarInternal(mOutputScalarSet, index);
    9191    }
    9292
    9393    llvm::Value * getBlockNo() {
    94         return mDefinition->getBlockNo(mKernelState);
     94        return mDefinition->getBlockNoInternal(mKernelState);
    9595    }
    9696
  • 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
  • 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;
  • icGREP/icgrep-devel/icgrep/kernels/scanmatchgen.cpp

    r4991 r5008  
    153153    Value * matchRecordEnd = iBuilder->CreateAdd(scanwordPos, generateCountForwardZeroes(iBuilder, matches_phi));
    154154
    155     Value * fileBuf = iBuilder->CreateLoad(kBuilder->getInternalState(instance, "FileBuf"));
     155    Value * fileBuf = iBuilder->CreateLoad(kBuilder->getInternalStateInternal(instance, "FileBuf"));
    156156    if (isNameExpression) {
    157157        iBuilder->CreateCall(matchProcessor, std::vector<Value *>({matchRecordNum_phi, matchRecordStart_phi, matchRecordEnd, fileBuf}));
    158158    } else {
    159         Value * fileSize = iBuilder->CreateLoad(kBuilder->getInternalState(instance, "FileSize"));
    160         Value * fileName = iBuilder->CreateLoad(kBuilder->getInternalState(instance, "FileName"));
     159        Value * fileSize = iBuilder->CreateLoad(kBuilder->getInternalStateInternal(instance, "FileSize"));
     160        Value * fileName = iBuilder->CreateLoad(kBuilder->getInternalStateInternal(instance, "FileName"));
    161161        iBuilder->CreateCall(matchProcessor, std::vector<Value *>({matchRecordNum_phi, matchRecordStart_phi, matchRecordEnd, fileBuf, fileSize, fileName}));
    162162    }
  • icGREP/icgrep-devel/icgrep/kernels/symboltablepipeline.cpp

    r5003 r5008  
    264264    endStream = iBuilder->CreateBitCast(endStream, scanWordVectorType, "endStream");
    265265
    266     Value * startIndexPtr = iBuilder->CreateGEP(positionArray, {iBuilder->getInt32(0), groupIV, iBuilder->getInt32(0)}, "startIndexPtr");
     266    Value * startIndexPtr = iBuilder->CreateGEP(positionArray, {iBuilder->getInt32(0), groupIV, iBuilder->getInt32(0)});
    267267    Value * startIndex = iBuilder->CreateLoad(startIndexPtr, "startIndex");
    268     Value * startArray = iBuilder->CreateGEP(positionArray, {iBuilder->getInt32(0), groupIV, iBuilder->getInt32(1)}, "startArray");
     268    Value * startPosArray = iBuilder->CreateGEP(positionArray, {iBuilder->getInt32(0), groupIV, iBuilder->getInt32(1)}, "startPosArray");
    269269    Value * endIndexPtr = iBuilder->CreateGEP(positionArray, {iBuilder->getInt32(0), groupIV, iBuilder->getInt32(2)}, "endIndexPtr");
    270270    Value * endIndex = iBuilder->CreateLoad(endIndexPtr, "endIndex");
    271     Value * endArray = iBuilder->CreateGEP(positionArray, {iBuilder->getInt32(0), groupIV, iBuilder->getInt32(3)}, "endArray");
     271    Value * endPosArray = iBuilder->CreateGEP(positionArray, {iBuilder->getInt32(0), groupIV, iBuilder->getInt32(3)}, "endPosArray");
    272272
    273273    iBuilder->CreateBr(startOuterCond);
     
    306306    startFieldPhi->addIncoming(generateResetLowestBit(iBuilder, startFieldPhi), startInnerBody);
    307307    startPos = iBuilder->CreateTruncOrBitCast(iBuilder->CreateOr(startPos, startBlockOffset), iBuilder->getInt32Ty());
    308     iBuilder->CreateStore(startPos, iBuilder->CreateGEP(startArray, {iBuilder->getInt32(0), startIndexPhi2}));
     308    iBuilder->CreateStore(startPos, iBuilder->CreateGEP(startPosArray, {iBuilder->getInt32(0), startIndexPhi2}));
    309309    startIndexPhi2->addIncoming(iBuilder->CreateAdd(startIndexPhi2, ConstantInt::get(startIndexPhi2->getType(), 1)), startInnerBody);
    310310    iBuilder->CreateBr(startInnerCond);
     
    352352    endFieldPhi->addIncoming(updatedEndFieldPhi, gather);
    353353    endPos = iBuilder->CreateTruncOrBitCast(iBuilder->CreateOr(endPos, endBlockOffset), iBuilder->getInt32Ty());
    354     iBuilder->CreateStore(endPos, iBuilder->CreateGEP(endArray, {iBuilder->getInt32(0), endIndexPhi2}));
     354    iBuilder->CreateStore(endPos, iBuilder->CreateGEP(endPosArray, {iBuilder->getInt32(0), endIndexPhi2}));
    355355    Value * updatedEndIndexPhi = iBuilder->CreateAdd(endIndexPhi2, ConstantInt::get(endIndexPhi2->getType(), 1));
    356356    endIndexPhi2->addIncoming(updatedEndIndexPhi, endInnerBody);
     
    361361    iBuilder->SetInsertPoint(gather);
    362362
    363     Value * startArrayPtr = iBuilder->CreatePointerCast(startArray, PointerType::get(iBuilder->getInt32Ty(), 0));
    364     Value * endArrayPtr = iBuilder->CreatePointerCast(endArray, PointerType::get(iBuilder->getInt32Ty(), 0));
     363    Value * startArrayPtr = iBuilder->CreatePointerCast(startPosArray, PointerType::get(iBuilder->getInt32Ty(), 0));
     364    Value * endArrayPtr = iBuilder->CreatePointerCast(endPosArray, PointerType::get(iBuilder->getInt32Ty(), 0));
    365365    Value * gatherFunctionPtr = iBuilder->CreateLoad(iBuilder->CreateGEP(gatherFunctionPtrArray, groupIV));
    366366    Value * outputBuffer = iBuilder->CreatePointerCast(kBuilder->getOutputStream(groupIV), iBuilder->getInt8PtrTy());
    367367    iBuilder->CreateCall5(gatherFunctionPtr, base, startArrayPtr, endArrayPtr, iBuilder->getInt32(32), outputBuffer);
    368 
     368    // Copy the unused start positions to the front of the start position array and adjust the start index
    369369    Value * remainingArrayPtr = iBuilder->CreateGEP(startArrayPtr, iBuilder->getInt32(gatherCount));
    370370    Value * remainingCount = iBuilder->CreateSub(startIndexPhi4, iBuilder->getInt32(gatherCount));
     
    511511            Value * remaining = iBuilder->CreateSub(endPos, startPos);
    512512
    513             // if this token only has 1 to 3 bytes remaining ...
     513            // if this token has at least 4 bytes remaining ...
    514514            Value * atLeastFourBytes = iBuilder->CreateSExt(iBuilder->CreateICmpUGE(remaining, four), remaining->getType(), "atLeastFourBytes");
    515515
Note: See TracChangeset for help on using the changeset viewer.