Gabe Black has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/32895 )
Change subject: x86: Use default initializers to simplify the decoder
constructor.
......................................................................
x86: Use default initializers to simplify the decoder constructor.
Change-Id: I76f1fe9a58a26f26c204cb0b9bab050a22d289c9
---
M src/arch/x86/decoder.hh
1 file changed, 17 insertions(+), 28 deletions(-)
diff --git a/src/arch/x86/decoder.hh b/src/arch/x86/decoder.hh
index b864e67..1e5bca9 100644
--- a/src/arch/x86/decoder.hh
+++ b/src/arch/x86/decoder.hh
@@ -82,24 +82,24 @@
// The bytes to be predecoded.
MachInst fetchChunk;
- InstBytes *instBytes;
+ InstBytes *instBytes = &dummy;
int chunkIdx;
// The pc of the start of fetchChunk.
- Addr basePC;
+ Addr basePC = 0;
// The pc the current instruction started at.
- Addr origPC;
+ Addr origPC = 0;
// The offset into fetchChunk of current processing.
- int offset;
+ int offset = 0;
// The extended machine instruction being generated.
ExtMachInst emi;
// Predecoding state.
- X86Mode mode;
- X86SubMode submode;
- uint8_t altOp;
- uint8_t defOp;
- uint8_t altAddr;
- uint8_t defAddr;
- uint8_t stack;
+ X86Mode mode = LongMode;
+ X86SubMode submode = SixtyFourBitMode;
+ uint8_t altOp = 0;
+ uint8_t defOp = 0;
+ uint8_t altAddr = 0;
+ uint8_t defAddr = 0;
+ uint8_t stack = 0;
uint8_t
getNextByte()
@@ -166,9 +166,9 @@
// State machine state.
protected:
// Whether or not we're out of bytes.
- bool outOfBytes;
+ bool outOfBytes = true;
// Whether we've completed generating an ExtMachInst.
- bool instDone;
+ bool instDone = false;
// The size of the displacement value.
int displacementSize;
// The size of the immediate value.
@@ -197,7 +197,7 @@
ErrorState
};
- State state;
+ State state = ResetState;
// Functions to handle each of the states
State doResetState();
@@ -228,32 +228,21 @@
typedef RegVal CacheKey;
typedef DecodeCache::AddrMap<Decoder::InstBytes> DecodePages;
- DecodePages *decodePages;
+ DecodePages *decodePages = nullptr;
typedef std::unordered_map<CacheKey, DecodePages *> AddrCacheMap;
AddrCacheMap addrCacheMap;
- DecodeCache::InstMap<ExtMachInst> *instMap;
+ DecodeCache::InstMap<ExtMachInst> *instMap = nullptr;
typedef std::unordered_map<
CacheKey, DecodeCache::InstMap<ExtMachInst> *> InstCacheMap;
static InstCacheMap instCacheMap;
public:
- Decoder(ISA* isa = nullptr) : basePC(0), origPC(0), offset(0),
- outOfBytes(true), instDone(false), state(ResetState)
+ Decoder(ISA *isa=nullptr)
{
emi.reset();
- mode = LongMode;
- submode = SixtyFourBitMode;
emi.mode.mode = mode;
emi.mode.submode = submode;
- altOp = 0;
- defOp = 0;
- altAddr = 0;
- defAddr = 0;
- stack = 0;
- instBytes = &dummy;
- decodePages = NULL;
- instMap = NULL;
}
void
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/32895
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: I76f1fe9a58a26f26c204cb0b9bab050a22d289c9
Gerrit-Change-Number: 32895
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s