Ignore:
Timestamp:
Nov 14, 2015, 5:38:36 PM (4 years ago)
Author:
nmedfort
Message:

Bug fix for Multiplexing. Added ability to set the body of a If/While? node after creation.

File:
1 edited

Legend:

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

    r4843 r4870  
    9393
    9494 
    95     PabloBlock & mainScope = function->getEntryBlock();
    96 
    97     mainScope.enumerateScopes(0);
     95    PabloBlock * const mainScope = function->getEntryBlock();
     96
     97    mainScope->enumerateScopes(0);
    9898   
    9999    Examine(*function);
     
    124124    //Generate the IR instructions for the function.
    125125   
    126     mCarryManager->initialize(mMod, &mainScope);
     126    mCarryManager->initialize(mMod, mainScope);
    127127   
    128128    compileBlock(mainScope);
     
    191191
    192192
    193 void PabloCompiler::Examine(PabloBlock & block) {
    194     for (Statement * stmt : block) {
     193void PabloCompiler::Examine(PabloBlock * block) {
     194    for (Statement * stmt : *block) {
    195195        if (If * ifStatement = dyn_cast<If>(stmt)) {
    196196            Examine(ifStatement->getBody());
     
    204204}
    205205
    206 void PabloCompiler::compileBlock(PabloBlock & block) {
    207     mPabloBlock = & block;
    208     for (const Statement * statement : block) {
     206void PabloCompiler::compileBlock(PabloBlock * block) {
     207    mPabloBlock = block;
     208    for (const Statement * statement : *block) {
    209209        compileStatement(statement);
    210210    }
    211     mPabloBlock = block.getParent();
     211    mPabloBlock = block->getParent();
    212212}
    213213
     
    235235    BasicBlock * ifEndBlock = BasicBlock::Create(mMod->getContext(), "if.end", mFunction, 0);
    236236   
    237     PabloBlock & ifBody = ifStatement -> getBody();
     237    PabloBlock * ifBody = ifStatement->getBody();
    238238   
    239239    Value * if_test_value = compileExpression(ifStatement->getCondition());
    240240   
    241     mCarryManager->enterScope(&ifBody);
     241    mCarryManager->enterScope(ifBody);
    242242    mBuilder->CreateCondBr(mCarryManager->generateBitBlockOrSummaryTest(if_test_value), ifBodyBlock, ifEndBlock);
    243243   
     
    271271void PabloCompiler::compileWhile(const While * whileStatement) {
    272272
    273     PabloBlock & whileBody = whileStatement -> getBody();
     273    PabloBlock * const whileBody = whileStatement->getBody();
    274274   
    275275    BasicBlock * whileEntryBlock = mBuilder->GetInsertBlock();
     
    277277    BasicBlock * whileEndBlock = BasicBlock::Create(mMod->getContext(), "while.end", mFunction, 0);
    278278
    279     mCarryManager->enterScope(&whileBody);
     279    mCarryManager->enterScope(whileBody);
    280280    mCarryManager->ensureCarriesLoadedRecursive();
    281281
Note: See TracChangeset for help on using the changeset viewer.