Cleanup the Frontend x86 decoder

Makes it easier to follow the source
This commit is contained in:
Ryan Houdek authored and Stefanos Kornilios Mitsis Poiitidis committed 2020-03-06 07:54:32 +02:00
1 parent 71a9713970
commit 2975161e89
2 files changed
+503 -508

No files matched your search

File diff suppressed because it is too large. Load diff
+21 -4
View File
@@ -11,7 +11,7 @@ struct Context;
}
namespace FEXCore::Frontend {
class Decoder {
class Decoder final {
public:
Decoder(FEXCore::Context::Context *ctx);
bool DecodeInstructionsInBlock(uint8_t const* InstStream, uint64_t PC);
@@ -24,14 +24,31 @@ public:
private:
FEXCore::Context::Context *CTX;
bool DecodeInstruction(uint8_t const *InstStream, uint64_t PC);
bool DecodeInstruction(uint64_t PC);
bool BlockEndCanContinuePast();
bool BranchTargetInMultiblockRange();
void DecodeModRM(uint8_t *Displacement, FEXCore::X86Tables::ModRMDecoded ModRM);
bool DecodeSIB(uint8_t *Displacement, FEXCore::X86Tables::ModRMDecoded ModRM);
uint8_t ReadByte();
uint8_t PeekByte(uint8_t Offset);
uint64_t ReadData(uint8_t Size);
void SkipBytes(uint8_t Size) { InstructionSize += Size; }
bool NormalOp(FEXCore::X86Tables::X86InstInfo const *Info, uint16_t Op);
bool NormalOpHeader(FEXCore::X86Tables::X86InstInfo const *Info, uint16_t Op);
bool BlockEndCanContinuePast(FEXCore::X86Tables::DecodedInst const &Inst);
bool BranchTargetInMultiblockRange(FEXCore::X86Tables::DecodedInst const &Inst);
static constexpr size_t DefaultDecodedBufferSize = 0x10000;
std::vector<FEXCore::X86Tables::DecodedInst> DecodedBuffer;
size_t DecodedSize {};
uint8_t const *InstStream;
static constexpr size_t MAX_INST_SIZE = 15;
uint8_t InstructionSize;
std::array<uint8_t, MAX_INST_SIZE> Instruction;
FEXCore::X86Tables::DecodedInst *DecodeInst;
// This is for multiblock data tracking
bool SymbolAvailable {false};
uint64_t EntryPoint {};