Ignore:
Timestamp:
Oct 5, 2015, 8:30:12 AM (4 years ago)
Author:
cameron
Message:

Encapsulating all-zeroes and all-ones initializers within IDISA builder

File:
1 edited

Legend:

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

    r4813 r4821  
    5151        mITEMS_PER_PACK = 64;
    5252        mCarryPackType = mBuilder->getIntNTy(mPACK_SIZE);
    53         mZeroInitializer = mBuilder->getInt64(0);
    54         mOneInitializer = mBuilder->getInt64(-1);
     53        mPackBuilder = new IDISA::IDISA_Builder(mCarryPackType);
     54        mPackBuilder->initialize(m, mBuilder);
    5555    }
    5656    else {
     
    521521    if (blockHasCarries()) {
    522522        if (mCarryOutPack[scopeBasePack()] == nullptr) {
    523             mCarryInfo->ifEntryPack = mZeroInitializer;
     523            mCarryInfo->ifEntryPack = mPackBuilder->allZeroes();
    524524        }
    525525        else {
     
    536536        for (unsigned index = currentScopeBase; index < currentScopeBase + scopeCarryPacks; ++index) {
    537537            PHINode * phi_out = mBuilder->CreatePHI(mCarryPackType, 2);
    538             phi_out->addIncoming(mZeroInitializer,ifEntryBlock);
     538            phi_out->addIncoming(mPackBuilder->allZeroes(),ifEntryBlock);
    539539            phi_out->addIncoming(mCarryOutPack[index],ifBodyFinalBlock);
    540540            mCarryOutPack[index] = phi_out;
     
    562562        const unsigned summaryIndex = summaryPackIndex();
    563563        PHINode * summary_phi = mBuilder->CreatePHI(mCarryPackType, 2, "summary");
    564         summary_phi->addIncoming(mZeroInitializer, ifEntryBlock);
     564        summary_phi->addIncoming(mPackBuilder->allZeroes(), ifEntryBlock);
    565565        summary_phi->addIncoming(mCarryOutPack[summaryIndex], ifBodyFinalBlock);
    566566        mCarryOutPack[summaryIndex] = summary_phi;
     
    576576    const unsigned carrySummaryIndex = summaryPackIndex();
    577577    PHINode * summary_phi = mBuilder->CreatePHI(mCarryPackType, 2, "summary");
    578     summary_phi->addIncoming(mZeroInitializer, ifEntryBlock);
     578    summary_phi->addIncoming(mPackBuilder->allZeroes(), ifEntryBlock);
    579579    summary_phi->addIncoming(mCarryOutPack[carrySummaryIndex], ifBodyFinalBlock);
    580580    mCarryOutPack[carrySummaryIndex] = summary_phi;
     
    592592    const unsigned carrySummaryIndex = summaryPackIndex();
    593593   
    594     Value * carry_summary = mZeroInitializer;
     594    Value * carry_summary = mPackBuilder->allZeroes();
    595595    if (mCarryInfo->blockHasLongAdvances()) { // Force if entry
    596         carry_summary = mOneInitializer;
     596        carry_summary = mPackBuilder->allOnes();
    597597    }
    598598    else {
     
    655655#endif
    656656        PHINode * phi_out = mBuilder->CreatePHI(mCarryPackType, 2);
    657         phi_out->addIncoming(mZeroInitializer, whileEntryBlock);
     657        phi_out->addIncoming(mPackBuilder->allZeroes(), whileEntryBlock);
    658658        mCarryOutAccumPhis[index] = phi_out;
    659659    }
     
    666666    for (unsigned index = 0; index < scopeCarryPacks; ++index) {
    667667#ifdef SET_WHILE_CARRY_IN_TO_ZERO_AFTER_FIRST_ITERATION
    668         mCarryInPhis[index]->addIncoming(mZeroInitializer, whileBodyFinalBlock);
     668        mCarryInPhis[index]->addIncoming(mPackBuilder->allZeroes(), whileBodyFinalBlock);
    669669#endif
    670670        PHINode * phi = mCarryOutAccumPhis[index];
Note: See TracChangeset for help on using the changeset viewer.