Changeset 4897


Ignore:
Timestamp:
Dec 23, 2015, 9:44:41 AM (3 years ago)
Author:
cameron
Message:

Eliminate need for mPackBuilder

Location:
icGREP/icgrep-devel/icgrep/pablo
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/pablo/carry_manager.cpp

    r4881 r4897  
    6969        mITEMS_PER_PACK = 64;
    7070        mCarryPackType = mBuilder->getIntNTy(mPACK_SIZE);
    71         mPackBuilder = new IDISA::IDISA_Builder(mCarryPackType);
    72         mPackBuilder->initialize(m, mBuilder);
    7371    }
    7472    else {
     
    288286   
    289287void CarryManager::storeCarryPack(unsigned packIndex) {
    290     mBuilder->CreateAlignedStore(mPackBuilder->bitCast(mCarryOutPack[packIndex]), mCarryPackPtr[packIndex], mPACK_SIZE/8);
     288    mBuilder->CreateAlignedStore(mCarryOutPack[packIndex], mCarryPackPtr[packIndex], mPACK_SIZE/8);
    291289}
    292290
     
    301299    }
    302300    uint64_t mask = ((((uint64_t) 1) << bitCount) - 1) << lo_bit;
    303     return mPackBuilder->simd_and(pack, mBuilder->getInt64(mask));
     301    return mBuilder->CreateAnd(pack, ConstantInt::get(mCarryPackType, mask));
    304302}
    305303   
     
    330328    }
    331329    else {
    332         mCarryOutPack[packIndex] = mPackBuilder->simd_or(mCarryOutPack[packIndex], field);
     330        mCarryOutPack[packIndex] = mBuilder->CreateOr(mCarryOutPack[packIndex], field);
    333331    }
    334332}
     
    565563    if (blockHasCarries()) {
    566564        if (mCarryOutPack[scopeBasePack()] == nullptr) {
    567             mCarryInfo->ifEntryPack = mPackBuilder->allZeroes();
     565            mCarryInfo->ifEntryPack = Constant::getNullValue(mCarryPackType);
    568566        }
    569567        else {
     
    580578        for (unsigned index = currentScopeBase; index < currentScopeBase + scopeCarryPacks; ++index) {
    581579            PHINode * phi_out = mBuilder->CreatePHI(mCarryPackType, 2);
    582             phi_out->addIncoming(mPackBuilder->allZeroes(),ifEntryBlock);
    583             phi_out->addIncoming(mPackBuilder->bitCast(mCarryOutPack[index]), ifBodyFinalBlock);
     580            phi_out->addIncoming(Constant::getNullValue(mCarryPackType),ifEntryBlock);
     581            phi_out->addIncoming(mCarryOutPack[index], ifBodyFinalBlock);
    584582            mCarryOutPack[index] = phi_out;
    585583        }
     
    596594            PHINode * ifPack_phi = mBuilder->CreatePHI(mCarryPackType, 2, "ifPack");
    597595            ifPack_phi->addIncoming(mCarryInfo->ifEntryPack, ifEntryBlock);
    598             ifPack_phi->addIncoming(mPackBuilder->bitCast(mCarryOutPack[ifPackIndex]), ifBodyFinalBlock);
     596            ifPack_phi->addIncoming(mCarryOutPack[ifPackIndex], ifBodyFinalBlock);
    599597            mCarryOutPack[ifPackIndex] = ifPack_phi;
    600598            return;
     
    606604        const unsigned summaryIndex = summaryPackIndex();
    607605        PHINode * summary_phi = mBuilder->CreatePHI(mCarryPackType, 2, "summary");
    608         summary_phi->addIncoming(mPackBuilder->allZeroes(), ifEntryBlock);
    609         summary_phi->addIncoming(mPackBuilder->bitCast(mCarryOutPack[summaryIndex]), ifBodyFinalBlock);
     606        summary_phi->addIncoming(Constant::getNullValue(mCarryPackType), ifEntryBlock);
     607        summary_phi->addIncoming(mCarryOutPack[summaryIndex], ifBodyFinalBlock);
    610608        mCarryOutPack[summaryIndex] = summary_phi;
    611609    }
     
    620618    const unsigned carrySummaryIndex = summaryPackIndex();
    621619    PHINode * summary_phi = mBuilder->CreatePHI(mCarryPackType, 2, "summary");
    622     summary_phi->addIncoming(mPackBuilder->allZeroes(), ifEntryBlock);
    623     summary_phi->addIncoming(mPackBuilder->bitCast(mCarryOutPack[carrySummaryIndex]), ifBodyFinalBlock);
     620    summary_phi->addIncoming(Constant::getNullValue(mCarryPackType), ifEntryBlock);
     621    summary_phi->addIncoming(mCarryOutPack[carrySummaryIndex], ifBodyFinalBlock);
    624622    mCarryOutPack[carrySummaryIndex] = summary_phi;
    625623}
     
    636634    const unsigned carrySummaryIndex = summaryPackIndex();
    637635   
    638     Value * carry_summary = mPackBuilder->allZeroes();
     636    Value * carry_summary = Constant::getNullValue(mCarryPackType);
    639637    if (mCarryInfo->blockHasLongAdvances()) { // Force if entry
    640         carry_summary = mPackBuilder->allOnes();
     638        carry_summary = Constant::getAllOnesValue(mCarryPackType);
    641639    }
    642640    else {
     
    646644            carry_summary = mCarryOutPack[localCarryIndex];
    647645            for (unsigned i = 1; i < localCarryPacks; i++) {
    648                 carry_summary = mPackBuilder->simd_or(carry_summary, mCarryOutPack[localCarryIndex+i]);
     646                carry_summary = mBuilder->CreateOr(carry_summary, mCarryOutPack[localCarryIndex+i]);
    649647            }
    650648        }
     
    654652                enterScope(inner_blk);
    655653                if (blockHasCarries()) {
    656                   carry_summary = mPackBuilder->simd_or(carry_summary, mCarryOutPack[summaryPackIndex()]);
     654                  carry_summary = mBuilder->CreateOr(carry_summary, mCarryOutPack[summaryPackIndex()]);
    657655                }
    658656                leaveScope();
     
    662660                enterScope(inner_blk);
    663661                if (blockHasCarries()) {
    664                     carry_summary = mPackBuilder->simd_or(carry_summary, mCarryOutPack[summaryPackIndex()]);
     662                    carry_summary = mBuilder->CreateOr(carry_summary, mCarryOutPack[summaryPackIndex()]);
    665663                }
    666664                leaveScope();
     
    699697#endif
    700698        PHINode * phi_out = mBuilder->CreatePHI(mCarryPackType, 2);
    701         phi_out->addIncoming(mPackBuilder->allZeroes(), whileEntryBlock);
     699        phi_out->addIncoming(Constant::getNullValue(mCarryPackType), whileEntryBlock);
    702700        mCarryOutAccumPhis[index] = phi_out;
    703701    }
     
    710708    for (unsigned index = 0; index < scopeCarryPacks; ++index) {
    711709#ifdef SET_WHILE_CARRY_IN_TO_ZERO_AFTER_FIRST_ITERATION
    712         mCarryInPhis[index]->addIncoming(mPackBuilder->allZeroes(), whileBodyFinalBlock);
     710        mCarryInPhis[index]->addIncoming(Constant::getNullValue(mCarryPackType), whileBodyFinalBlock);
    713711#endif
    714712        PHINode * phi = mCarryOutAccumPhis[index];
    715         Value * carryOut = mPackBuilder->simd_or(phi, mCarryOutPack[currentScopeBase+index]);
    716         phi->addIncoming(mPackBuilder->bitCast(carryOut), whileBodyFinalBlock);
     713        Value * carryOut = mBuilder->CreateOr(phi, mCarryOutPack[currentScopeBase+index]);
     714        phi->addIncoming(carryOut, whileBodyFinalBlock);
    717715        mCarryOutPack[currentScopeBase+index] = carryOut;
    718716    }
  • icGREP/icgrep-devel/icgrep/pablo/carry_manager.h

    r4838 r4897  
    4343    : mBuilder(b)
    4444    , iBuilder(idb)
    45     , mPackBuilder(idb)
    4645    , mBitBlockType(idb->getBitBlockType())
    4746    , mBITBLOCK_WIDTH(idb->getBitBlockWidth())
     
    123122    IRBuilder <> * mBuilder;
    124123    IDISA::IDISA_Builder * iBuilder;
    125     IDISA::IDISA_Builder * mPackBuilder;
    126124    Type * mBitBlockType;
    127125    unsigned mBITBLOCK_WIDTH;
Note: See TracChangeset for help on using the changeset viewer.