Lines Matching refs:bi

183 TAGEBase::btbUpdate(ThreadID tid, Addr branch_pc, BranchInfo* &bi)
191 tHist.computeIndices[i].comp = bi->ci[i];
192 tHist.computeTags[0][i].comp = bi->ct0[i];
193 tHist.computeTags[1][i].comp = bi->ct1[i];
288 TAGEBase::getBimodePred(Addr pc, BranchInfo* bi) const
290 return btablePrediction[bi->bimodalIndex];
297 TAGEBase::baseUpdate(Addr pc, bool taken, BranchInfo* bi)
299 int inter = (btablePrediction[bi->bimodalIndex] << 1)
300 + btableHysteresis[bi->bimodalIndex >> logRatioBiModalHystEntries];
309 btablePrediction[bi->bimodalIndex] = pred;
310 btableHysteresis[bi->bimodalIndex >> logRatioBiModalHystEntries] = hyst;
336 BranchInfo* bi)
341 bi->tableIndices[i] = tableIndices[i];
343 bi->tableTags[i] = tableTags[i];
348 TAGEBase::getUseAltIdx(BranchInfo* bi, Addr branch_pc)
356 bool cond_branch, BranchInfo* bi)
364 calculateIndicesAndTags(tid, pc, bi);
366 bi->bimodalIndex = bindex(pc);
368 bi->hitBank = 0;
369 bi->altBank = 0;
374 bi->hitBank = i;
375 bi->hitBankIndex = tableIndices[bi->hitBank];
380 for (int i = bi->hitBank - 1; i > 0; i--) {
383 bi->altBank = i;
384 bi->altBankIndex = tableIndices[bi->altBank];
389 if (bi->hitBank > 0) {
390 if (bi->altBank > 0) {
391 bi->altTaken =
392 gtable[bi->altBank][tableIndices[bi->altBank]].ctr >= 0;
393 extraAltCalc(bi);
395 bi->altTaken = getBimodePred(pc, bi);
398 bi->longestMatchPred =
399 gtable[bi->hitBank][tableIndices[bi->hitBank]].ctr >= 0;
400 bi->pseudoNewAlloc =
401 abs(2 * gtable[bi->hitBank][bi->hitBankIndex].ctr + 1) <= 1;
406 if ((useAltPredForNewlyAllocated[getUseAltIdx(bi, branch_pc)] < 0)
407 || ! bi->pseudoNewAlloc) {
408 bi->tagePred = bi->longestMatchPred;
409 bi->provider = TAGE_LONGEST_MATCH;
411 bi->tagePred = bi->altTaken;
412 bi->provider = bi->altBank ? TAGE_ALT_MATCH
416 bi->altTaken = getBimodePred(pc, bi);
417 bi->tagePred = bi->altTaken;
418 bi->longestMatchPred = bi->altTaken;
419 bi->provider = BIMODAL_ONLY;
423 pred_taken = (bi->tagePred);
425 branch_pc, pred_taken, bi->tagePred, bi->altTaken);
427 bi->branchPC = branch_pc;
428 bi->condBranch = cond_branch;
439 TAGEBase::handleAllocAndUReset(bool alloc, bool taken, BranchInfo* bi,
445 for (int i = nHistoryTables; i > bi->hitBank; i--) {
446 if (gtable[i][bi->tableIndices[i]].u < min) {
447 min = gtable[i][bi->tableIndices[i]].u;
455 ((ULL(1) << (nHistoryTables - bi->hitBank - 1)) - 1);
456 int X = bi->hitBank + 1;
464 gtable[X][bi->tableIndices[X]].u = 0;
471 if ((gtable[i][bi->tableIndices[i]].u == 0)) {
472 gtable[i][bi->tableIndices[i]].tag = bi->tableTags[i];
473 gtable[i][bi->tableIndices[i]].ctr = (taken) ? 0 : -1;
510 BranchInfo* bi, int nrand, Addr corrTarget, bool pred, bool preAdjustAlloc)
514 bool alloc = (bi->tagePred != taken) && (bi->hitBank < nHistoryTables);
520 if (bi->hitBank > 0) {
523 bool PseudoNewAlloc = bi->pseudoNewAlloc;
527 if (bi->longestMatchPred == taken) {
532 if (bi->longestMatchPred != bi->altTaken) {
534 useAltPredForNewlyAllocated[getUseAltIdx(bi, branch_pc)],
535 bi->altTaken == taken, useAltOnNaBits);
544 handleAllocAndUReset(alloc, taken, bi, nrand);
546 handleTAGEUpdate(branch_pc, taken, bi);
550 TAGEBase::handleTAGEUpdate(Addr branch_pc, bool taken, BranchInfo* bi)
552 if (bi->hitBank > 0) {
554 bi->hitBank, bi->hitBankIndex, branch_pc);
555 ctrUpdate(gtable[bi->hitBank][bi->hitBankIndex].ctr, taken,
559 if (gtable[bi->hitBank][bi->hitBankIndex].u == 0) {
560 if (bi->altBank > 0) {
561 ctrUpdate(gtable[bi->altBank][bi->altBankIndex].ctr, taken,
564 " branch %lx\n", bi->hitBank, bi->hitBankIndex,
567 if (bi->altBank == 0) {
568 baseUpdate(branch_pc, taken, bi);
573 if (bi->tagePred != bi->altTaken) {
574 unsignedCtrUpdate(gtable[bi->hitBank][bi->hitBankIndex].u,
575 bi->tagePred == taken, tagTableUBits);
578 baseUpdate(branch_pc, taken, bi);
584 BranchInfo* bi, bool speculative,
600 bi->ptGhist = tHist.ptGhist;
601 bi->pathHist = tHist.pathHist;
608 bi->ci[i] = tHist.computeIndices[i].comp;
609 bi->ct0[i] = tHist.computeTags[0][i].comp;
610 bi->ct1[i] = tHist.computeTags[1][i].comp;
624 TAGEBase::squash(ThreadID tid, bool taken, TAGEBase::BranchInfo *bi,
634 "pointer:%d\n", bi->branchPC,taken, bi->pathHist, bi->ptGhist);
635 tHist.pathHist = bi->pathHist;
636 tHist.ptGhist = bi->ptGhist;
640 tHist.computeIndices[i].comp = bi->ci[i];
641 tHist.computeTags[0][i].comp = bi->ct0[i];
642 tHist.computeTags[1][i].comp = bi->ct1[i];
650 TAGEBase::extraAltCalc(BranchInfo* bi)
657 TAGEBase::updateStats(bool taken, BranchInfo* bi)
659 if (taken == bi->tagePred) {
661 switch (bi->provider) {
669 switch (bi->provider) {
673 if (bi->altTaken == taken) {
685 switch (bi->provider) {
688 if (bi->longestMatchPred == taken) {
694 switch (bi->provider) {
697 tageLongestMatchProvider[bi->hitBank]++;
698 tageAltMatchProvider[bi->altBank]++;
704 TAGEBase::getGHR(ThreadID tid, BranchInfo *bi) const
709 int gh_offset = bi->ptGhist + i;