diff options
author | Andreas Hansson <andreas.hansson@arm.com> | 2014-08-13 06:57:21 -0400 |
---|---|---|
committer | Andreas Hansson <andreas.hansson@arm.com> | 2014-08-13 06:57:21 -0400 |
commit | 66904b9584e09a9b6b6cb382ba208ec9a527edbe (patch) | |
tree | a4c06f9f82ac4a7a5dd0f7d42e94c4cf3e4f9cdd /src/cpu/pred/bpred_unit.hh | |
parent | 94daae6864769ffc5fff037dd18b2e8062ee672d (diff) | |
download | gem5-66904b9584e09a9b6b6cb382ba208ec9a527edbe.tar.xz |
cpu: Modernise the branch predictor (STL and C++11)
This patch does some minor house keeping of the branch predictor by
adopting STL containers, and shifting some iterator to use range-based
for loops.
The predictor history is also changed from a list to a deque as we
never to insertion/deletion other than at the front and back.
Diffstat (limited to 'src/cpu/pred/bpred_unit.hh')
-rw-r--r-- | src/cpu/pred/bpred_unit.hh | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/cpu/pred/bpred_unit.hh b/src/cpu/pred/bpred_unit.hh index 0bc0d1569..61b375f9b 100644 --- a/src/cpu/pred/bpred_unit.hh +++ b/src/cpu/pred/bpred_unit.hh @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2012 ARM Limited + * Copyright (c) 2011-2012, 2014 ARM Limited * Copyright (c) 2010 The University of Edinburgh * All rights reserved * @@ -47,7 +47,7 @@ #ifndef __CPU_PRED_BPRED_UNIT_HH__ #define __CPU_PRED_BPRED_UNIT_HH__ -#include <list> +#include <deque> #include "base/statistics.hh" #include "base/types.hh" @@ -244,8 +244,7 @@ class BPredUnit : public SimObject bool wasReturn; }; - typedef std::list<PredictorHistory> History; - typedef History::iterator HistoryIt; + typedef std::deque<PredictorHistory> History; /** Number of the threads for which the branch history is maintained. */ uint32_t numThreads; @@ -255,13 +254,13 @@ class BPredUnit : public SimObject * as instructions are committed, or restore it to the proper state after * a squash. */ - History *predHist; + std::vector<History> predHist; /** The BTB. */ DefaultBTB BTB; /** The per-thread return address stack. */ - ReturnAddrStack *RAS; + std::vector<ReturnAddrStack> RAS; /** Stat for number of BP lookups. */ Stats::Scalar lookups; |