Deleted Added
sdiff udiff text old ( 3958:58d09260d073 ) new ( 3969:77957f66c1d5 )
full compact
1/*
2 * Copyright (c) 2004-2006 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 466 unchanged lines hidden (view full) ---

475 DPRINTF(IEW, "[tid:%i]: Squashing from a specific instruction, PC: %#x "
476 "[sn:%i].\n", tid, inst->readPC(), inst->seqNum);
477
478 toCommit->squash[tid] = true;
479 toCommit->squashedSeqNum[tid] = inst->seqNum;
480 toCommit->mispredPC[tid] = inst->readPC();
481 toCommit->branchMispredict[tid] = true;
482
483 int instSize = sizeof(TheISA::MachInst);
484#if ISA_HAS_DELAY_SLOT
485 bool branch_taken =
486 !(inst->readNextPC() + instSize == inst->readNextNPC() &&
487 (inst->readNextPC() == inst->readPC() + instSize ||
488 inst->readNextPC() == inst->readPC() + 2 * instSize));
489 DPRINTF(Sparc, "Branch taken = %s [sn:%i]\n",
490 branch_taken ? "true": "false", inst->seqNum);
491
492 toCommit->branchTaken[tid] = branch_taken;

--- 4 unchanged lines hidden (view full) ---

497 squashDelaySlot ? "true": "false", inst->seqNum);
498 toCommit->squashDelaySlot[tid] = squashDelaySlot;
499 //If we're squashing the delay slot, we need to pick back up at NextPC.
500 //Otherwise, NextPC isn't being squashed, so we should pick back up at
501 //NextNPC.
502 if (squashDelaySlot) {
503 toCommit->nextPC[tid] = inst->readNextPC();
504 toCommit->nextNPC[tid] = inst->readNextNPC();
505 } else {
506 toCommit->nextPC[tid] = inst->readNextNPC();
507 toCommit->nextNPC[tid] = inst->readNextNPC() + instSize;
508 }
509#else
510 toCommit->branchTaken[tid] = inst->readNextPC() !=
511 (inst->readPC() + sizeof(TheISA::MachInst));
512 toCommit->nextPC[tid] = inst->readNextPC();
513 toCommit->nextNPC[tid] = inst->readNextPC() + instSize;
514#endif
515
516 toCommit->includeSquashInst[tid] = false;
517
518 wroteToTimeBuffer = true;
519}
520
521template<class Impl>
522void
523DefaultIEW<Impl>::squashDueToMemOrder(DynInstPtr &inst, unsigned tid)
524{
525 DPRINTF(IEW, "[tid:%i]: Squashing from a specific instruction, "
526 "PC: %#x [sn:%i].\n", tid, inst->readPC(), inst->seqNum);
527
528 toCommit->squash[tid] = true;
529 toCommit->squashedSeqNum[tid] = inst->seqNum;
530 toCommit->nextPC[tid] = inst->readNextPC();
531#if ISA_HAS_DELAY_SLOT
532 toCommit->nextNPC[tid] = inst->readNextNPC();
533#else
534 toCommit->nextNPC[tid] = inst->readNextPC() + sizeof(TheISA::MachInst);
535#endif
536 toCommit->branchMispredict[tid] = false;
537
538 toCommit->includeSquashInst[tid] = false;
539
540 wroteToTimeBuffer = true;
541}
542

--- 4 unchanged lines hidden (view full) ---

547 DPRINTF(IEW, "[tid:%i]: Memory blocked, squashing load and younger insts, "
548 "PC: %#x [sn:%i].\n", tid, inst->readPC(), inst->seqNum);
549
550 toCommit->squash[tid] = true;
551 toCommit->squashedSeqNum[tid] = inst->seqNum;
552 toCommit->nextPC[tid] = inst->readPC();
553#if ISA_HAS_DELAY_SLOT
554 toCommit->nextNPC[tid] = inst->readNextPC();
555#else
556 toCommit->nextNPC[tid] = inst->readPC() + sizeof(TheISA::MachInst);
557#endif
558 toCommit->branchMispredict[tid] = false;
559
560 // Must include the broadcasted SN in the squash.
561 toCommit->includeSquashInst[tid] = true;
562
563 ldstQueue.setLoadBlockedHandled(tid);
564

--- 792 unchanged lines hidden (view full) ---

1357
1358 if (!fetchRedirect[tid] ||
1359 toCommit->squashedSeqNum[tid] > inst->seqNum) {
1360
1361 if (inst->mispredicted()) {
1362 fetchRedirect[tid] = true;
1363
1364 DPRINTF(IEW, "Execute: Branch mispredict detected.\n");
1365 DPRINTF(IEW, "Predicted target was %#x, %#x.\n",
1366 inst->readPredPC(), inst->readPredNPC());
1367 DPRINTF(IEW, "Execute: Redirecting fetch to PC: %#x,"
1368 " NPC: %#x.\n", inst->readNextPC(),
1369 inst->readNextNPC());
1370 // If incorrect, then signal the ROB that it must be squashed.
1371 squashDueToBranch(inst, tid);
1372
1373 if (inst->readPredTaken()) {
1374 predictedTakenIncorrect++;
1375 } else {
1376 predictedNotTakenIncorrect++;
1377 }

--- 258 unchanged lines hidden ---