Emit decoding function for PPC for 4byte wide instr. but with 64bit value.

This commit is contained in:
Rot127 2023-07-20 09:24:52 -05:00
parent bb0a669893
commit 4c8544b705
No known key found for this signature in database
GPG Key ID: 3812B8258810AF67

View File

@ -1001,7 +1001,7 @@ void PrinterCapstone::decoderEmitterEmitDecodeInstruction(
<< "}\n\n";
std::set<std::string> HasTwoByteInsns = {"ARM"};
std::set<std::string> HasFourByteInsns = {"ARM", "PPC", "AArch64"};
std::set<std::string> HasFourByteInsns = {"ARM", "AArch64"};
if (HasTwoByteInsns.find(TargetName) != HasTwoByteInsns.end())
OS << "FieldFromInstruction(fieldFromInstruction_2, uint16_t)\n"
@ -1013,6 +1013,13 @@ void PrinterCapstone::decoderEmitterEmitDecodeInstruction(
<< "DecodeToMCInst(decodeToMCInst_4, fieldFromInstruction_4, uint32_t)\n"
<< "DecodeInstruction(decodeInstruction_4, fieldFromInstruction_4, "
"decodeToMCInst_4, uint32_t)\n";
// Special case: The LLVM disassembler uses uint64_t values for decoding.
// Although PPC instructions are 4 bytes wide.
if (TargetName == "PPC")
OS << "FieldFromInstruction(fieldFromInstruction_4, uint64_t)\n"
<< "DecodeToMCInst(decodeToMCInst_4, fieldFromInstruction_4, uint64_t)\n"
<< "DecodeInstruction(decodeInstruction_4, fieldFromInstruction_4, "
"decodeToMCInst_4, uint32_t)\n";
}
void PrinterCapstone::decoderEmitterEmitTable(