summaryrefslogtreecommitdiff
path: root/src/cpu/o3/bpred_unit.hh
diff options
context:
space:
mode:
authorMrinmoy Ghosh <mrinmoy.ghosh@arm.com>2012-02-13 12:26:24 -0600
committerMrinmoy Ghosh <mrinmoy.ghosh@arm.com>2012-02-13 12:26:24 -0600
commitfd90c3676d94520b98a9af29af09c1f8a2858465 (patch)
treeebda3f4fbd25b9135545bf2bfee4e316873e2130 /src/cpu/o3/bpred_unit.hh
parentabc212461b865a47437a8dbf532b497ea4562137 (diff)
downloadgem5-fd90c3676d94520b98a9af29af09c1f8a2858465.tar.xz
BP: Fix several Branch Predictor issues.
1. Updates the Branch Predictor correctly to the state just after a mispredicted branch, if a squash occurs. 2. If a BTB does not find an entry, the branch is predicted not taken. The global history is modified to correctly reflect this prediction. 3. Local history is now updated at the fetch stage instead of execute stage. 4. In the Update stage of the branch predictor the local predictors are now correctly updated according to the state of local history during fetch stage. This patch also improves performance by as much as 17% on some benchmarks
Diffstat (limited to 'src/cpu/o3/bpred_unit.hh')
-rw-r--r--src/cpu/o3/bpred_unit.hh14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/cpu/o3/bpred_unit.hh b/src/cpu/o3/bpred_unit.hh
index 8dbba9085..d3ae93b38 100644
--- a/src/cpu/o3/bpred_unit.hh
+++ b/src/cpu/o3/bpred_unit.hh
@@ -137,6 +137,16 @@ class BPredUnit
*/
bool BPLookup(Addr instPC, void * &bp_history);
+ /**
+ * If a branch is not taken, because the BTB address is invalid or missing,
+ * this function sets the appropriate counter in the global and local
+ * predictors to not taken.
+ * @param inst_PC The PC to look up the local predictor.
+ * @param bp_history Pointer that will be set to an object that
+ * has the branch predictor state associated with the lookup.
+ */
+ void BPBTBUpdate(Addr instPC, void * &bp_history);
+
/**
* Looks up a given PC in the BTB to see if a matching entry exists.
* @param inst_PC The PC to look up.
@@ -159,9 +169,11 @@ class BPredUnit
* @param taken Whether the branch was taken or not taken.
* @param bp_history Pointer to the branch predictor state that is
* associated with the branch lookup that is being updated.
+ * @param squashed Set to true when this function is called during a
+ * squash operation.
* @todo Make this update flexible enough to handle a global predictor.
*/
- void BPUpdate(Addr instPC, bool taken, void *bp_history);
+ void BPUpdate(Addr instPC, bool taken, void *bp_history, bool squashed);
/**
* Updates the BTB with the target of a branch.