171c171
< } else if (bi->loopPred != bi->tagePred) {
---
> } else if (bi->loopPred != bi->tageBranchInfo->tagePred) {
173c173,174
< unsignedCtrUpdate(ltable[idx].age, true, loopTableAgeBits);
---
> TAGEBase::unsignedCtrUpdate(ltable[idx].age, true,
> loopTableAgeBits);
193c194
< unsignedCtrUpdate(ltable[idx].confidence, true,
---
> TAGEBase::unsignedCtrUpdate(ltable[idx].confidence, true,
221c222,223
< ((bi->loopPredValid ? bi->loopPred : bi->tagePred) != taken) :
---
> ((bi->loopPredValid ?
> bi->loopPred : bi->tageBranchInfo->tagePred) != taken) :
224c226
< int nrand = random_mt.random<int>();
---
> int nrand = TAGEBase::getRandom();
251c253
< LTageBranchInfo *bi = new LTageBranchInfo(nHistoryTables+1);
---
> LTageBranchInfo *bi = new LTageBranchInfo(*tage);
254c256,257
< bool pred_taken = tagePredict(tid, branch_pc, cond_branch, bi);
---
> bool pred_taken = tage->tagePredict(tid, branch_pc, cond_branch,
> bi->tageBranchInfo);
262c265
< bi->provider = LOOP;
---
> bi->tageBranchInfo->provider = LOOP;
267c270,271
< loopUseCounter, bi->tagePred, bi->altTaken);
---
> loopUseCounter, bi->tageBranchInfo->tagePred,
> bi->tageBranchInfo->altTaken);
278,279c282,283
< LTAGE::condBranchUpdate(Addr branch_pc, bool taken,
< TageBranchInfo* tage_bi, int nrand)
---
> LTAGE::update(ThreadID tid, Addr branch_pc, bool taken, void* bp_history,
> bool squashed, const StaticInstPtr & inst, Addr corrTarget)
281c285
< LTageBranchInfo* bi = static_cast<LTageBranchInfo*>(tage_bi);
---
> assert(bp_history);
283,288c287,296
< if (useSpeculation) {
< // recalculate loop prediction without speculation
< // It is ok to overwrite the loop prediction fields in bi
< // as the stats have already been updated with the previous
< // values
< bi->loopPred = getLoop(branch_pc, bi, false);
---
> LTageBranchInfo* bi = static_cast<LTageBranchInfo*>(bp_history);
>
> if (squashed) {
> if (tage->isSpeculativeUpdateEnabled()) {
> // This restores the global history, then update it
> // and recomputes the folded histories.
> tage->squash(tid, taken, bi->tageBranchInfo, corrTarget);
> squashLoop(bi);
> }
> return;
291,295c299,310
< if (bi->loopPredValid) {
< if (bi->tagePred != bi->loopPred) {
< ctrUpdate(loopUseCounter,
< (bi->loopPred == taken),
< withLoopBits);
---
> int nrand = TAGEBase::getRandom() & 3;
> if (bi->tageBranchInfo->condBranch) {
> DPRINTF(LTage, "Updating tables for branch:%lx; taken?:%d\n",
> branch_pc, taken);
> tage->updateStats(taken, bi->tageBranchInfo);
> // update stats
> if (bi->tageBranchInfo->provider == LOOP) {
> if (taken == bi->loopPred) {
> loopPredictorCorrect++;
> } else {
> loopPredictorWrong++;
> }
296a312,331
> // cond Branch Update
> if (useSpeculation) {
> // recalculate loop prediction without speculation
> // It is ok to overwrite the loop prediction fields in bi
> // as the stats have already been updated with the previous
> // values
> bi->loopPred = getLoop(branch_pc, bi, false);
> }
> if (bi->loopPredValid) {
> if (bi->tageBranchInfo->tagePred != bi->loopPred) {
> TAGEBase::ctrUpdate(loopUseCounter,
> (bi->loopPred == taken),
> withLoopBits);
> }
> }
>
> loopUpdate(branch_pc, taken, bi);
>
> tage->condBranchUpdate(tid, branch_pc, taken, bi->tageBranchInfo,
> nrand, corrTarget);
299c334,335
< loopUpdate(branch_pc, taken, bi);
---
> tage->updateHistories(tid, branch_pc, taken, bi->tageBranchInfo, false,
> inst, corrTarget);
301c337
< TAGE::condBranchUpdate(branch_pc, taken, bi, nrand);
---
> delete bi;
305c341
< LTAGE::squash(ThreadID tid, bool taken, void *bp_history)
---
> LTAGE::squashLoop(LTageBranchInfo* bi)
307,311c343
< TAGE::squash(tid, taken, bp_history);
<
< LTageBranchInfo* bi = (LTageBranchInfo*)(bp_history);
<
< if (bi->condBranch) {
---
> if (bi->tageBranchInfo->condBranch) {
325,331c357,359
< if (bi->condBranch) {
< if (bi->loopHit >= 0) {
< int idx = finallindex(bi->loopIndex,
< bi->loopLowPcBits,
< bi->loopHit);
< ltable[idx].currentIterSpec = bi->currentIter;
< }
---
>
> if (bi->tageBranchInfo->condBranch) {
> squashLoop(bi);
337d364
<
339,356d365
< LTAGE::updateStats(bool taken, TageBranchInfo* bi)
< {
< TAGE::updateStats(taken, bi);
<
< LTageBranchInfo * ltage_bi = static_cast<LTageBranchInfo *>(bi);
<
< if (ltage_bi->provider == LOOP) {
< if (taken == ltage_bi->loopPred) {
< loopPredictorCorrect++;
< } else {
< loopPredictorWrong++;
< }
< }
< }
<
<
<
< void