cpu-minor: Ensure the pc in BranchData is always set.
Change the type passed to updateBranchData in execute to be a reference, and replace the nullptr being passed in from Execute::evaluate() with the current thread's pc. We could use any generic PC instead which might be slightly faster, but there is likely not a significant difference and this is a lot easier. Change-Id: I306ca53b33997f76217c61123e5922df612005f9 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/53584 Maintainer: Gabe Black <gabe.black@gmail.com> Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -296,14 +296,14 @@ Execute::tryToBranch(MinorDynInstPtr inst, Fault fault, BranchData &branch)
|
||||
reason = BranchData::NoBranch;
|
||||
}
|
||||
|
||||
updateBranchData(inst->id.threadId, reason, inst, target.get(), branch);
|
||||
updateBranchData(inst->id.threadId, reason, inst, *target, branch);
|
||||
}
|
||||
|
||||
void
|
||||
Execute::updateBranchData(
|
||||
ThreadID tid,
|
||||
BranchData::Reason reason,
|
||||
MinorDynInstPtr inst, const PCStateBase *target,
|
||||
MinorDynInstPtr inst, const PCStateBase &target,
|
||||
BranchData &branch)
|
||||
{
|
||||
if (reason != BranchData::NoBranch) {
|
||||
@@ -443,7 +443,7 @@ Execute::takeInterrupt(ThreadID thread_id, BranchData &branch)
|
||||
/* Assume that an interrupt *must* cause a branch. Assert this? */
|
||||
|
||||
updateBranchData(thread_id, BranchData::Interrupt,
|
||||
MinorDynInst::bubble(), &cpu.getContext(thread_id)->pcState(),
|
||||
MinorDynInst::bubble(), cpu.getContext(thread_id)->pcState(),
|
||||
branch);
|
||||
}
|
||||
|
||||
@@ -1032,7 +1032,7 @@ Execute::commitInst(MinorDynInstPtr inst, bool early_memory_issue,
|
||||
cpu.stats.numFetchSuspends++;
|
||||
|
||||
updateBranchData(thread_id, BranchData::SuspendThread, inst,
|
||||
&resume_pc, branch);
|
||||
resume_pc, branch);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1140,7 +1140,7 @@ Execute::commit(ThreadID thread_id, bool only_commit_microops, bool discard,
|
||||
|
||||
/* Branch as there was a change in PC */
|
||||
updateBranchData(thread_id, BranchData::UnpredictedBranch,
|
||||
MinorDynInst::bubble(), &thread->pcState(), branch);
|
||||
MinorDynInst::bubble(), thread->pcState(), branch);
|
||||
} else if (mem_response &&
|
||||
num_mem_refs_committed < memoryCommitLimit)
|
||||
{
|
||||
@@ -1495,7 +1495,8 @@ Execute::evaluate()
|
||||
* the bag */
|
||||
if (commit_info.drainState == DrainHaltFetch) {
|
||||
updateBranchData(commit_tid, BranchData::HaltFetch,
|
||||
MinorDynInst::bubble(), nullptr, branch);
|
||||
MinorDynInst::bubble(),
|
||||
cpu.getContext(commit_tid)->pcState(), branch);
|
||||
|
||||
cpu.wakeupOnEvent(Pipeline::ExecuteStageId);
|
||||
setDrainState(commit_tid, DrainAllInsts);
|
||||
|
||||
Reference in New Issue
Block a user