Ignore:
Timestamp:
Apr 18, 2017, 12:51:26 PM (3 years ago)
Author:
nmedfort
Message:

Potential bug fix for 32-bit. Modified MRemap to check for Linux OS support. Added MMapAdvise to CBuilder.

File:
1 edited

Legend:

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

    r5398 r5411  
    4545    BasicBlock * const scanWordExit = CreateBasicBlock("ScanWordExit");
    4646    IntegerType * const sizeTy = iBuilder->getSizeTy();
    47     PointerType * const codeUnitTy = iBuilder->getIntNTy(mCodeUnitWidth)->getPointerTo();
    4847    const unsigned fieldCount = iBuilder->getBitBlockWidth() / sizeTy->getBitWidth();
    4948    VectorType * const scanwordVectorType =  VectorType::get(sizeTy, fieldCount);
     
    5251    Value * const lastRecordStart = getProcessedItemCount("InputStream");
    5352    Value * const lastRecordNum = getScalarField("LineNum");
    54     Value * const inputStream = iBuilder->CreatePointerCast(getRawInputPointer("InputStream", iBuilder->getInt32(0), iBuilder->getInt32(0)), codeUnitTy);
    5553
    5654    Value * const matches = iBuilder->CreateBitCast(loadInputStreamBlock("matchResult", iBuilder->getInt32(0)), scanwordVectorType);
     
    127125            matchRecordStart->addIncoming(priorRecordStart, prior_breaks_block);
    128126            phiRecordStart->addIncoming(matchRecordStart, loop_final_block);
    129 
    130127            Value * matchRecordEnd = iBuilder->CreateAdd(phiScanwordPos, iBuilder->CreateCountForwardZeroes(phiMatchWord));
    131             Function * const matcher = m->getFunction("matcher");
    132             assert (matcher);
    133             switch (mGrepType) {
    134                 case GrepType::Normal:
    135                     iBuilder->CreateCall(matcher, {matchRecordNum, matchRecordStart, matchRecordEnd, inputStream, getBufferedSize("InputStream"), getScalarField("FileIdx")});
    136                     break;
    137                 case GrepType::NameExpression:
    138                 case GrepType::PropertyValue:
    139                     iBuilder->CreateCall(matcher, {matchRecordNum, matchRecordStart, matchRecordEnd, inputStream});
    140                     break;
    141                 default: break;
     128
     129            Function * const matcher = m->getFunction("matcher"); assert (matcher);
     130            auto args = matcher->arg_begin();
     131            Value * const mrn = iBuilder->CreateZExtOrTrunc(matchRecordNum, args->getType());
     132            Value * const mrs = iBuilder->CreateZExtOrTrunc(matchRecordStart, (++args)->getType());
     133            Value * const mre = iBuilder->CreateZExtOrTrunc(matchRecordEnd, (++args)->getType());
     134            Value * const inputStream = getRawInputPointer("InputStream", iBuilder->getInt32(0), iBuilder->getInt32(0));
     135            Value * const is = iBuilder->CreatePointerCast(inputStream, (++args)->getType());
     136            if (mGrepType == GrepType::Normal) {
     137                Value * const sz = iBuilder->CreateZExtOrTrunc(getBufferedSize("InputStream"), (++args)->getType());
     138                Value * const fi = iBuilder->CreateZExtOrTrunc(getScalarField("FileIdx"), (++args)->getType());
     139                iBuilder->CreateCall(matcher, {mrn, mrs, mre, is, sz, fi});
     140            } else {
     141                iBuilder->CreateCall(matcher, {mrn, mrs, mre, is});
    142142            }
    143143
     
    204204    {},
    205205    {Binding{iBuilder->getSizeTy(), "BlockNo"}, Binding{iBuilder->getSizeTy(), "LineNum"}})
    206 , mGrepType(grepType)
    207 , mCodeUnitWidth(codeUnitWidth) {
    208 
    209 }
    210 
    211 }
     206, mGrepType(grepType) {
     207
     208}
     209
     210}
Note: See TracChangeset for help on using the changeset viewer.