diff --git a/llvm/utils/TableGen/PrinterCapstone.cpp b/llvm/utils/TableGen/PrinterCapstone.cpp index 6835034fcc05..cbbd53c1a6e0 100644 --- a/llvm/utils/TableGen/PrinterCapstone.cpp +++ b/llvm/utils/TableGen/PrinterCapstone.cpp @@ -1001,7 +1001,7 @@ void PrinterCapstone::decoderEmitterEmitDecodeInstruction( << "}\n\n"; std::set HasTwoByteInsns = {"ARM"}; - std::set HasFourByteInsns = {"ARM", "PPC", "AArch64"}; + std::set 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(