cpu: Add a StaticInst::advancePC which takes a ThreadContext.
This will avoid having to create a new heap allocated PCState, since the instruction will know what type of backing storage to allocate on the stack for the working copy. Change-Id: Id208e015f6cb764bf7b13e0faf1677278b7e4641 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/52069 Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br> Maintainer: Gabe Black <gabe.black@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -74,10 +74,8 @@ Checker<DynInstPtr>::advancePC(const Fault &fault)
|
||||
if (curStaticInst) {
|
||||
if (curStaticInst->isLastMicroop())
|
||||
curMacroStaticInst = nullStaticInstPtr;
|
||||
std::unique_ptr<PCStateBase> pc_ptr(thread->pcState().clone());
|
||||
curStaticInst->advancePC(*pc_ptr);
|
||||
thread->pcState(*pc_ptr);
|
||||
DPRINTF(Checker, "Advancing PC to %s.\n", *pc_ptr);
|
||||
curStaticInst->advancePC(thread);
|
||||
DPRINTF(Checker, "Advancing PC to %s.\n", thread->pcState());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -474,9 +474,7 @@ BaseSimpleCPU::advancePC(const Fault &fault)
|
||||
if (curStaticInst) {
|
||||
if (curStaticInst->isLastMicroop())
|
||||
curMacroStaticInst = nullStaticInstPtr;
|
||||
std::unique_ptr<PCStateBase> pc(thread->pcState().clone());
|
||||
curStaticInst->advancePC(*pc);
|
||||
thread->pcState(*pc);
|
||||
curStaticInst->advancePC(thread);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "cpu/thread_context.hh"
|
||||
|
||||
namespace gem5
|
||||
{
|
||||
|
||||
@@ -82,4 +84,12 @@ StaticInst::printFlags(std::ostream &outs,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
StaticInst::advancePC(ThreadContext *tc) const
|
||||
{
|
||||
std::unique_ptr<PCStateBase> pc(tc->pcState().clone());
|
||||
advancePC(*pc);
|
||||
tc->pcState(*pc);
|
||||
}
|
||||
|
||||
} // namespace gem5
|
||||
|
||||
@@ -320,6 +320,7 @@ class StaticInst : public RefCounted, public StaticInstFlags
|
||||
}
|
||||
|
||||
virtual void advancePC(PCStateBase &pc_state) const = 0;
|
||||
virtual void advancePC(ThreadContext *tc) const;
|
||||
|
||||
virtual std::unique_ptr<PCStateBase>
|
||||
buildRetPC(const PCStateBase &cur_pc, const PCStateBase &call_pc) const
|
||||
|
||||
Reference in New Issue
Block a user