arch: Make some internal decode methods protected.
These methods aren't used outside of the decoder and the decode cache, so they don't need to be public. Change-Id: Ifdaf318995f1bb0a75b390bd1c5fde1211c66e62 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/40102 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br> Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu> Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
This commit is contained in:
@@ -82,6 +82,7 @@ class Decoder : public InstDecoder
|
||||
|
||||
/// A cache of decoded instruction objects.
|
||||
static GenericISA::BasicDecodeCache<Decoder, ExtMachInst> defaultCache;
|
||||
friend class GenericISA::BasicDecodeCache<Decoder, ExtMachInst>;
|
||||
|
||||
/**
|
||||
* Pre-decode an instruction from the current state of the
|
||||
@@ -95,6 +96,38 @@ class Decoder : public InstDecoder
|
||||
*/
|
||||
void consumeBytes(int numBytes);
|
||||
|
||||
/**
|
||||
* Decode a machine instruction without calling the cache.
|
||||
*
|
||||
* @note The implementation of this method is generated by the ISA
|
||||
* parser script.
|
||||
*
|
||||
* @warn This method takes a pre-decoded instruction as its
|
||||
* argument. It should typically not be called directly.
|
||||
*
|
||||
* @param mach_inst The binary instruction to decode.
|
||||
* @retval A pointer to the corresponding StaticInst object.
|
||||
*/
|
||||
StaticInstPtr decodeInst(ExtMachInst mach_inst);
|
||||
|
||||
/**
|
||||
* Decode a pre-decoded machine instruction.
|
||||
*
|
||||
* @warn This method takes a pre-decoded instruction as its
|
||||
* argument. It should typically not be called directly.
|
||||
*
|
||||
* @param mach_inst A pre-decoded instruction
|
||||
* @retval A pointer to the corresponding StaticInst object.
|
||||
*/
|
||||
StaticInstPtr
|
||||
decode(ExtMachInst mach_inst, Addr addr)
|
||||
{
|
||||
StaticInstPtr si = defaultCache.decode(this, mach_inst, addr);
|
||||
DPRINTF(Decode, "Decode: Decoded %s instruction: %#x\n",
|
||||
si->getName(), mach_inst);
|
||||
return si;
|
||||
}
|
||||
|
||||
public: // Decoder API
|
||||
Decoder(ISA* isa = nullptr);
|
||||
|
||||
@@ -161,38 +194,6 @@ class Decoder : public InstDecoder
|
||||
*/
|
||||
StaticInstPtr decode(ArmISA::PCState &pc);
|
||||
|
||||
/**
|
||||
* Decode a pre-decoded machine instruction.
|
||||
*
|
||||
* @warn This method takes a pre-decoded instruction as its
|
||||
* argument. It should typically not be called directly.
|
||||
*
|
||||
* @param mach_inst A pre-decoded instruction
|
||||
* @retval A pointer to the corresponding StaticInst object.
|
||||
*/
|
||||
StaticInstPtr
|
||||
decode(ExtMachInst mach_inst, Addr addr)
|
||||
{
|
||||
StaticInstPtr si = defaultCache.decode(this, mach_inst, addr);
|
||||
DPRINTF(Decode, "Decode: Decoded %s instruction: %#x\n",
|
||||
si->getName(), mach_inst);
|
||||
return si;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode a machine instruction without calling the cache.
|
||||
*
|
||||
* @note The implementation of this method is generated by the ISA
|
||||
* parser script.
|
||||
*
|
||||
* @warn This method takes a pre-decoded instruction as its
|
||||
* argument. It should typically not be called directly.
|
||||
*
|
||||
* @param mach_inst The binary instruction to decode.
|
||||
* @retval A pointer to the corresponding StaticInst object.
|
||||
*/
|
||||
StaticInstPtr decodeInst(ExtMachInst mach_inst);
|
||||
|
||||
/**
|
||||
* Take over the state from an old decoder when switching CPUs.
|
||||
*
|
||||
|
||||
@@ -89,8 +89,8 @@ class Decoder : public InstDecoder
|
||||
protected:
|
||||
/// A cache of decoded instruction objects.
|
||||
static GenericISA::BasicDecodeCache<Decoder, ExtMachInst> defaultCache;
|
||||
friend class GenericISA::BasicDecodeCache<Decoder, ExtMachInst>;
|
||||
|
||||
public:
|
||||
StaticInstPtr decodeInst(ExtMachInst mach_inst);
|
||||
|
||||
/// Decode a machine instruction.
|
||||
@@ -105,6 +105,7 @@ class Decoder : public InstDecoder
|
||||
return si;
|
||||
}
|
||||
|
||||
public:
|
||||
StaticInstPtr
|
||||
decode(MipsISA::PCState &nextPC)
|
||||
{
|
||||
|
||||
@@ -96,8 +96,8 @@ class Decoder : public InstDecoder
|
||||
protected:
|
||||
/// A cache of decoded instruction objects.
|
||||
static GenericISA::BasicDecodeCache<Decoder, ExtMachInst> defaultCache;
|
||||
friend class GenericISA::BasicDecodeCache<Decoder, ExtMachInst>;
|
||||
|
||||
public:
|
||||
StaticInstPtr decodeInst(ExtMachInst mach_inst);
|
||||
|
||||
/// Decode a machine instruction.
|
||||
@@ -112,6 +112,7 @@ class Decoder : public InstDecoder
|
||||
return si;
|
||||
}
|
||||
|
||||
public:
|
||||
StaticInstPtr
|
||||
decode(PowerISA::PCState &nextPC)
|
||||
{
|
||||
|
||||
@@ -56,6 +56,13 @@ class Decoder : public InstDecoder
|
||||
ExtMachInst emi;
|
||||
bool instDone;
|
||||
|
||||
StaticInstPtr decodeInst(ExtMachInst mach_inst);
|
||||
|
||||
/// Decode a machine instruction.
|
||||
/// @param mach_inst The binary instruction to decode.
|
||||
/// @retval A pointer to the corresponding StaticInst object.
|
||||
StaticInstPtr decode(ExtMachInst mach_inst, Addr addr);
|
||||
|
||||
public:
|
||||
Decoder(ISA* isa=nullptr) { reset(); }
|
||||
|
||||
@@ -72,13 +79,6 @@ class Decoder : public InstDecoder
|
||||
bool instReady() { return instDone; }
|
||||
void takeOverFrom(Decoder *old) {}
|
||||
|
||||
StaticInstPtr decodeInst(ExtMachInst mach_inst);
|
||||
|
||||
/// Decode a machine instruction.
|
||||
/// @param mach_inst The binary instruction to decode.
|
||||
/// @retval A pointer to the corresponding StaticInst object.
|
||||
StaticInstPtr decode(ExtMachInst mach_inst, Addr addr);
|
||||
|
||||
StaticInstPtr decode(RiscvISA::PCState &nextPC);
|
||||
};
|
||||
|
||||
|
||||
@@ -103,8 +103,8 @@ class Decoder : public InstDecoder
|
||||
protected:
|
||||
/// A cache of decoded instruction objects.
|
||||
static GenericISA::BasicDecodeCache<Decoder, ExtMachInst> defaultCache;
|
||||
friend class GenericISA::BasicDecodeCache<Decoder, ExtMachInst>;
|
||||
|
||||
public:
|
||||
StaticInstPtr decodeInst(ExtMachInst mach_inst);
|
||||
|
||||
/// Decode a machine instruction.
|
||||
@@ -119,6 +119,7 @@ class Decoder : public InstDecoder
|
||||
return si;
|
||||
}
|
||||
|
||||
public:
|
||||
StaticInstPtr
|
||||
decode(SparcISA::PCState &nextPC)
|
||||
{
|
||||
|
||||
@@ -241,6 +241,13 @@ class Decoder : public InstDecoder
|
||||
CacheKey, DecodeCache::InstMap<ExtMachInst> *> InstCacheMap;
|
||||
static InstCacheMap instCacheMap;
|
||||
|
||||
StaticInstPtr decodeInst(ExtMachInst mach_inst);
|
||||
|
||||
/// Decode a machine instruction.
|
||||
/// @param mach_inst The binary instruction to decode.
|
||||
/// @retval A pointer to the corresponding StaticInst object.
|
||||
StaticInstPtr decode(ExtMachInst mach_inst, Addr addr);
|
||||
|
||||
public:
|
||||
Decoder(ISA *isa=nullptr)
|
||||
{
|
||||
@@ -328,12 +335,6 @@ class Decoder : public InstDecoder
|
||||
}
|
||||
|
||||
public:
|
||||
StaticInstPtr decodeInst(ExtMachInst mach_inst);
|
||||
|
||||
/// Decode a machine instruction.
|
||||
/// @param mach_inst The binary instruction to decode.
|
||||
/// @retval A pointer to the corresponding StaticInst object.
|
||||
StaticInstPtr decode(ExtMachInst mach_inst, Addr addr);
|
||||
StaticInstPtr decode(X86ISA::PCState &nextPC);
|
||||
|
||||
StaticInstPtr fetchRomMicroop(
|
||||
|
||||
Reference in New Issue
Block a user