Gabe Black has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/52069 )
Change subject: cpu: Add a StaticInst::advancePC which takes a
ThreadContext.
......................................................................
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
heap for the working copy.
Change-Id: Id208e015f6cb764bf7b13e0faf1677278b7e4641
---
M src/cpu/checker/cpu_impl.hh
M src/cpu/static_inst.cc
M src/cpu/static_inst.hh
M src/cpu/simple/base.cc
4 files changed, 27 insertions(+), 7 deletions(-)
diff --git a/src/cpu/checker/cpu_impl.hh b/src/cpu/checker/cpu_impl.hh
index 83dbf6b..b157145 100644
--- a/src/cpu/checker/cpu_impl.hh
+++ b/src/cpu/checker/cpu_impl.hh
@@ -74,10 +74,8 @@
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());
}
}
}
diff --git a/src/cpu/simple/base.cc b/src/cpu/simple/base.cc
index 0f11eb9..57bdc59 100644
--- a/src/cpu/simple/base.cc
+++ b/src/cpu/simple/base.cc
@@ -473,9 +473,7 @@
if (curStaticInst) {
if (curStaticInst->isLastMicroop())
curMacroStaticInst = nullStaticInstPtr;
- std::unique_ptr<PCStateBase> pc(thread->pcState().clone());
- curStaticInst->advancePC(*pc);
- thread->pcState(*pc);
+ curStaticInst->advancePC(thread);
}
}
diff --git a/src/cpu/static_inst.cc b/src/cpu/static_inst.cc
index 63a8a7a..17b0132 100644
--- a/src/cpu/static_inst.cc
+++ b/src/cpu/static_inst.cc
@@ -30,6 +30,8 @@
#include <iostream>
+#include "cpu/thread_context.hh"
+
namespace gem5
{
@@ -82,4 +84,12 @@
}
}
+void
+StaticInst::advancePC(ThreadContext *tc) const
+{
+ std::unique_ptr<PCStateBase> pc(tc->pcState().clone());
+ advancePC(*pc);
+ tc->pcState(*pc);
+}
+
} // namespace gem5
diff --git a/src/cpu/static_inst.hh b/src/cpu/static_inst.hh
index 1213eeb..3e6357b 100644
--- a/src/cpu/static_inst.hh
+++ b/src/cpu/static_inst.hh
@@ -320,6 +320,7 @@
}
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
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/52069
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Id208e015f6cb764bf7b13e0faf1677278b7e4641
Gerrit-Change-Number: 52069
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <gabe.bl...@gmail.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s