Changeset 4676
- Timestamp:
- Jul 15, 2015, 6:20:38 PM (4 years ago)
- Location:
- icGREP/icgrep-devel/icgrep/pablo
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
icGREP/icgrep-devel/icgrep/pablo/carry_data.cpp
r4672 r4676 112 112 scopeCarryDataBits = nestedframePosition; 113 113 114 if ( (ifDepth > 0) && (scopeCarryDataBits > BLOCK_SIZE)) {114 if (explicitSummaryRequired()) { 115 115 // Need extra space for the summary variable, always the last 116 116 // entry within an if block. -
icGREP/icgrep-devel/icgrep/pablo/carry_data.h
r4672 r4676 94 94 bool blockHasCarries() const { return scopeCarryDataBits > 0;} 95 95 96 bool explicitSummaryRequired() const { return scopeCarryDataBits > BLOCK_SIZE;} 97 98 bool summaryNeededInParentBlock() const {return (ifDepth > 0) && blockHasCarries();} 96 bool explicitSummaryRequired() const { return (ifDepth > 0) && (scopeCarryDataBits > BLOCK_SIZE);} 99 97 100 98 private: -
icGREP/icgrep-devel/icgrep/pablo/carry_manager.cpp
r4672 r4676 210 210 } 211 211 212 bool CarryManager::summaryNeededInParentBlock(){ 213 return mCarryInfo->summaryNeededInParentBlock(); 214 } 215 216 void CarryManager::addSummaryPhi(BasicBlock * ifEntryBlock, BasicBlock * ifBodyFinalBlock) { 212 void CarryManager::addSummaryPhiIfNeeded(BasicBlock * ifEntryBlock, BasicBlock * ifBodyFinalBlock) { 213 if ((mCarryInfo->getIfDepth() <= 1) || !mCarryInfo->blockHasCarries()){ 214 // For ifDepth == 1, the parent does not need a summary as it is not itself within an if. 215 // Therefore, it doesn't need access to this block's summary in building its own. 216 return; 217 } 217 218 const unsigned carrySummaryIndex = mCurrentScopeIndex + mCarryInfo->summaryCarryDataIndex(); 218 219 PHINode * summary_phi = mBuilder->CreatePHI(mBitBlockType, 2, "summary"); … … 222 223 } 223 224 224 void CarryManager::generateCarryOutSummaryCode() { 225 void CarryManager::generateCarryOutSummaryCodeIfNeeded() { 226 227 if (!mCarryInfo->explicitSummaryRequired()) { 228 // An explicit summary may not be required, if there is a single carry 229 // operation within the block, or the carries are packed and all carry 230 // bits fit within a single pack. 231 return; 232 } 225 233 226 234 const unsigned carrySummaryIndex = mCurrentScopeIndex + mCarryInfo->summaryCarryDataIndex(); 227 228 if (mCarryInfo->getScopeCarryDataSize() == 1) {229 // If scopeCarryDataSize == 1, then we have one pack which serves as230 // the summary. It should already be stored.231 return;232 }233 235 234 236 Value * carry_summary = mZeroInitializer; -
icGREP/icgrep-devel/icgrep/pablo/carry_manager.h
r4672 r4676 76 76 Value * getCarrySummaryExpr(); 77 77 78 void generateCarryOutSummaryCode ();78 void generateCarryOutSummaryCodeIfNeeded(); 79 79 80 bool summaryNeededInParentBlock(); 81 82 void addSummaryPhi(BasicBlock * ifEntryBlock, BasicBlock * ifBodyFinalBlock); 80 void addSummaryPhiIfNeeded(BasicBlock * ifEntryBlock, BasicBlock * ifBodyFinalBlock); 83 81 84 82 /* Methods for load/store of carries for non-while blocks. */ -
icGREP/icgrep-devel/icgrep/pablo/pablo_compiler.cpp
r4674 r4676 462 462 --mIfDepth; 463 463 if (mCarryManager->blockHasCarries()) { 464 mCarryManager->generateCarryOutSummaryCode ();464 mCarryManager->generateCarryOutSummaryCodeIfNeeded(); 465 465 } 466 466 BasicBlock * ifBodyFinalBlock = mBuilder->GetInsertBlock(); … … 478 478 } 479 479 // Create the phi Node for the summary variable, if needed. 480 if (mCarryManager->summaryNeededInParentBlock()) { 481 mCarryManager->addSummaryPhi(ifEntryBlock, ifBodyFinalBlock); 482 } 480 mCarryManager->addSummaryPhiIfNeeded(ifEntryBlock, ifBodyFinalBlock); 483 481 mCarryManager->leaveScope(); 484 482 }
Note: See TracChangeset
for help on using the changeset viewer.