* used in the 21264. It has a local predictor, which uses a local history
* table to index into a table of counters, and a global predictor, which
* uses a global history to index into a table of counters. A choice
- * predictor chooses between the two. Only the global history register
- * is speculatively updated, the rest are updated upon branches committing
- * or misspeculating.
+ * predictor chooses between the two. Both the global history register
+ * and the selected local history are speculatively updated.
*/
class TournamentBP : public BPredUnit
{
* @param bp_history Pointer that will be set to the BPHistory object.
* @return Whether or not the branch is taken.
*/
- bool lookup(Addr branch_addr, void * &bp_history);
+ bool lookup(ThreadID tid, Addr branch_addr, void * &bp_history);
/**
* Records that there was an unconditional branch, and modifies
* global history stored in it.
* @param bp_history Pointer that will be set to the BPHistory object.
*/
- void uncondBranch(Addr pc, void * &bp_history);
+ void uncondBranch(ThreadID tid, Addr pc, void * &bp_history);
/**
* Updates the branch predictor to Not Taken if a BTB entry is
* invalid or not found.
* @param bp_history Pointer to any bp history state.
* @return Whether or not the branch is taken.
*/
- void btbUpdate(Addr branch_addr, void * &bp_history);
+ void btbUpdate(ThreadID tid, Addr branch_addr, void * &bp_history);
/**
* Updates the branch predictor with the actual result of a branch.
* @param branch_addr The address of the branch to update.
* @param squashed is set when this function is called during a squash
* operation.
*/
- void update(Addr branch_addr, bool taken, void *bp_history, bool squashed);
-
- void retireSquashed(void *bp_history);
+ void update(ThreadID tid, Addr branch_addr, bool taken, void *bp_history,
+ bool squashed);
/**
* Restores the global branch history on a squash.
* @param bp_history Pointer to the BPHistory object that has the
* previous global branch history in it.
*/
- void squash(void *bp_history);
+ void squash(ThreadID tid, void *bp_history);
- /** Returns the global history. */
- inline unsigned readGlobalHist() { return globalHistory; }
+ unsigned getGHR(ThreadID tid, void *bp_history) const;
private:
/**
inline unsigned calcLocHistIdx(Addr &branch_addr);
/** Updates global history as taken. */
- inline void updateGlobalHistTaken();
+ inline void updateGlobalHistTaken(ThreadID tid);
/** Updates global history as not taken. */
- inline void updateGlobalHistNotTaken();
+ inline void updateGlobalHistNotTaken(ThreadID tid);
/**
* Updates local histories as taken.
/** Global history register. Contains as much history as specified by
* globalHistoryBits. Actual number of bits used is determined by
* globalHistoryMask and choiceHistoryMask. */
- unsigned globalHistory;
+ std::vector<unsigned> globalHistory;
/** Number of bits for the global history. Determines maximum number of
entries in global and choice predictor tables. */