Ignore:
Timestamp:
Jul 22, 2015, 8:39:29 AM (4 years ago)
Author:
cameron
Message:

Carry Manager restructuring and bug fixes

File:
1 edited

Legend:

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

    r4681 r4687  
    434434}
    435435
     436// Assign sequential scope indexes, returning the next unassigned index   
     437
     438unsigned PabloBlock::enumerateScopes(unsigned baseScopeIndex) {
     439    mScopeIndex = baseScopeIndex;
     440    unsigned nextScopeIndex = baseScopeIndex + 1;
     441    for (Statement * stmt : *this) {
     442        if (If * ifStatement = dyn_cast<If>(stmt)) {
     443            nextScopeIndex = ifStatement->getBody().enumerateScopes(nextScopeIndex);
     444        }
     445        else if (While * whileStatement = dyn_cast<While>(stmt)) {
     446            nextScopeIndex = whileStatement->getBody().enumerateScopes(nextScopeIndex);
     447        }
     448    }
     449    return nextScopeIndex;
     450}   
     451           
     452   
     453       
     454   
    436455/// CONSTRUCTOR
    437456
     
    442461, mSymbolGenerator(symbolGenerator)
    443462, mParent(nullptr)
     463, mScopeIndex(0)
    444464{
    445465
     
    451471, mOnes(predecessor->mOnes) // inherit the original "Ones" variable for simplicity
    452472, mSymbolGenerator(predecessor->mSymbolGenerator)
    453 , mParent(predecessor) {
     473, mParent(predecessor)
     474, mScopeIndex(0)
     475{
    454476
    455477}
Note: See TracChangeset for help on using the changeset viewer.