Add SystemZ decoder macro.

This commit is contained in:
Rot127 2024-08-26 04:51:09 -05:00 committed by Rot127
parent 1496434327
commit ca07088b26

View File

@ -1080,7 +1080,8 @@ void PrinterCapstone::decoderEmitterEmitDecodeInstruction(
<< "}\n\n"; << "}\n\n";
std::set<std::string> InsnBytesAsUint16 = {"ARM"}; std::set<std::string> InsnBytesAsUint16 = {"ARM"};
std::set<std::string> InsnBytesAsUint32 = {"ARM", "PPC", "AArch64", "LoongArch", "Alpha", "Mips"}; std::set<std::string> InsnBytesAsUint32 = {"ARM", "AArch64", "LoongArch", "Alpha", "Mips"};
std::set<std::string> InsnBytesAsUint64 = {"SystemZ"};
bool MacroDefined = false; bool MacroDefined = false;
if (InsnBytesAsUint16.find(TargetName) != InsnBytesAsUint16.end()) { if (InsnBytesAsUint16.find(TargetName) != InsnBytesAsUint16.end()) {
OS << "FieldFromInstruction(fieldFromInstruction_2, uint16_t)\n" OS << "FieldFromInstruction(fieldFromInstruction_2, uint16_t)\n"
@ -1096,6 +1097,13 @@ void PrinterCapstone::decoderEmitterEmitDecodeInstruction(
"decodeToMCInst_4, uint32_t)\n"; "decodeToMCInst_4, uint32_t)\n";
MacroDefined = true; MacroDefined = true;
} }
if (InsnBytesAsUint64.find(TargetName) != InsnBytesAsUint64.end()) {
OS << "FieldFromInstruction(fieldFromInstruction_8, uint64_t)\n"
<< "DecodeToMCInst(decodeToMCInst_8, fieldFromInstruction_8, uint64_t)\n"
<< "DecodeInstruction(decodeInstruction_8, fieldFromInstruction_8, "
"decodeToMCInst_4, uint64_t)\n";
MacroDefined = true;
}
// Special case: The LLVM disassembler uses uint64_t values for decoding. // Special case: The LLVM disassembler uses uint64_t values for decoding.
// Although PPC instructions are 4 bytes wide. // Although PPC instructions are 4 bytes wide.