Skip to content

Commit 58e3e9c

Browse files
committed
cpu: remove formatting-only noise
Change-Id: I42a952354920e21486a1b692f9abde770880dfe3
1 parent be726a6 commit 58e3e9c

11 files changed

Lines changed: 596 additions & 774 deletions

File tree

src/cpu/pred/btb/btb_ittage.cc

Lines changed: 114 additions & 77 deletions
Large diffs are not rendered by default.

src/cpu/pred/btb/btb_ittage.hh

Lines changed: 54 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -30,91 +30,74 @@ class BTBITTAGE : public TimedBaseBTBPredictor
3030
{
3131
using defer = std::shared_ptr<void>;
3232
using bitset = boost::dynamic_bitset<>;
33-
3433
public:
3534
typedef BTBITTAGEParams Params;
3635

3736
struct TageEntry
3837
{
39-
public:
40-
bool valid;
41-
Addr tag;
42-
Addr target;
43-
short counter;
44-
bool useful;
45-
Addr pc; // TODO: should use lowest bits only
46-
47-
TageEntry() : valid(false), tag(0), target(0), counter(0), useful(false), pc(0) {}
48-
49-
TageEntry(Addr tag, Addr target, short counter, Addr pc)
50-
: valid(true), tag(tag), target(target), counter(counter), useful(false), pc(pc)
51-
{
52-
}
53-
bool taken() { return counter >= 2; }
38+
public:
39+
bool valid;
40+
Addr tag;
41+
Addr target;
42+
short counter;
43+
bool useful;
44+
Addr pc; // TODO: should use lowest bits only
45+
46+
TageEntry() : valid(false), tag(0), target(0), counter(0), useful(false), pc(0) {}
47+
48+
TageEntry(Addr tag, Addr target, short counter, Addr pc) :
49+
valid(true), tag(tag), target(target), counter(counter), useful(false), pc(pc) {}
50+
bool taken() {
51+
return counter >= 2;
52+
}
5453
};
5554

5655
struct TageTableInfo
5756
{
58-
public:
59-
bool found;
60-
TageEntry entry;
61-
unsigned table;
62-
Addr index;
63-
Addr tag;
64-
TageTableInfo() : found(false), table(0), index(0), tag(0) {}
65-
TageTableInfo(bool found, TageEntry entry, unsigned table, Addr index, Addr tag)
66-
: found(found), entry(entry), table(table), index(index), tag(tag)
67-
{
68-
}
69-
bool taken() { return entry.taken(); }
57+
public:
58+
bool found;
59+
TageEntry entry;
60+
unsigned table;
61+
Addr index;
62+
Addr tag;
63+
TageTableInfo() : found(false), table(0), index(0), tag(0) {}
64+
TageTableInfo(bool found, TageEntry entry, unsigned table, Addr index, Addr tag) :
65+
found(found), entry(entry), table(table), index(index), tag(tag) {}
66+
bool taken() { return entry.taken(); }
7067
};
7168

7269
struct TagePrediction
7370
{
74-
public:
75-
Addr btb_pc;
76-
TageTableInfo mainInfo;
77-
TageTableInfo altInfo;
71+
public:
72+
Addr btb_pc;
73+
TageTableInfo mainInfo;
74+
TageTableInfo altInfo;
7875

79-
bool useAlt;
80-
// bitset usefulMask;
81-
// bool taken;
82-
Addr target;
76+
bool useAlt;
77+
// bitset usefulMask;
78+
// bool taken;
79+
Addr target;
8380

84-
TagePrediction() : btb_pc(0), useAlt(false), target(0) {}
81+
TagePrediction() : btb_pc(0), useAlt(false), target(0) {}
82+
83+
TagePrediction(Addr btb_pc, TageTableInfo mainInfo, TageTableInfo altInfo,
84+
bool useAlt, Addr target) :
85+
btb_pc(btb_pc), mainInfo(mainInfo), altInfo(altInfo),
86+
useAlt(useAlt), target(target) {}
8587

86-
TagePrediction(Addr btb_pc, TageTableInfo mainInfo, TageTableInfo altInfo, bool useAlt, Addr target)
87-
: btb_pc(btb_pc), mainInfo(mainInfo), altInfo(altInfo), useAlt(useAlt), target(target)
88-
{
89-
}
9088
};
9189

9290
public:
93-
BTBITTAGE(const Params &p);
91+
BTBITTAGE(const Params& p);
9492

9593
void tickStart() override;
9694

9795
void tick() override;
9896
void dryRunCycle(Addr startAddr) override;
9997
// make predictions, record in stage preds
100-
void putPCHistory(Addr startAddr, const boost::dynamic_bitset<> &history,
98+
void putPCHistory(Addr startAddr,
99+
const boost::dynamic_bitset<> &history,
101100
std::vector<FullBTBPrediction> &stagePreds) override;
102-
void putPCHistoryForBlock1(Addr startAddr, const boost::dynamic_bitset<> &history,
103-
const boost::dynamic_bitset<> &phistory, const boost::dynamic_bitset<> &bwhistory,
104-
const std::vector<boost::dynamic_bitset<>> &lhistory,
105-
std::vector<FullBTBPrediction> &stagePreds, const FullBTBPrediction &lowerPred) override
106-
{
107-
(void)phistory;
108-
(void)bwhistory;
109-
(void)lhistory;
110-
if (!participatesInBlock1()) {
111-
for (int s = getDelay(); s < stagePreds.size(); s++) {
112-
stagePreds[s].indirectTargets = lowerPred.indirectTargets;
113-
}
114-
return;
115-
}
116-
putPCHistory(startAddr, history, stagePreds);
117-
}
118101

119102
std::shared_ptr<void> getPredictionMeta() override;
120103

@@ -124,8 +107,8 @@ class BTBITTAGE : public TimedBaseBTBPredictor
124107

125108
// Recover 3 folded history after a misprediction, then update 3 folded history according to history and pred.taken
126109
// the other recoverHist methods are left blank
127-
void recoverPHist(const boost::dynamic_bitset<> &history, const FetchTarget &entry, int shamt,
128-
bool cond_taken) override;
110+
void recoverPHist(const boost::dynamic_bitset<> &history,
111+
const FetchTarget &entry,int shamt, bool cond_taken) override;
129112

130113
void update(const FetchTarget &entry) override;
131114

@@ -135,8 +118,9 @@ class BTBITTAGE : public TimedBaseBTBPredictor
135118
void checkFoldedHist(const bitset &history, const char *when);
136119

137120
private:
121+
138122
// return provided
139-
void lookupHelper(Addr stream_start, const std::vector<BTBEntry> &btbEntries, IndirectTargets &results);
123+
void lookupHelper(Addr stream_start, const std::vector<BTBEntry> &btbEntries, IndirectTargets& results);
140124

141125
// use blockPC
142126
Addr getTageIndex(Addr pc, int table);
@@ -150,7 +134,9 @@ class BTBITTAGE : public TimedBaseBTBPredictor
150134
// use blockPC (uint64_t version for performance)
151135
Addr getTageTag(Addr pc, int table, uint64_t foldedHist, uint64_t altFoldedHist);
152136

153-
Addr getOffset(Addr pc) { return (pc & (blockSize - 1)) >> 1; }
137+
Addr getOffset(Addr pc) {
138+
return (pc & (blockSize - 1)) >> 1;
139+
}
154140

155141
// Update branch history
156142
void doUpdateHist(const bitset &history, bool taken, Addr pc, Addr target);
@@ -188,7 +174,7 @@ class BTBITTAGE : public TimedBaseBTBPredictor
188174

189175
unsigned numBr;
190176

191-
unsigned instShiftAmt{1};
177+
unsigned instShiftAmt {1};
192178

193179
void updateCounter(bool taken, unsigned width, short &counter);
194180

@@ -229,7 +215,7 @@ class BTBITTAGE : public TimedBaseBTBPredictor
229215
statistics::Distribution updateTableHits;
230216

231217
int numPredictors;
232-
IttageStats(statistics::Group *parent, int numPredictors);
218+
IttageStats(statistics::Group* parent, int numPredictors);
233219
#endif
234220
Scalar commitHits;
235221
Scalar callHits;
@@ -277,12 +263,13 @@ class BTBITTAGE : public TimedBaseBTBPredictor
277263

278264
std::shared_ptr<TageMeta> meta;
279265

280-
public:
266+
public:
267+
281268
Addr debugPC = 0;
282269
Addr debugPC2 = 0;
283270
bool debugFlag = false;
284271

285-
void recoverFoldedHist(const bitset &history);
272+
void recoverFoldedHist(const bitset& history);
286273
bool tageHit();
287274

288275
// void checkFoldedHist(const bitset& history);

src/cpu/pred/btb/btb_tage.cc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,25 @@ BTBTAGE::putPCHistory(Addr startPC, const bitset &history, std::vector<FullBTBPr
381381
}
382382
}
383383

384+
void
385+
BTBTAGE::putPCHistoryForBlock1(Addr startAddr, const boost::dynamic_bitset<> &history,
386+
const boost::dynamic_bitset<> &phistory, const boost::dynamic_bitset<> &bwhistory,
387+
const std::vector<boost::dynamic_bitset<>> &lhistory,
388+
std::vector<FullBTBPrediction> &stagePreds, const FullBTBPrediction &lowerPred)
389+
{
390+
(void)phistory;
391+
(void)bwhistory;
392+
(void)lhistory;
393+
if (!participatesInBlock1()) {
394+
for (int s = getDelay(); s < stagePreds.size(); s++) {
395+
stagePreds[s].condTakens = lowerPred.condTakens;
396+
stagePreds[s].tageInfoForMgscs = lowerPred.tageInfoForMgscs;
397+
}
398+
return;
399+
}
400+
putPCHistory(startAddr, history, stagePreds);
401+
}
402+
384403
std::shared_ptr<void>
385404
BTBTAGE::getPredictionMeta()
386405
{

src/cpu/pred/btb/btb_tage.hh

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,15 @@
1414
#include "cpu/pred/btb/folded_hist.hh"
1515
#include "cpu/pred/btb/timed_base_pred.hh"
1616

17+
// Conditional includes based on build mode
1718
#ifdef UNIT_TEST
1819
#include "cpu/pred/btb/test/test_dprintf.hh"
19-
2020
#else
2121
#include "debug/DecoupleBP.hh"
2222
#include "debug/TAGEHistory.hh"
2323
#include "debug/TAGEUseful.hh"
2424
#include "params/BTBTAGE.hh"
2525
#include "sim/sim_object.hh"
26-
2726
#endif
2827

2928
namespace gem5
@@ -131,20 +130,8 @@ class BTBTAGE : public TimedBaseBTBPredictor
131130
void putPCHistoryForBlock1(Addr startAddr, const boost::dynamic_bitset<> &history,
132131
const boost::dynamic_bitset<> &phistory, const boost::dynamic_bitset<> &bwhistory,
133132
const std::vector<boost::dynamic_bitset<>> &lhistory,
134-
std::vector<FullBTBPrediction> &stagePreds, const FullBTBPrediction &lowerPred) override
135-
{
136-
(void)phistory;
137-
(void)bwhistory;
138-
(void)lhistory;
139-
if (!participatesInBlock1()) {
140-
for (int s = getDelay(); s < stagePreds.size(); s++) {
141-
stagePreds[s].condTakens = lowerPred.condTakens;
142-
stagePreds[s].tageInfoForMgscs = lowerPred.tageInfoForMgscs;
143-
}
144-
return;
145-
}
146-
putPCHistory(startAddr, history, stagePreds);
147-
}
133+
std::vector<FullBTBPrediction> &stagePreds,
134+
const FullBTBPrediction &lowerPred) override;
148135

149136
std::shared_ptr<void> getPredictionMeta() override;
150137

src/cpu/pred/btb/btb_ubtb.hh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ namespace test
8282

8383
class UBTB : public TimedBaseBTBPredictor
8484
{
85-
private:
8685
public:
8786
#ifdef UNIT_TEST
8887
UBTB(unsigned numEntries, unsigned tagBits);

0 commit comments

Comments
 (0)