1/* 2 * Copyright (c) 2014 The University of Wisconsin 3 * 4 * Copyright (c) 2006 INRIA (Institut National de Recherche en 5 * Informatique et en Automatique / French National Research Institute 6 * for Computer Science and Applied Mathematics) 7 * 8 * All rights reserved. --- 52 unchanged lines hidden (view full) --- 61 62class LTAGE: public TAGE 63{ 64 public: 65 LTAGE(const LTAGEParams *params); 66 67 // Base class methods. 68 void squash(ThreadID tid, void *bp_history) override; |
69 void update(ThreadID tid, Addr branch_addr, bool taken, void *bp_history, 70 bool squashed, const StaticInstPtr & inst, 71 Addr corrTarget) override; |
72 73 void regStats() override; 74 75 private: 76 // Prediction Structures 77 // Loop Predictor Entry 78 struct LoopEntry 79 { --- 6 unchanged lines hidden (view full) --- 86 bool dir; // only for useDirectionBit 87 88 LoopEntry() : numIter(0), currentIter(0), currentIterSpec(0), 89 confidence(0), tag(0), age(0), dir(0) { } 90 }; 91 92 // more provider types 93 enum { |
94 LOOP = TAGEBase::LAST_TAGE_PROVIDER_TYPE + 1 |
95 }; 96 97 // Primary branch history entry 98 struct LTageBranchInfo : public TageBranchInfo 99 { 100 uint16_t loopTag; 101 uint16_t currentIter; 102 103 bool loopPred; 104 bool loopPredValid; 105 int loopIndex; 106 int loopLowPcBits; // only for useHashing 107 int loopHit; 108 |
109 LTageBranchInfo(TAGEBase &tage) 110 : TageBranchInfo(tage), |
111 loopTag(0), currentIter(0), 112 loopPred(false), 113 loopPredValid(false), loopIndex(0), loopLowPcBits(0), loopHit(0) 114 {} |
115 116 virtual ~LTageBranchInfo() 117 {} |
118 }; 119 120 /** 121 * Computes the index used to access the 122 * loop predictor. 123 * @param pc_in The unshifted branch PC. 124 */ 125 int lindex(Addr pc_in) const; --- 32 unchanged lines hidden (view full) --- 158 * iteration count (only for useSpeculation). 159 * @param taken The predicted branch outcome. 160 * @param bi Pointer to information on the prediction 161 * recorded at prediction time. 162 */ 163 void specLoopUpdate(bool taken, LTageBranchInfo* bi); 164 165 /** |
166 * Get a branch prediction from LTAGE. *NOT* an override of 167 * BpredUnit::predict(). 168 * @param tid The thread ID to select the global 169 * histories to use. 170 * @param branch_pc The unshifted branch PC. 171 * @param cond_branch True if the branch is conditional. 172 * @param b Reference to wrapping pointer to allow storing 173 * derived class prediction information in the base class. 174 */ 175 bool predict( 176 ThreadID tid, Addr branch_pc, bool cond_branch, void* &b) override; 177 178 /** 179 * Restores speculatively updated path and direction histories. 180 * Also recomputes compressed (folded) histories based on the 181 * correct branch outcome. |
182 * @param bi Branch information. |
183 */ |
184 void squashLoop(LTageBranchInfo * bi); |
185 |
186 const unsigned logSizeLoopPred; 187 const unsigned loopTableAgeBits; 188 const unsigned loopTableConfidenceBits; 189 const unsigned loopTableTagBits; 190 const unsigned loopTableIterBits; 191 const unsigned logLoopTableAssoc; 192 const uint8_t confidenceThreshold; 193 const uint16_t loopTagMask; --- 18 unchanged lines hidden --- |