34#define DEBUG_TYPE "hexagon-disassembler"
47 std::unique_ptr<MCInstrInfo const>
const MCII;
48 mutable std::unique_ptr<MCInst> CurrentBundle;
49 mutable MCInst const *CurrentExtender;
54 CurrentExtender(
nullptr) {}
67 void remapInstruction(
MCInst &Instr)
const;
77 void resetBundle()
const {
78 CurrentBundle.reset();
79 CurrentInstruction =
nullptr;
82 mutable MCOperand *CurrentInstruction =
nullptr;
85static uint64_t fullValue(HexagonDisassembler
const &Disassembler,
MCInst &
MI,
88 if (!Disassembler.CurrentExtender ||
100 uint64_t Operand = Upper26 | Lower6;
104 return *
static_cast<HexagonDisassembler
const *
>(
Decoder);
107static void signedDecoder(
MCInst &
MI,
unsigned tmp,
109 HexagonDisassembler
const &Disassembler = disassembler(
Decoder);
191 return DecodeStatus::Success;
197 return DecodeStatus::Success;
201#include "HexagonGenDisassemblerTables.inc"
206 return new HexagonDisassembler(STI, Ctx,
T.createMCInstrInfo());
218 bool Complete =
false;
221 CurrentBundle.reset(
new MCInst);
222 CurrentBundle->setOpcode(Hexagon::BUNDLE);
224 while (Result ==
Success && !Complete) {
228 Result = getSingleInstruction(*Inst, *CurrentBundle, Bytes,
Address, CS,
240 const auto STI_ = (ArchSTI !=
nullptr) ? *ArchSTI : STI;
241 HexagonMCChecker Checker(
getContext(), *MCII, STI_, *CurrentBundle,
243 if (!Checker.check())
245 remapInstruction(*CurrentBundle);
250 ArrayRef<uint8_t> Bytes,
252 raw_ostream &CS)
const {
258 if (!CurrentBundle) {
259 if (!makeBundle(Bytes,
Address, BytesToSkip, CS)) {
264 CurrentInstruction = (CurrentBundle->begin() + 1);
269 if (++CurrentInstruction == CurrentBundle->end())
276 ArrayRef<uint8_t> Bytes,
278 raw_ostream &CS)
const {
284 if (!makeBundle(Bytes,
Address, BytesToSkip, CS)) {
297void HexagonDisassembler::remapInstruction(MCInst &Instr)
const {
299 auto &
MI =
const_cast<MCInst &
>(*
I.getInst());
300 switch (
MI.getOpcode()) {
301 case Hexagon::S2_allocframe:
302 if (
MI.getOperand(0).getReg() == Hexagon::R29) {
303 MI.setOpcode(Hexagon::S6_allocframe_to_raw);
304 MI.erase(
MI.begin () + 1);
305 MI.erase(
MI.begin ());
308 case Hexagon::L2_deallocframe:
309 if (
MI.getOperand(0).getReg() == Hexagon::D15 &&
310 MI.getOperand(1).getReg() == Hexagon::R30) {
311 MI.setOpcode(L6_deallocframe_map_to_raw);
312 MI.erase(
MI.begin () + 1);
313 MI.erase(
MI.begin ());
316 case Hexagon::L4_return:
317 if (
MI.getOperand(0).getReg() == Hexagon::D15 &&
318 MI.getOperand(1).getReg() == Hexagon::R30) {
319 MI.setOpcode(L6_return_map_to_raw);
320 MI.erase(
MI.begin () + 1);
321 MI.erase(
MI.begin ());
324 case Hexagon::L4_return_t:
325 if (
MI.getOperand(0).getReg() == Hexagon::D15 &&
326 MI.getOperand(2).getReg() == Hexagon::R30) {
327 MI.setOpcode(L4_return_map_to_raw_t);
328 MI.erase(
MI.begin () + 2);
329 MI.erase(
MI.begin ());
332 case Hexagon::L4_return_f:
333 if (
MI.getOperand(0).getReg() == Hexagon::D15 &&
334 MI.getOperand(2).getReg() == Hexagon::R30) {
335 MI.setOpcode(L4_return_map_to_raw_f);
336 MI.erase(
MI.begin () + 2);
337 MI.erase(
MI.begin ());
340 case Hexagon::L4_return_tnew_pt:
341 if (
MI.getOperand(0).getReg() == Hexagon::D15 &&
342 MI.getOperand(2).getReg() == Hexagon::R30) {
343 MI.setOpcode(L4_return_map_to_raw_tnew_pt);
344 MI.erase(
MI.begin () + 2);
345 MI.erase(
MI.begin ());
348 case Hexagon::L4_return_fnew_pt:
349 if (
MI.getOperand(0).getReg() == Hexagon::D15 &&
350 MI.getOperand(2).getReg() == Hexagon::R30) {
351 MI.setOpcode(L4_return_map_to_raw_fnew_pt);
352 MI.erase(
MI.begin () + 2);
353 MI.erase(
MI.begin ());
356 case Hexagon::L4_return_tnew_pnt:
357 if (
MI.getOperand(0).getReg() == Hexagon::D15 &&
358 MI.getOperand(2).getReg() == Hexagon::R30) {
359 MI.setOpcode(L4_return_map_to_raw_tnew_pnt);
360 MI.erase(
MI.begin () + 2);
361 MI.erase(
MI.begin ());
364 case Hexagon::L4_return_fnew_pnt:
365 if (
MI.getOperand(0).getReg() == Hexagon::D15 &&
366 MI.getOperand(2).getReg() == Hexagon::R30) {
367 MI.setOpcode(L4_return_map_to_raw_fnew_pnt);
368 MI.erase(
MI.begin () + 2);
369 MI.erase(
MI.begin ());
376DecodeStatus HexagonDisassembler::getSingleInstruction(MCInst &
MI, MCInst &MCB,
377 ArrayRef<uint8_t> Bytes,
380 bool &Complete)
const {
390 else if (BundleSize == 1)
393 return DecodeStatus::Fail;
402 unsigned duplexIClass;
403 uint8_t
const *DecodeLow, *DecodeHigh;
404 duplexIClass = ((
Instruction >> 28) & 0xe) | ((Instruction >> 13) & 0x1);
405 switch (duplexIClass) {
409 DecodeLow = DecoderTableSUBINSN_L132;
410 DecodeHigh = DecoderTableSUBINSN_L132;
413 DecodeLow = DecoderTableSUBINSN_L232;
414 DecodeHigh = DecoderTableSUBINSN_L132;
417 DecodeLow = DecoderTableSUBINSN_L232;
418 DecodeHigh = DecoderTableSUBINSN_L232;
421 DecodeLow = DecoderTableSUBINSN_A32;
422 DecodeHigh = DecoderTableSUBINSN_A32;
425 DecodeLow = DecoderTableSUBINSN_L132;
426 DecodeHigh = DecoderTableSUBINSN_A32;
429 DecodeLow = DecoderTableSUBINSN_L232;
430 DecodeHigh = DecoderTableSUBINSN_A32;
433 DecodeLow = DecoderTableSUBINSN_S132;
434 DecodeHigh = DecoderTableSUBINSN_A32;
437 DecodeLow = DecoderTableSUBINSN_S232;
438 DecodeHigh = DecoderTableSUBINSN_A32;
441 DecodeLow = DecoderTableSUBINSN_S132;
442 DecodeHigh = DecoderTableSUBINSN_L132;
445 DecodeLow = DecoderTableSUBINSN_S132;
446 DecodeHigh = DecoderTableSUBINSN_L232;
449 DecodeLow = DecoderTableSUBINSN_S132;
450 DecodeHigh = DecoderTableSUBINSN_S132;
453 DecodeLow = DecoderTableSUBINSN_S232;
454 DecodeHigh = DecoderTableSUBINSN_S132;
457 DecodeLow = DecoderTableSUBINSN_S232;
458 DecodeHigh = DecoderTableSUBINSN_L132;
461 DecodeLow = DecoderTableSUBINSN_S232;
462 DecodeHigh = DecoderTableSUBINSN_L232;
465 DecodeLow = DecoderTableSUBINSN_S232;
466 DecodeHigh = DecoderTableSUBINSN_S232;
469 MI.setOpcode(Hexagon::DuplexIClass0 + duplexIClass);
472 auto TmpExtender = CurrentExtender;
475 Result = decodeInstruction(DecodeLow, *MILow, Instruction & 0x1fff,
Address,
477 CurrentExtender = TmpExtender;
478 if (Result != DecodeStatus::Success)
479 return DecodeStatus::Fail;
480 Result = decodeInstruction(
481 DecodeHigh, *MIHigh, (Instruction >> 16) & 0x1fff,
Address,
this, STI);
482 if (Result != DecodeStatus::Success)
483 return DecodeStatus::Fail;
486 MI.addOperand(OPLow);
487 MI.addOperand(OPHigh);
494 if (CurrentExtender !=
nullptr)
495 Result = decodeInstruction(DecoderTableMustExtend32,
MI, Instruction,
499 Result = decodeInstruction(DecoderTable32,
MI, Instruction,
Address,
this,
503 STI.hasFeature(Hexagon::ExtensionHVX))
504 Result = decodeInstruction(DecoderTableEXT_mmvec32,
MI, Instruction,
513 MCOperand &MCO =
MI.getOperand(OpIndex);
514 assert(MCO.
isReg() &&
"New value consumers must be registers");
520 unsigned Lookback = (
Register & 0x6) >> 1;
523 bool PrevVector =
false;
531 if (
Vector && !CurrentVector)
536 PrevVector = CurrentVector;
540 auto const &Inst = *i->getInst();
541 bool SubregBit = (
Register & 0x1) != 0;
548 assert(Producer != Hexagon::NoRegister);
556 const unsigned ProdPairIndex =
559 SubregBit = !SubregBit;
560 Producer = (ProdPairIndex << 1) + SubregBit + Hexagon::V0;
561 }
else if (SubregBit)
565 assert(Producer != Hexagon::NoRegister);
571 if (CurrentExtender !=
nullptr) {
573 ? *
MI.getOperand(1).getInst()
582Expected<bool> HexagonDisassembler::onSymbolStart(SymbolInfoTy &Symbol,
584 ArrayRef<uint8_t> Bytes,
596 if (RegNo <
Table.size()) {
614 Hexagon::R0, Hexagon::R1, Hexagon::R2, Hexagon::R3, Hexagon::R4,
615 Hexagon::R5, Hexagon::R6, Hexagon::R7, Hexagon::R8, Hexagon::R9,
616 Hexagon::R10, Hexagon::R11, Hexagon::R12, Hexagon::R13, Hexagon::R14,
617 Hexagon::R15, Hexagon::R16, Hexagon::R17, Hexagon::R18, Hexagon::R19,
618 Hexagon::R20, Hexagon::R21, Hexagon::R22, Hexagon::R23, Hexagon::R24,
619 Hexagon::R25, Hexagon::R26, Hexagon::R27, Hexagon::R28, Hexagon::R29,
620 Hexagon::R30, Hexagon::R31};
629 static const MCPhysReg GeneralSubRegDecoderTable[] = {
630 Hexagon::R0, Hexagon::R1, Hexagon::R2, Hexagon::R3,
631 Hexagon::R4, Hexagon::R5, Hexagon::R6, Hexagon::R7,
632 Hexagon::R16, Hexagon::R17, Hexagon::R18, Hexagon::R19,
633 Hexagon::R20, Hexagon::R21, Hexagon::R22, Hexagon::R23,
642 static const MCPhysReg HvxVRDecoderTable[] = {
643 Hexagon::V0, Hexagon::V1, Hexagon::V2, Hexagon::V3, Hexagon::V4,
644 Hexagon::V5, Hexagon::V6, Hexagon::V7, Hexagon::V8, Hexagon::V9,
645 Hexagon::V10, Hexagon::V11, Hexagon::V12, Hexagon::V13, Hexagon::V14,
646 Hexagon::V15, Hexagon::V16, Hexagon::V17, Hexagon::V18, Hexagon::V19,
647 Hexagon::V20, Hexagon::V21, Hexagon::V22, Hexagon::V23, Hexagon::V24,
648 Hexagon::V25, Hexagon::V26, Hexagon::V27, Hexagon::V28, Hexagon::V29,
649 Hexagon::V30, Hexagon::V31};
657 static const MCPhysReg HlxLRDecoderTable[] = {
658 Hexagon::L0, Hexagon::L1, Hexagon::L2, Hexagon::L3,
659 Hexagon::L4, Hexagon::L5, Hexagon::L6, Hexagon::L7,
660 Hexagon::L8, Hexagon::L9, Hexagon::L10, Hexagon::L11,
661 Hexagon::L12, Hexagon::L13, Hexagon::L14, Hexagon::L15};
669 static const MCPhysReg HlxLLRDecoderTable[] = {
670 Hexagon::LL0, Hexagon::LL1, Hexagon::LL2, Hexagon::LL3,
671 Hexagon::LL4, Hexagon::LL5, Hexagon::LL6, Hexagon::LL7};
683 static const MCPhysReg DoubleRegDecoderTable[] = {
684 Hexagon::D0, Hexagon::D1, Hexagon::D2, Hexagon::D3,
685 Hexagon::D4, Hexagon::D5, Hexagon::D6, Hexagon::D7,
686 Hexagon::D8, Hexagon::D9, Hexagon::D10, Hexagon::D11,
687 Hexagon::D12, Hexagon::D13, Hexagon::D14, Hexagon::D15};
696 static const MCPhysReg GeneralDoubleLow8RegDecoderTable[] = {
697 Hexagon::D0, Hexagon::D1, Hexagon::D2, Hexagon::D3,
698 Hexagon::D8, Hexagon::D9, Hexagon::D10, Hexagon::D11};
706 static const MCPhysReg HvxWRDecoderTable[] = {
707 Hexagon::W0, Hexagon::WR0, Hexagon::W1, Hexagon::WR1, Hexagon::W2,
708 Hexagon::WR2, Hexagon::W3, Hexagon::WR3, Hexagon::W4, Hexagon::WR4,
709 Hexagon::W5, Hexagon::WR5, Hexagon::W6, Hexagon::WR6, Hexagon::W7,
710 Hexagon::WR7, Hexagon::W8, Hexagon::WR8, Hexagon::W9, Hexagon::WR9,
711 Hexagon::W10, Hexagon::WR10, Hexagon::W11, Hexagon::WR11, Hexagon::W12,
712 Hexagon::WR12, Hexagon::W13, Hexagon::WR13, Hexagon::W14, Hexagon::WR14,
713 Hexagon::W15, Hexagon::WR15,
723 static const MCPhysReg HvxVQRDecoderTable[] = {
724 Hexagon::VQ0, Hexagon::VQ1, Hexagon::VQ2, Hexagon::VQ3,
725 Hexagon::VQ4, Hexagon::VQ5, Hexagon::VQ6, Hexagon::VQ7};
733 static const MCPhysReg PredRegDecoderTable[] = {Hexagon::P0, Hexagon::P1,
734 Hexagon::P2, Hexagon::P3};
742 static const MCPhysReg HvxQRDecoderTable[] = {Hexagon::Q0, Hexagon::Q1,
743 Hexagon::Q2, Hexagon::Q3};
753 static const MCPhysReg CtrlRegDecoderTable[] = {
757 CS0, CS1, UPCYCLELO, UPCYCLEHI,
758 FRAMELIMIT, FRAMEKEY, PKTCOUNTLO, PKTCOUNTHI,
761 VFRAMELIMIT, VSP, UTIMERLO, UTIMERHI};
763 if (RegNo >= std::size(CtrlRegDecoderTable))
766 static_assert(NoRegister == 0,
"Expecting NoRegister to be 0");
767 if (CtrlRegDecoderTable[RegNo] == NoRegister)
770 unsigned Register = CtrlRegDecoderTable[RegNo];
780 static const MCPhysReg CtrlReg64DecoderTable[] = {
785 C17_16, 0, PKTCOUNT, 0,
788 C29_28, 0, UTIMER, 0};
790 if (RegNo >= std::size(CtrlReg64DecoderTable))
793 static_assert(NoRegister == 0,
"Expecting NoRegister to be 0");
794 if (CtrlReg64DecoderTable[RegNo] == NoRegister)
797 unsigned Register = CtrlReg64DecoderTable[RegNo];
823 HexagonDisassembler
const &Disassembler = disassembler(
Decoder);
824 int64_t FullValue = fullValue(Disassembler,
MI, tmp);
825 assert(FullValue >= 0 &&
"Negative in unsigned decoder");
833 HexagonDisassembler
const &Disassembler = disassembler(
Decoder);
843 HexagonDisassembler
const &Disassembler = disassembler(
Decoder);
849 uint32_t Extended = FullValue + Address;
850 if (!Disassembler.tryAddingSymbolicOperand(
MI, Extended, Address,
true, 0, 0,
857 Hexagon::SGP0, Hexagon::SGP1, Hexagon::STID,
858 Hexagon::ELR, Hexagon::BADVA0, Hexagon::BADVA1,
859 Hexagon::SSR, Hexagon::CCR, Hexagon::HTID,
860 Hexagon::BADVA, Hexagon::IMASK, Hexagon::S11,
861 Hexagon::S12, Hexagon::S13, Hexagon::S14,
862 Hexagon::S15, Hexagon::EVB, Hexagon::MODECTL,
863 Hexagon::SYSCFG, Hexagon::S19, Hexagon::S20,
864 Hexagon::VID, Hexagon::S22, Hexagon::S23,
865 Hexagon::S24, Hexagon::S25, Hexagon::S26,
866 Hexagon::CFGBASE, Hexagon::DIAG, Hexagon::REV,
867 Hexagon::PCYCLELO, Hexagon::PCYCLEHI, Hexagon::ISDBST,
868 Hexagon::ISDBCFG0, Hexagon::ISDBCFG1, Hexagon::S35,
869 Hexagon::BRKPTPC0, Hexagon::BRKPTCFG0, Hexagon::BRKPTPC1,
870 Hexagon::BRKPTCFG1, Hexagon::ISDBMBXIN, Hexagon::ISDBMBXOUT,
871 Hexagon::ISDBEN, Hexagon::ISDBGPR, Hexagon::S44,
872 Hexagon::S45, Hexagon::S46, Hexagon::S47,
873 Hexagon::PMUCNT0, Hexagon::PMUCNT1, Hexagon::PMUCNT2,
874 Hexagon::PMUCNT3, Hexagon::PMUEVTCFG, Hexagon::PMUCFG,
875 Hexagon::S54, Hexagon::S55, Hexagon::S56,
876 Hexagon::S57, Hexagon::S58, Hexagon::S59,
877 Hexagon::S60, Hexagon::S61, Hexagon::S62,
878 Hexagon::S63, Hexagon::S64, Hexagon::S65,
879 Hexagon::S66, Hexagon::S67, Hexagon::S68,
880 Hexagon::S69, Hexagon::S70, Hexagon::S71,
881 Hexagon::S72, Hexagon::S73, Hexagon::S74,
882 Hexagon::S75, Hexagon::S76, Hexagon::S77,
883 Hexagon::S78, Hexagon::S79, Hexagon::S80,
901 Hexagon::SGP1_0, Hexagon::S3_2, Hexagon::S5_4, Hexagon::S7_6,
902 Hexagon::S9_8, Hexagon::S11_10, Hexagon::S13_12, Hexagon::S15_14,
903 Hexagon::S17_16, Hexagon::S19_18, Hexagon::S21_20, Hexagon::S23_22,
904 Hexagon::S25_24, Hexagon::S27_26, Hexagon::S29_28, Hexagon::S31_30,
905 Hexagon::S33_32, Hexagon::S35_34, Hexagon::S37_36, Hexagon::S39_38,
906 Hexagon::S41_40, Hexagon::S43_42, Hexagon::S45_44, Hexagon::S47_46,
907 Hexagon::S49_48, Hexagon::S51_50, Hexagon::S53_52, Hexagon::S55_54,
908 Hexagon::S57_56, Hexagon::S59_58, Hexagon::S61_60, Hexagon::S63_62,
909 Hexagon::S65_64, Hexagon::S67_66, Hexagon::S69_68, Hexagon::S71_70,
910 Hexagon::S73_72, Hexagon::S75_74, Hexagon::S77_76, Hexagon::S79_78,
933 static const MCPhysReg GuestRegDecoderTable[] = {
938 GPMUCNT4, GPMUCNT5, GPMUCNT6, GPMUCNT7,
940 GPCYCLELO, GPCYCLEHI, GPMUCNT0, GPMUCNT1,
941 GPMUCNT2, GPMUCNT3, G30, G31
944 if (RegNo >= std::size(GuestRegDecoderTable))
946 if (GuestRegDecoderTable[RegNo] == Hexagon::NoRegister)
949 unsigned Register = GuestRegDecoderTable[RegNo];
960 static const MCPhysReg GuestReg64DecoderTable[] = {
964 G13_12, 0, G15_14, 0,
965 G17_16, 0, G19_18, 0,
966 G21_20, 0, G23_22, 0,
967 G25_24, 0, G27_26, 0,
971 if (RegNo >= std::size(GuestReg64DecoderTable))
973 if (GuestReg64DecoderTable[RegNo] == Hexagon::NoRegister)
976 unsigned Register = GuestReg64DecoderTable[RegNo];
MCDisassembler::DecodeStatus DecodeStatus
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
uint64_t const MCDisassembler * Decoder
#define LLVM_EXTERNAL_VISIBILITY
static DecodeStatus sgp10ConstDecoder(MCInst &MI, const MCDisassembler *Decoder)
static DecodeStatus DecodeIntRegsLow8RegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeGuestRegsRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeCtrRegsRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus brtargetDecoder(MCInst &MI, unsigned tmp, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodePredRegsRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
LLVM_ABI LLVM_EXTERNAL_VISIBILITY void LLVMInitializeHexagonDisassembler()
static DecodeStatus s32_0ImmDecoder(MCInst &MI, unsigned tmp, uint64_t, const MCDisassembler *Decoder)
static DecodeStatus unsignedImmDecoder(MCInst &MI, unsigned tmp, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeHvxVRRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static MCDisassembler * createHexagonDisassembler(const Target &T, const MCSubtargetInfo &STI, MCContext &Ctx)
static DecodeStatus DecodeSysRegs64RegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeModRegsRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static const uint16_t SysReg64DecoderTable[]
static DecodeStatus DecodeHlxLRRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeRegisterClass(MCInst &Inst, unsigned RegNo, ArrayRef< MCPhysReg > Table)
static DecodeStatus DecodeSysRegsRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeDoubleRegsRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus n1ConstDecoder(MCInst &MI, const MCDisassembler *Decoder)
static const uint16_t SysRegDecoderTable[]
static DecodeStatus DecodeGeneralSubRegsRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeHvxWRRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeIntRegsRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeHvxQRRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeCtrRegs64RegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeGeneralDoubleLow8RegsRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeGuestRegs64RegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeHlxLLRRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeHvxVQRRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
#define HEXAGON_MAX_PACKET_SIZE
#define HEXAGON_INSTR_SIZE
Promote Memory to Register
Func getContext().diagnose(DiagnosticInfoUnsupported(Func
static constexpr unsigned IntRegDecoderTable[]
Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
Get the array size.
ArrayRef< T > slice(size_t N, size_t M) const
slice(n, m) - Chop off the first N elements of the array, and keep M elements in the array.
Tagged union holding either a T or a Error.
static LLVM_ABI const MCConstantExpr * create(int64_t Value, MCContext &Ctx, bool PrintInHex=false, unsigned SizeInBytes=0)
Context object for machine code objects.
Superclass for all disassemblers.
DecodeStatus
Ternary decode status.
Instances of this class represent a single low-level machine instruction.
void addOperand(const MCOperand Op)
const MCOperand & getOperand(unsigned i) const
Interface to description of machine instruction set.
Instances of this class represent operands of the MCInst class.
static MCOperand createExpr(const MCExpr *Val)
static MCOperand createReg(MCRegister Reg)
static MCOperand createImm(int64_t Val)
void setReg(MCRegister Reg)
Set the register number.
MCRegister getReg() const
Returns the register number.
const MCInst * getInst() const
const MCExpr * getExpr() const
static MCOperand createInst(const MCInst *Val)
Generic base class for all target subtargets.
Wrapper class representing virtual and physical registers.
Target - Wrapper for Target specific information.
LLVM Value Representation.
This class implements an extremely fast bulk output stream that can only output to a stream.
void setOuterLoop(MCInst &MCI)
void addConstant(MCInst &MI, uint64_t Value, MCContext &Context)
bool IsReverseVecRegPair(MCRegister VecReg)
size_t bundleSize(MCInst const &MCI)
bool isDuplex(MCInstrInfo const &MCII, MCInst const &MCI)
unsigned getExtentBits(MCInstrInfo const &MCII, MCInst const &MCI)
bool isNewValue(MCInstrInfo const &MCII, MCInst const &MCI)
Return whether the insn expects newly produced value.
void setInnerLoop(MCInst &MCI)
unsigned short getNewValueOp(MCInstrInfo const &MCII, MCInst const &MCI)
bool isHLX(MCInstrInfo const &MCII, MCInst const &MCI)
unsigned short getExtendableOp(MCInstrInfo const &MCII, MCInst const &MCI)
bool IsVecRegPair(MCRegister VecReg)
iterator_range< Hexagon::PacketIterator > bundleInstructions(MCInstrInfo const &MCII, MCInst const &MCI)
bool isExtendable(MCInstrInfo const &MCII, MCInst const &MCI)
MCInst const * extenderForIndex(MCInst const &MCB, size_t Index)
bool isImmext(MCInst const &MCI)
MCOperand const & getNewValueOperand(MCInstrInfo const &MCII, MCInst const &MCI)
bool hasNewValue2(MCInstrInfo const &MCII, MCInst const &MCI)
Return whether the insn produces a second value.
unsigned getExtentAlignment(MCInstrInfo const &MCII, MCInst const &MCI)
bool isVector(MCInstrInfo const &MCII, MCInst const &MCI)
MCOperand const & getNewValueOperand2(MCInstrInfo const &MCII, MCInst const &MCI)
bool isExtended(MCInstrInfo const &MCII, MCInst const &MCI)
bool hasNewValue(MCInstrInfo const &MCII, MCInst const &MCI)
Return whether the insn produces a value.
MCSubtargetInfo const * getArchSubtarget(MCSubtargetInfo const *STI)
friend class Instruction
Iterator for Instructions in a `BasicBlock.
uint32_t read32le(const void *P)
This is an optimization pass for GlobalISel generic memory operations.
Target & getTheHexagonTarget()
unsigned M1(unsigned Val)
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
unsigned M0(unsigned Val)
constexpr int64_t SignExtend64(uint64_t x)
Sign-extend the number in the bottom B bits of X to a 64-bit integer.
static void RegisterMCDisassembler(Target &T, Target::MCDisassemblerCtorTy Fn)
RegisterMCDisassembler - Register a MCDisassembler implementation for the given target.