diff options
-rw-r--r-- | src/cpu/pred/tournament.cc | 7 | ||||
-rw-r--r-- | src/cpu/pred/tournament.hh | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/cpu/pred/tournament.cc b/src/cpu/pred/tournament.cc index 1d4fe037e..ea6be46fa 100644 --- a/src/cpu/pred/tournament.cc +++ b/src/cpu/pred/tournament.cc @@ -217,6 +217,7 @@ TournamentBP::lookup(Addr branch_addr, void * &bp_history) history->localPredTaken = local_prediction; history->globalPredTaken = global_prediction; history->globalUsed = choice_prediction; + history->localHistoryIdx = local_history_idx; history->localHistory = local_predictor_idx; bp_history = (void *)history; @@ -256,6 +257,7 @@ TournamentBP::uncondBranch(Addr pc, void * &bp_history) history->localPredTaken = true; history->globalPredTaken = true; history->globalUsed = true; + history->localHistoryIdx = invalidPredictorIndex; history->localHistory = invalidPredictorIndex; bp_history = static_cast<void *>(history); @@ -371,6 +373,11 @@ TournamentBP::squash(void *bp_history) // Restore global history to state prior to this branch. globalHistory = history->globalHistory; + // Restore local history + if (history->localHistoryIdx != invalidPredictorIndex) { + localHistoryTable[history->localHistoryIdx] = history->localHistory; + } + // Delete this BPHistory now that we're done with it. delete history; } diff --git a/src/cpu/pred/tournament.hh b/src/cpu/pred/tournament.hh index d46175610..8fb5b515c 100644 --- a/src/cpu/pred/tournament.hh +++ b/src/cpu/pred/tournament.hh @@ -167,6 +167,7 @@ class TournamentBP : public BPredUnit static int newCount; #endif unsigned globalHistory; + unsigned localHistoryIdx; unsigned localHistory; bool localPredTaken; bool globalPredTaken; |