[gem5-dev] Change in gem5/gem5[develop]: x86: Style fix in the decoder class.
Gabe Black has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/32894 ) Change subject: x86: Style fix in the decoder class. .. x86: Style fix in the decoder class. Change-Id: If06a8771b5db0fb68e88b16dedfe60fc2ce306d9 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/32894 Reviewed-by: Andreas Sandberg Maintainer: Gabe Black Tested-by: kokoro --- M src/arch/x86/decoder.cc M src/arch/x86/decoder.hh 2 files changed, 96 insertions(+), 106 deletions(-) Approvals: Andreas Sandberg: Looks good to me, approved Gabe Black: Looks good to me, approved kokoro: Regressions pass diff --git a/src/arch/x86/decoder.cc b/src/arch/x86/decoder.cc index 320cbdc..28034cb 100644 --- a/src/arch/x86/decoder.cc +++ b/src/arch/x86/decoder.cc @@ -71,11 +71,11 @@ void Decoder::process() { -//This function drives the decoder state machine. +// This function drives the decoder state machine. -//Some sanity checks. You shouldn't try to process more bytes if -//there aren't any, and you shouldn't overwrite an already -//decoder ExtMachInst. +// Some sanity checks. You shouldn't try to process more bytes if +// there aren't any, and you shouldn't overwrite an already decoded +// ExtMachInst. assert(!outOfBytes); assert(!instDone); @@ -87,7 +87,7 @@ instBytes->chunks.push_back(fetchChunk); } -//While there's still something to do... +// While there's still something to do... while (!instDone && !outOfBytes) { uint8_t nextByte = getNextByte(); switch (state) { @@ -170,8 +170,8 @@ } } -//Either get a prefix and record it in the ExtMachInst, or send the -//state machine on to get the opcode(s). +// Either get a prefix and record it in the ExtMachInst, or send the +// state machine on to get the opcode(s). Decoder::State Decoder::doPrefixState(uint8_t nextByte) { @@ -182,9 +182,8 @@ prefix = 0; if (prefix) consumeByte(); -switch(prefix) -{ -//Operand size override prefixes +switch(prefix) { +// Operand size override prefixes case OperandSizeOverride: DPRINTF(Decoder, "Found operand size override prefix.\n"); emi.legacy.op = true; @@ -193,7 +192,7 @@ DPRINTF(Decoder, "Found address size override prefix.\n"); emi.legacy.addr = true; break; -//Segment override prefixes +// Segment override prefixes case CSOverride: case DSOverride: case ESOverride: @@ -451,8 +450,8 @@ State nextState = ErrorState; const uint8_t opcode = emi.opcode.op; -//Figure out the effective operand size. This can be overriden to -//a fixed value at the decoder level. +// Figure out the effective operand size. This can be overriden to +// a fixed value at the decoder level. int logOpSize; if (emi.rex.w) logOpSize = 3; // 64 bit operand size @@ -461,33 +460,33 @@ else logOpSize = defOp; -//Set the actual op size +// Set the actual op size. emi.opSize = 1 << logOpSize; -//Figure out the effective address size. This can be overriden to -//a fixed value at the decoder level. +// Figure out the effective address size. This can be overriden to +// a fixed value at the decoder level. int logAddrSize; if (emi.legacy.addr) logAddrSize = altAddr; else logAddrSize = defAddr; -//Set the actual address size +// Set the actual address size. emi.addrSize = 1 << logAddrSize; -//Figure out the effective stack width. This can be overriden to -//a fixed value at the decoder level. +// Figure out the effective stack width. This can be overriden to +// a fixed value at the decoder level. emi.stackSize = 1 << stack; -//Figure out how big of an immediate we'll retreive based -//on the opcode. +// Figure out how big of an immediate we'll retreive based +// on the opcode. int immType = immTable[opcode]; if (addrSizedImm) immediateSize = SizeTypeToSize[logAddrSize - 1][immType]; else immediateSize = SizeTypeToSize[logOpSize - 1][immType]; -//Determine what to expect next +// Determine what to expect next. if (modrmTable[opcode]) { nextState = ModRMState; } else { @@ -501,9 +500,9 @@ return nextState; } -//Get the ModRM byte and determine what displacement, if any, there is. -//Also determine whether or not to get the SIB byte, displacement, or -//immediate next. +// Get the ModRM byte and determine what displacement, if any, there is. +// Also determine whether or not to get the SIB byte, displacement, or +// immediate next. Decoder::State Decoder::doModRMState(uint8_t nextByte) { @@ -511,7 +510,7 @@ ModRM modRM = nextByte; DPRINTF(Decoder, "Found modrm byte %#x.\n", nextByte);
[gem5-dev] Change in gem5/gem5[develop]: x86: Style fix in the decoder class.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/32894 ) Change subject: x86: Style fix in the decoder class. .. x86: Style fix in the decoder class. Change-Id: If06a8771b5db0fb68e88b16dedfe60fc2ce306d9 --- M src/arch/x86/decoder.cc M src/arch/x86/decoder.hh 2 files changed, 96 insertions(+), 106 deletions(-) diff --git a/src/arch/x86/decoder.cc b/src/arch/x86/decoder.cc index 320cbdc..28034cb 100644 --- a/src/arch/x86/decoder.cc +++ b/src/arch/x86/decoder.cc @@ -71,11 +71,11 @@ void Decoder::process() { -//This function drives the decoder state machine. +// This function drives the decoder state machine. -//Some sanity checks. You shouldn't try to process more bytes if -//there aren't any, and you shouldn't overwrite an already -//decoder ExtMachInst. +// Some sanity checks. You shouldn't try to process more bytes if +// there aren't any, and you shouldn't overwrite an already decoded +// ExtMachInst. assert(!outOfBytes); assert(!instDone); @@ -87,7 +87,7 @@ instBytes->chunks.push_back(fetchChunk); } -//While there's still something to do... +// While there's still something to do... while (!instDone && !outOfBytes) { uint8_t nextByte = getNextByte(); switch (state) { @@ -170,8 +170,8 @@ } } -//Either get a prefix and record it in the ExtMachInst, or send the -//state machine on to get the opcode(s). +// Either get a prefix and record it in the ExtMachInst, or send the +// state machine on to get the opcode(s). Decoder::State Decoder::doPrefixState(uint8_t nextByte) { @@ -182,9 +182,8 @@ prefix = 0; if (prefix) consumeByte(); -switch(prefix) -{ -//Operand size override prefixes +switch(prefix) { +// Operand size override prefixes case OperandSizeOverride: DPRINTF(Decoder, "Found operand size override prefix.\n"); emi.legacy.op = true; @@ -193,7 +192,7 @@ DPRINTF(Decoder, "Found address size override prefix.\n"); emi.legacy.addr = true; break; -//Segment override prefixes +// Segment override prefixes case CSOverride: case DSOverride: case ESOverride: @@ -451,8 +450,8 @@ State nextState = ErrorState; const uint8_t opcode = emi.opcode.op; -//Figure out the effective operand size. This can be overriden to -//a fixed value at the decoder level. +// Figure out the effective operand size. This can be overriden to +// a fixed value at the decoder level. int logOpSize; if (emi.rex.w) logOpSize = 3; // 64 bit operand size @@ -461,33 +460,33 @@ else logOpSize = defOp; -//Set the actual op size +// Set the actual op size. emi.opSize = 1 << logOpSize; -//Figure out the effective address size. This can be overriden to -//a fixed value at the decoder level. +// Figure out the effective address size. This can be overriden to +// a fixed value at the decoder level. int logAddrSize; if (emi.legacy.addr) logAddrSize = altAddr; else logAddrSize = defAddr; -//Set the actual address size +// Set the actual address size. emi.addrSize = 1 << logAddrSize; -//Figure out the effective stack width. This can be overriden to -//a fixed value at the decoder level. +// Figure out the effective stack width. This can be overriden to +// a fixed value at the decoder level. emi.stackSize = 1 << stack; -//Figure out how big of an immediate we'll retreive based -//on the opcode. +// Figure out how big of an immediate we'll retreive based +// on the opcode. int immType = immTable[opcode]; if (addrSizedImm) immediateSize = SizeTypeToSize[logAddrSize - 1][immType]; else immediateSize = SizeTypeToSize[logOpSize - 1][immType]; -//Determine what to expect next +// Determine what to expect next. if (modrmTable[opcode]) { nextState = ModRMState; } else { @@ -501,9 +500,9 @@ return nextState; } -//Get the ModRM byte and determine what displacement, if any, there is. -//Also determine whether or not to get the SIB byte, displacement, or -//immediate next. +// Get the ModRM byte and determine what displacement, if any, there is. +// Also determine whether or not to get the SIB byte, displacement, or +// immediate next. Decoder::State Decoder::doModRMState(uint8_t nextByte) { @@ -511,7 +510,7 @@ ModRM modRM = nextByte; DPRINTF(Decoder, "Found modrm byte %#x.\n", nextByte); if (defOp == 1) { -//figure out 16 bit displacement size +// Figure out 16 bit displacement size. if ((modRM.mod == 0 && modRM.rm == 6) || modRM.mod == 2) displacementSize = 2; else if (modRM.mod == 1) @@ -519,7