Gabe Black has submitted this change and it was merged. (
https://gem5-review.googlesource.com/6823 )
Change subject: cpu: Add a pointer to a generic Nop StaticInst.
......................................................................
cpu: Add a pointer to a generic Nop StaticInst.
This can be used whenever generic code needs a filler instruction that
doesn't do anything.
Change-Id: Ib245d3e880a951e229eb315a09ecc7c47e6ae00f
Reviewed-on: https://gem5-review.googlesource.com/6823
Reviewed-by: Andreas Sandberg <[email protected]>
Maintainer: Andreas Sandberg <[email protected]>
---
M src/cpu/static_inst.cc
M src/cpu/static_inst.hh
2 files changed, 37 insertions(+), 0 deletions(-)
Approvals:
Andreas Sandberg: Looks good to me, approved; Looks good to me, approved
diff --git a/src/cpu/static_inst.cc b/src/cpu/static_inst.cc
index d50c9f1..cdcd93c 100644
--- a/src/cpu/static_inst.cc
+++ b/src/cpu/static_inst.cc
@@ -35,7 +35,41 @@
#include "sim/core.hh"
+namespace {
+
+static TheISA::ExtMachInst nopMachInst;
+
+class NopStaticInst : public StaticInst
+{
+ public:
+ NopStaticInst() : StaticInst("gem5 nop", nopMachInst, No_OpClass)
+ {}
+
+ Fault
+ execute(ExecContext *xc, Trace::InstRecord *traceData) const override
+ {
+ return NoFault;
+ }
+
+ void
+ advancePC(TheISA::PCState &pcState) const override
+ {
+ pcState.advance();
+ }
+
+ std::string
+ generateDisassembly(Addr pc, const SymbolTable *symtab) const override
+ {
+ return mnemonic;
+ }
+
+ private:
+};
+
+}
+
StaticInstPtr StaticInst::nullStaticInstPtr;
+StaticInstPtr StaticInst::nopStaticInstPtr = new NopStaticInst;
using namespace std;
diff --git a/src/cpu/static_inst.hh b/src/cpu/static_inst.hh
index a4077e1..79f45d8 100644
--- a/src/cpu/static_inst.hh
+++ b/src/cpu/static_inst.hh
@@ -205,6 +205,9 @@
/// Pointer to a statically allocated "null" instruction object.
static StaticInstPtr nullStaticInstPtr;
+ /// Pointer to a statically allocated generic "nop" instruction object.
+ static StaticInstPtr nopStaticInstPtr;
+
/// The binary machine instruction.
const ExtMachInst machInst;
--
To view, visit https://gem5-review.googlesource.com/6823
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib245d3e880a951e229eb315a09ecc7c47e6ae00f
Gerrit-Change-Number: 6823
Gerrit-PatchSet: 3
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev