Ignore:
Timestamp:
Jul 23, 2015, 11:00:08 AM (4 years ago)
Author:
cameron
Message:

Rename to avoid confusion between scope and frame

File:
1 edited

Legend:

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

    r4690 r4691  
    4949    /*  Set the current scope to PabloRoot */
    5050    mCurrentScope = mPabloRoot;
    51     mCurrentScopeIndex = 0;
     51    mCurrentFrameIndex = 0;
    5252    mCarryInfo = mCarryInfoVector[0];
    5353
     
    127127    mCurrentScope = blk;
    128128    mCarryInfo = mCarryInfoVector[blk->getScopeIndex()];
    129     mCurrentScopeIndex += mCarryInfo->getBlockCarryDataIndex();
    130     //std::cerr << "enterScope:  mCurrentScopeIndex = " << mCurrentScopeIndex << std::endl;
     129    mCurrentFrameIndex += mCarryInfo->getFrameIndex();
     130    //std::cerr << "enterScope:  mCurrentFrameIndex = " << mCurrentFrameIndex << std::endl;
    131131}
    132132
    133133void CarryManager::leaveScope() {
    134     mCurrentScopeIndex -= mCarryInfo->getBlockCarryDataIndex();
     134    mCurrentFrameIndex -= mCarryInfo->getFrameIndex();
    135135    mCurrentScope = mCurrentScope->getParent();
    136136    mCarryInfo = mCarryInfoVector[mCurrentScope->getScopeIndex()];
    137     //std::cerr << "leaveScope:  mCurrentScopeIndex = " << mCurrentScopeIndex << std::endl;
     137    //std::cerr << "leaveScope:  mCurrentFrameIndex = " << mCurrentFrameIndex << std::endl;
    138138}
    139139
     
    142142//#define LOAD_STORE_ON_BLOCK_ENTRY_EXIT   
    143143Value * CarryManager::getCarryOpCarryIn(int localIndex) {
    144     unsigned cd_index = mCurrentScopeIndex + mCarryInfo->carryOpCarryDataOffset(localIndex);
     144    unsigned cd_index = mCurrentFrameIndex + mCarryInfo->carryOpCarryDataOffset(localIndex);
    145145#ifndef LOAD_STORE_ON_BLOCK_ENTRY_EXIT
    146146    if (mCarryInfo->getWhileDepth() == 0) {
     
    153153
    154154void CarryManager::setCarryOpCarryOut(unsigned localIndex, Value * carry_out) {
    155     unsigned cd_index = mCurrentScopeIndex + mCarryInfo->carryOpCarryDataOffset(localIndex);
     155    unsigned cd_index = mCurrentFrameIndex + mCarryInfo->carryOpCarryDataOffset(localIndex);
    156156    mCarryOutVector[cd_index] = carry_out;
    157157#ifndef LOAD_STORE_ON_BLOCK_ENTRY_EXIT
     
    178178Value * CarryManager::unitAdvanceCarryInCarryOut(int localIndex, Value * strm) {
    179179   
    180     unsigned carryDataIndex = mCurrentScopeIndex + mCarryInfo->unitAdvanceCarryDataOffset(localIndex);
     180    unsigned carryDataIndex = mCurrentFrameIndex + mCarryInfo->unitAdvanceCarryDataOffset(localIndex);
    181181    mCarryOutVector[carryDataIndex] = strm;
    182182#ifndef LOAD_STORE_ON_BLOCK_ENTRY_EXIT
     
    204204
    205205Value * CarryManager::shortAdvanceCarryInCarryOut(int localIndex, int shift_amount, Value * strm) {
    206     unsigned carryDataIndex = mCurrentScopeIndex + mCarryInfo->shortAdvanceCarryDataOffset(localIndex);
     206    unsigned carryDataIndex = mCurrentFrameIndex + mCarryInfo->shortAdvanceCarryDataOffset(localIndex);
    207207    mCarryOutVector[carryDataIndex] = strm;
    208208#ifndef LOAD_STORE_ON_BLOCK_ENTRY_EXIT
     
    240240   
    241241Value * CarryManager::longAdvanceCarryInCarryOut(int localIndex, int shift_amount, Value * carry_out) {
    242     unsigned carryDataIndex = mCurrentScopeIndex + mCarryInfo->longAdvanceCarryDataOffset(localIndex);
     242    unsigned carryDataIndex = mCurrentFrameIndex + mCarryInfo->longAdvanceCarryDataOffset(localIndex);
    243243    Value * advBaseIndex = mBuilder->getInt64(carryDataIndex);
    244244    if (shift_amount <= BLOCK_SIZE) {
     
    285285
    286286Value * CarryManager::getCarrySummaryExpr() {
    287     unsigned summary_idx = mCurrentScopeIndex + mCarryInfo->summaryCarryDataIndex();
     287    unsigned summary_idx = mCurrentFrameIndex + mCarryInfo->summaryCarryDataIndex();
    288288    Value * packPtr = mBuilder->CreateGEP(mCarryDataPtr, mBuilder->getInt64(summary_idx));
    289289    Value * summary_expr = mBuilder->CreateAlignedLoad(packPtr, BLOCK_SIZE/8);
     
    299299        return;
    300300    }
    301     const unsigned carrySummaryIndex = mCurrentScopeIndex + mCarryInfo->summaryCarryDataIndex();
     301    const unsigned carrySummaryIndex = mCurrentFrameIndex + mCarryInfo->summaryCarryDataIndex();
    302302    PHINode * summary_phi = mBuilder->CreatePHI(mBitBlockType, 2, "summary");
    303303    summary_phi->addIncoming(mZeroInitializer, ifEntryBlock);
     
    315315    }
    316316   
    317     const unsigned carrySummaryIndex = mCurrentScopeIndex + mCarryInfo->summaryCarryDataIndex();
     317    const unsigned carrySummaryIndex = mCurrentFrameIndex + mCarryInfo->summaryCarryDataIndex();
    318318   
    319319    Value * carry_summary = mZeroInitializer;
     
    323323    }
    324324    else {
    325         auto localCarryIndex = mCurrentScopeIndex + mCarryInfo->getLocalCarryPackIndex();
     325        auto localCarryIndex = mCurrentFrameIndex + mCarryInfo->getLocalCarryPackIndex();
    326326        auto localCarryPacks = mCarryInfo->getLocalCarryDataSize();
    327327        if (localCarryPacks > 0) {
     
    337337                enterScope(inner_blk);
    338338                if (blockHasCarries()) {
    339                   carry_summary = mBuilder->CreateOr(carry_summary, mCarryOutVector[mCurrentScopeIndex + mCarryInfo->summaryCarryDataIndex()]);
     339                  carry_summary = mBuilder->CreateOr(carry_summary, mCarryOutVector[mCurrentFrameIndex + mCarryInfo->summaryCarryDataIndex()]);
    340340                }
    341341                leaveScope();
     
    345345                enterScope(inner_blk);
    346346                if (blockHasCarries()) {
    347                     carry_summary = mBuilder->CreateOr(carry_summary, mCarryOutVector[mCurrentScopeIndex + mCarryInfo->summaryCarryDataIndex()]);
     347                    carry_summary = mBuilder->CreateOr(carry_summary, mCarryOutVector[mCurrentFrameIndex + mCarryInfo->summaryCarryDataIndex()]);
    348348                }
    349349                leaveScope();
     
    363363    if ((mCarryInfo->getScopeCarryDataSize() == 0 ) || (mCarryInfo->getWhileDepth() > 0)) return;
    364364    if ((mCarryInfo->getIfDepth() == 0) || mCarryInfo->explicitSummaryRequired()) {
    365         auto localCarryIndex = mCurrentScopeIndex + mCarryInfo->getLocalCarryPackIndex();
     365        auto localCarryIndex = mCurrentFrameIndex + mCarryInfo->getLocalCarryPackIndex();
    366366        auto localCarryPacks = mCarryInfo->getLocalCarryDataSize();
    367367        //std::cerr << "ensureCarriesLoadedLocal: localCarryIndex =  " << localCarryIndex << "localCarryPacks =  " << localCarryPacks << std::endl;
     
    376376#ifdef LOAD_STORE_ON_BLOCK_ENTRY_EXIT
    377377    if ((mCarryInfo->getScopeCarryDataSize() == 0 ) || (mCarryInfo->getWhileDepth() > 0)) return;
    378     auto localCarryIndex = mCurrentScopeIndex + mCarryInfo->getLocalCarryPackIndex();
     378    auto localCarryIndex = mCurrentFrameIndex + mCarryInfo->getLocalCarryPackIndex();
    379379    auto localCarryPacks = mCarryInfo->getLocalCarryDataSize();
    380380    //std::cerr << "ensureCarriesStoredLocal: localCarryIndex =  " << localCarryIndex << "localCarryPacks =  " << localCarryPacks << std::endl;
     
    391391    const unsigned scopeCarryDataSize = mCarryInfo->getScopeCarryDataSize();
    392392    if (mCarryInfo->getWhileDepth() == 1) {
    393         for (auto i = mCurrentScopeIndex; i < mCurrentScopeIndex + scopeCarryDataSize; ++i) {
     393        for (auto i = mCurrentFrameIndex; i < mCurrentFrameIndex + scopeCarryDataSize; ++i) {
    394394            mCarryInVector[i] = mBuilder->CreateAlignedLoad(mBuilder->CreateGEP(mCarryDataPtr, mBuilder->getInt64(i)), BLOCK_SIZE/8, false);
    395395        }
     
    400400void CarryManager::initializeCarryDataPhisAtWhileEntry(BasicBlock * whileEntryBlock) {
    401401    const unsigned scopeCarryDataSize = mCarryInfo->getScopeCarryDataSize();
    402     for (unsigned index = mCurrentScopeIndex; index < mCurrentScopeIndex + scopeCarryDataSize; ++index) {
     402    for (unsigned index = mCurrentFrameIndex; index < mCurrentFrameIndex + scopeCarryDataSize; ++index) {
    403403#ifdef SET_WHILE_CARRY_IN_TO_ZERO_AFTER_FIRST_ITERATION
    404404        PHINode * phi_in = mBuilder->CreatePHI(mBitBlockType, 2);
     
    415415void CarryManager::extendCarryDataPhisAtWhileBodyFinalBlock(BasicBlock * whileBodyFinalBlock) {
    416416    const unsigned scopeCarryDataSize = mCarryInfo->getScopeCarryDataSize();
    417     for (unsigned index = mCurrentScopeIndex; index < mCurrentScopeIndex + scopeCarryDataSize; ++index) {
     417    for (unsigned index = mCurrentFrameIndex; index < mCurrentFrameIndex + scopeCarryDataSize; ++index) {
    418418#ifdef SET_WHILE_CARRY_IN_TO_ZERO_AFTER_FIRST_ITERATION
    419419        mCarryInPhis[index]->addIncoming(mZeroInitializer, whileBodyFinalBlock);
     
    429429    const unsigned scopeCarryDataSize = mCarryInfo->getScopeCarryDataSize();
    430430    if (mCarryInfo->getWhileDepth() == 1) {
    431         for (auto i = mCurrentScopeIndex; i < mCurrentScopeIndex + scopeCarryDataSize; ++i) {
     431        for (auto i = mCurrentFrameIndex; i < mCurrentFrameIndex + scopeCarryDataSize; ++i) {
    432432            Value * storePtr = mBuilder->CreateGEP(mCarryDataPtr, mBuilder->getInt64(i));
    433433            mBuilder->CreateAlignedStore(mCarryOutVector[i], storePtr, BLOCK_SIZE/8, false);
Note: See TracChangeset for help on using the changeset viewer.