riscv,x86: Stop using the arch Nop machine instruction unnecessarily.

That particular ExtMachInst is a convenient placeholder, but a value
of 0 in RISCV or a static uninitialized ExtMachInst (which will
therefore be all zeroes) on x86 works just as well, and removes the
need for an ISA specific constant.

Also, the idea of a universal Nop doesn't always make sense since it
could be that what, exactly, doesn't do anything depends on context
which would be lost on a constant value of an ExtMachInst. For
instance, the value of an ExtMachInst that makes sense might depend on
what mode the CPU was in, etc.

Change-Id: I1f1a43a5c607a667e11b79bcf6e059e4f7141b3f
Reviewed-on: https://gem5-review.googlesource.com/6825
Reviewed-by: Gabe Black <gabeblack@google.com>
Reviewed-by: Alec Roelke <ar4jc@virginia.edu>
Maintainer: Gabe Black <gabeblack@google.com>
This commit is contained in:
Gabe Black
2017-12-20 00:02:47 -08:00
parent b7618c69a5
commit 87eb9a3a64
3 changed files with 10 additions and 4 deletions

View File

@@ -45,7 +45,7 @@ void Decoder::reset()
aligned = true;
mid = false;
more = true;
emi = NoopMachInst;
emi = 0;
instDone = false;
}

View File

@@ -42,14 +42,21 @@
#include "arch/x86/generated/decoder.hh"
#include "arch/x86/isa_traits.hh"
namespace {
static X86ISA::ExtMachInst dummyMachInst;
}
namespace X86ISA
{
// This microop needs to be allocated on the heap even though it could
// theoretically be statically allocated. The reference counted pointer would
// try to delete the static memory when it was destructed.
const StaticInstPtr badMicroop =
new X86ISAInst::MicroPanic(NoopMachInst, "BAD",
new X86ISAInst::MicroPanic(dummyMachInst, "BAD",
StaticInst::IsMicroop | StaticInst::IsLastMicroop,
"Invalid microop!", 0);

View File

@@ -59,8 +59,7 @@ let {{
''' + generatorNameTemplate + '''(StaticInstPtr curMacroop)
{
static const char *macrocodeBlock = romMnemonic;
static const ExtMachInst dummyExtMachInst = \
X86ISA::NoopMachInst;
static ExtMachInst dummyExtMachInst;
static const EmulEnv dummyEmulEnv(0, 0, 1, 1, 1);
Macroop * macroop = dynamic_cast<Macroop *>(curMacroop.get());