bpred_unit.cc (11783:f94c14fd6561) | bpred_unit.cc (13626:d6a6358aa6db) |
---|---|
1/* 2 * Copyright (c) 2011-2012, 2014 ARM Limited 3 * Copyright (c) 2010 The University of Edinburgh 4 * Copyright (c) 2012 Mark D. Hill and David A. Wood 5 * All rights reserved 6 * 7 * The license below extends only to copyright in the software and shall 8 * not be construed as granting a license to any other intellectual --- 196 unchanged lines hidden (view full) --- 205 DPRINTF(Branch, "[tid:%i]: [sn:%i] Branch predictor" 206 " predicted %i for PC %s\n", tid, seqNum, pred_taken, pc); 207 } 208 209 DPRINTF(Branch, "[tid:%i]: [sn:%i] Creating prediction history " 210 "for PC %s\n", tid, seqNum, pc); 211 212 PredictorHistory predict_record(seqNum, pc.instAddr(), | 1/* 2 * Copyright (c) 2011-2012, 2014 ARM Limited 3 * Copyright (c) 2010 The University of Edinburgh 4 * Copyright (c) 2012 Mark D. Hill and David A. Wood 5 * All rights reserved 6 * 7 * The license below extends only to copyright in the software and shall 8 * not be construed as granting a license to any other intellectual --- 196 unchanged lines hidden (view full) --- 205 DPRINTF(Branch, "[tid:%i]: [sn:%i] Branch predictor" 206 " predicted %i for PC %s\n", tid, seqNum, pred_taken, pc); 207 } 208 209 DPRINTF(Branch, "[tid:%i]: [sn:%i] Creating prediction history " 210 "for PC %s\n", tid, seqNum, pc); 211 212 PredictorHistory predict_record(seqNum, pc.instAddr(), |
213 pred_taken, bp_history, tid); | 213 pred_taken, bp_history, tid, inst); |
214 215 // Now lookup in the BTB or RAS. 216 if (pred_taken) { 217 if (inst->isReturn()) { 218 ++usedRAS; 219 predict_record.wasReturn = true; 220 // If it's a function return call, then look up the address 221 // in the RAS. --- 82 unchanged lines hidden (view full) --- 304 } 305 } 306 } else { 307 if (inst->isReturn()) { 308 predict_record.wasReturn = true; 309 } 310 TheISA::advancePC(target, inst); 311 } | 214 215 // Now lookup in the BTB or RAS. 216 if (pred_taken) { 217 if (inst->isReturn()) { 218 ++usedRAS; 219 predict_record.wasReturn = true; 220 // If it's a function return call, then look up the address 221 // in the RAS. --- 82 unchanged lines hidden (view full) --- 304 } 305 } 306 } else { 307 if (inst->isReturn()) { 308 predict_record.wasReturn = true; 309 } 310 TheISA::advancePC(target, inst); 311 } |
312 predict_record.target = target.instAddr(); |
|
312 313 pc = target; 314 315 predHist[tid].push_front(predict_record); 316 317 DPRINTF(Branch, "[tid:%i]: [sn:%i]: History entry added." 318 "predHist.size(): %i\n", tid, seqNum, predHist[tid].size()); 319 --- 7 unchanged lines hidden (view full) --- 327 "[sn:%lli].\n", tid, done_sn); 328 329 iPred.commit(done_sn, tid); 330 while (!predHist[tid].empty() && 331 predHist[tid].back().seqNum <= done_sn) { 332 // Update the branch predictor with the correct results. 333 update(tid, predHist[tid].back().pc, 334 predHist[tid].back().predTaken, | 313 314 pc = target; 315 316 predHist[tid].push_front(predict_record); 317 318 DPRINTF(Branch, "[tid:%i]: [sn:%i]: History entry added." 319 "predHist.size(): %i\n", tid, seqNum, predHist[tid].size()); 320 --- 7 unchanged lines hidden (view full) --- 328 "[sn:%lli].\n", tid, done_sn); 329 330 iPred.commit(done_sn, tid); 331 while (!predHist[tid].empty() && 332 predHist[tid].back().seqNum <= done_sn) { 333 // Update the branch predictor with the correct results. 334 update(tid, predHist[tid].back().pc, 335 predHist[tid].back().predTaken, |
335 predHist[tid].back().bpHistory, false); | 336 predHist[tid].back().bpHistory, false, 337 predHist[tid].back().inst, 338 predHist[tid].back().target); |
336 337 predHist[tid].pop_back(); 338 } 339} 340 341void 342BPredUnit::squash(const InstSeqNum &squashed_sn, ThreadID tid) 343{ --- 91 unchanged lines hidden (view full) --- 435 // be on the wrong path (i.e., OoO execution), and that the counter 436 // counter table(s) should not be updated. Thus, this call should 437 // restore the state of the underlying predictor, for instance the 438 // local/global histories. The counter tables will be updated when 439 // the branch actually commits. 440 441 // Remember the correct direction for the update at commit. 442 pred_hist.front().predTaken = actually_taken; | 339 340 predHist[tid].pop_back(); 341 } 342} 343 344void 345BPredUnit::squash(const InstSeqNum &squashed_sn, ThreadID tid) 346{ --- 91 unchanged lines hidden (view full) --- 438 // be on the wrong path (i.e., OoO execution), and that the counter 439 // counter table(s) should not be updated. Thus, this call should 440 // restore the state of the underlying predictor, for instance the 441 // local/global histories. The counter tables will be updated when 442 // the branch actually commits. 443 444 // Remember the correct direction for the update at commit. 445 pred_hist.front().predTaken = actually_taken; |
446 pred_hist.front().target = corrTarget.instAddr(); |
|
443 444 update(tid, (*hist_it).pc, actually_taken, | 447 448 update(tid, (*hist_it).pc, actually_taken, |
445 pred_hist.front().bpHistory, true); | 449 pred_hist.front().bpHistory, true, pred_hist.front().inst, 450 corrTarget.instAddr()); |
446 447 if (actually_taken) { 448 if (hist_it->wasReturn && !hist_it->usedRAS) { 449 DPRINTF(Branch, "[tid: %i] Incorrectly predicted" 450 " return [sn:%i] PC: %s\n", tid, hist_it->seqNum, 451 hist_it->pc); 452 RAS[tid].pop(); 453 hist_it->usedRAS = true; --- 60 unchanged lines hidden --- | 451 452 if (actually_taken) { 453 if (hist_it->wasReturn && !hist_it->usedRAS) { 454 DPRINTF(Branch, "[tid: %i] Incorrectly predicted" 455 " return [sn:%i] PC: %s\n", tid, hist_it->seqNum, 456 hist_it->pc); 457 RAS[tid].pop(); 458 hist_it->usedRAS = true; --- 60 unchanged lines hidden --- |