24#include "llvm-c/Disassembler.h"
25#include "llvm/MC/MCAsmInfo.h"
26#include "llvm/MC/MCContext.h"
27#include "llvm/MC/MCDisassembler/MCDisassembler.h"
28#include "llvm/MC/MCInst.h"
29#include "llvm/MC/MCInstrInfo.h"
30#include "llvm/MC/MCRegisterInfo.h"
31#include "llvm/MC/MCSubtargetInfo.h"
32#include "llvm/MC/MCTargetOptions.h"
33#include "llvm/MC/TargetRegistry.h"
34#include "llvm/Support/TargetSelect.h"
36#include "llvm/ADT/STLExtras.h"
46#define UInt(x) ((uint64_t)x)
47#define integer int64_t
55void LLVMInitializeMipsTargetInfo();
56void LLVMInitializeMipsTarget();
57void LLVMInitializeMipsAsmPrinter();
58void LLVMInitializeMipsTargetMC();
59void LLVMInitializeMipsDisassembler();
69 const llvm::Target *target =
70 llvm::TargetRegistry::lookupTarget(triple.getTriple(),
Status);
82 LLVMInitializeMipsTargetInfo();
83 LLVMInitializeMipsTarget();
84 LLVMInitializeMipsAsmPrinter();
85 LLVMInitializeMipsTargetMC();
86 LLVMInitializeMipsDisassembler();
87 target = llvm::TargetRegistry::lookupTarget(triple.getTriple(),
Status);
141 std::string features;
148 features +=
"+dspr2,";
150 features +=
"+mips16,";
152 features +=
"+micromips,";
154 m_reg_info.reset(target->createMCRegInfo(triple.getTriple()));
160 llvm::MCTargetOptions MCOptions;
162 target->createMCAsmInfo(*
m_reg_info, triple.getTriple(), MCOptions));
164 target->createMCSubtargetInfo(triple.getTriple(), cpu, features));
167 m_context = std::make_unique<llvm::MCContext>(
185 return "Emulate instructions for the MIPS64 architecture.";
193 if (arch.
GetTriple().getArch() == llvm::Triple::mips64 ||
194 arch.
GetTriple().getArch() == llvm::Triple::mips64el) {
203 return arch.
GetTriple().getArch() == llvm::Triple::mips64 ||
204 arch.
GetTriple().getArch() == llvm::Triple::mips64el;
208 bool alternate_name) {
209 if (alternate_name) {
576std::optional<RegisterInfo>
607 RegisterInfo reg_info;
608 ::memset(®_info, 0,
sizeof(RegisterInfo));
614 reg_info.byte_size = 4;
619 reg_info.byte_size = 8;
624 reg_info.byte_size = 16;
664 "DADDIU rt, rs, immediate"},
666 "ADDIU rt, rs, immediate"},
688 "LB rt, offset(base)"},
690 "LBE rt, offset(base)"},
692 "LBU rt, offset(base)"},
694 "LBUE rt, offset(base)"},
696 "LDC1 ft, offset(base)"},
698 "LDL rt, offset(base)"},
700 "LDR rt, offset(base)"},
702 "LLD rt, offset(base)"},
704 "LDC2 rt, offset(base)"},
706 "LDXC1 fd, index (base)"},
708 "LH rt, offset(base)"},
710 "LHE rt, offset(base)"},
712 "LHU rt, offset(base)"},
714 "LHUE rt, offset(base)"},
716 "LL rt, offset(base)"},
718 "LLE rt, offset(base)"},
720 "LUXC1 fd, index (base)"},
722 "LW rt, offset(rs)"},
724 "LWC1 ft, offset(base)"},
726 "LWC2 rt, offset(base)"},
728 "LWE rt, offset(base)"},
730 "LWL rt, offset(base)"},
732 "LWLE rt, offset(base)"},
734 "LWR rt, offset(base)"},
736 "LWRE rt, offset(base)"},
738 "LWXC1 fd, index (base)"},
741 "SB rt, offset(base)"},
743 "SBE rt, offset(base)"},
745 "SC rt, offset(base)"},
747 "SCE rt, offset(base)"},
749 "SCD rt, offset(base)"},
751 "SDL rt, offset(base)"},
753 "SDR rt, offset(base)"},
755 "SDC1 ft, offset(base)"},
757 "SDC2 rt, offset(base)"},
759 "SDXC1 fs, index (base)"},
761 "SH rt, offset(base)"},
763 "SHE rt, offset(base)"},
765 "SUXC1 fs, index (base)"},
767 "SW rt, offset(rs)"},
769 "SWC1 ft, offset(base)"},
771 "SWC2 rt, offset(base)"},
773 "SWE rt, offset(base)"},
775 "SWL rt, offset(base)"},
777 "SWLE rt, offset(base)"},
779 "SWR rt, offset(base)"},
781 "SWRE rt, offset(base)"},
783 "SWXC1 fs, index (base)"},
791 "BEQL rs,rt,offset"},
793 "BNEL rs,rt,offset"},
795 "BGEZALL rt,offset"},
804 "BLEZALC rs,offset"},
806 "BGEZALC rs,offset"},
808 "BLTZALC rs,offset"},
810 "BGTZALC rs,offset"},
812 "BEQZALC rs,offset"},
814 "BNEZALC rs,offset"},
816 "BEQC rs,rt,offset"},
818 "BEQC rs,rt,offset"},
820 "BNEC rs,rt,offset"},
822 "BNEC rs,rt,offset"},
824 "BLTC rs,rt,offset"},
826 "BLTC rs,rt,offset"},
828 "BGEC rs,rt,offset"},
830 "BGEC rs,rt,offset"},
832 "BLTUC rs,rt,offset"},
834 "BLTUC rs,rt,offset"},
836 "BGEUC rs,rt,offset"},
838 "BGEUC rs,rt,offset"},
875 "BLTZALL rt,offset"},
878 "BOVC rs,rt,offset"},
880 "BNVC rs,rt,offset"},
901 "BC1EQZ ft, offset"},
903 "BC1NEZ ft, offset"},
905 "BC1ANY2F cc, offset"},
907 "BC1ANY2T cc, offset"},
909 "BC1ANY4F cc, offset"},
911 "BC1ANY4T cc, offset"},
925 if (op_name.equals_insensitive(opcode.op_name))
932 bool success =
false;
949 bool success =
false;
950 llvm::MCInst mc_insn;
957 llvm::MCDisassembler::DecodeStatus decode_status;
959 decode_status =
m_disasm->getInstruction(mc_insn, insn_size, raw_insn,
961 if (decode_status != llvm::MCDisassembler::Success)
969 llvm::StringRef op_name =
m_insn_info->getName(mc_insn.getOpcode());
977 if (opcode_data ==
nullptr)
980 uint64_t old_pc = 0, new_pc = 0;
981 const bool auto_advance_pc =
982 evaluate_options & eEmulateInstructionOptionAutoAdvancePC;
984 if (auto_advance_pc) {
992 success = (this->*opcode_data->
callback)(mc_insn);
996 if (auto_advance_pc) {
1003 if (old_pc == new_pc) {
1017 unwind_plan.
Clear();
1021 const bool can_replace =
false;
1068 bool success =
false;
1069 const uint32_t imm16 = insn.getOperand(2).getImm();
1072 dst =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1073 src =
m_reg_info->getEncodingValue(insn.getOperand(1).getReg());
1101 uint64_t result = src_opd_val + imm;
1102 std::optional<RegisterInfo> reg_info_sp =
1129 bool success =
false;
1130 uint32_t imm16 = insn.getOperand(2).getImm();
1135 src =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1136 base =
m_reg_info->getEncodingValue(insn.getOperand(1).getReg());
1138 std::optional<RegisterInfo> reg_info_base =
1140 std::optional<RegisterInfo> reg_info_src =
1142 if (!reg_info_base || !reg_info_src)
1152 address = address + imm;
1163 std::optional<RegisterValue> data_src =
ReadRegister(*reg_info_base);
1167 if (data_src->GetAsMemoryData(*reg_info_src, buffer,
1172 if (!
WriteMemory(context, address, buffer, reg_info_src->byte_size))
1185 bool success =
false;
1187 int64_t imm, address;
1190 src =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1191 base =
m_reg_info->getEncodingValue(insn.getOperand(1).getReg());
1192 imm = insn.getOperand(2).getImm();
1204 address = address + imm;
1213 std::optional<RegisterInfo> reg_info_src =
1231 const uint32_t imm32 = insn.getOperand(1).getImm() << 16;
1236 rt =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1249 bool success =
false;
1251 uint8_t src, dst, rt;
1252 llvm::StringRef op_name =
m_insn_info->getName(insn.getOpcode());
1254 dst =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1255 src =
m_reg_info->getEncodingValue(insn.getOperand(1).getReg());
1259 rt =
m_reg_info->getEncodingValue(insn.getOperand(2).getReg());
1273 if (op_name.equals_insensitive(
"DSUBU") ||
1274 op_name.equals_insensitive(
"SUBU"))
1275 result = src_opd_val - rt_opd_val;
1277 result = src_opd_val + rt_opd_val;
1280 std::optional<RegisterInfo> reg_info_sp =
1292 rt =
m_reg_info->getEncodingValue(insn.getOperand(2).getReg());
1308 if (op_name.equals_insensitive(
"DSUBU") ||
1309 op_name.equals_insensitive(
"SUBU"))
1310 result = src_opd_val - rt_opd_val;
1312 result = src_opd_val + rt_opd_val;
1331 bool success =
false;
1333 int64_t offset,
pc, rs_val, rt_val, target = 0;
1334 llvm::StringRef op_name =
m_insn_info->getName(insn.getOpcode());
1336 rs =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1337 rt =
m_reg_info->getEncodingValue(insn.getOperand(1).getReg());
1338 offset = insn.getOperand(2).getImm();
1354 if (op_name.equals_insensitive(
"BEQ") || op_name.equals_insensitive(
"BEQL") ||
1355 op_name.equals_insensitive(
"BEQ64")) {
1356 if (rs_val == rt_val)
1357 target =
pc + offset;
1360 }
else if (op_name.equals_insensitive(
"BNE") ||
1361 op_name.equals_insensitive(
"BNEL") ||
1362 op_name.equals_insensitive(
"BNE64")) {
1363 if (rs_val != rt_val)
1364 target =
pc + offset;
1383 bool success =
false;
1385 int64_t offset,
pc, target = 0;
1387 llvm::StringRef op_name =
m_insn_info->getName(insn.getOpcode());
1389 rs =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1390 offset = insn.getOperand(1).getImm();
1401 if (op_name.equals_insensitive(
"BLTZAL") ||
1402 op_name.equals_insensitive(
"BLTZALL")) {
1404 target =
pc + offset;
1407 }
else if (op_name.equals_insensitive(
"BGEZAL") ||
1408 op_name.equals_insensitive(
"BGEZALL")) {
1410 target =
pc + offset;
1429 bool success =
false;
1430 int64_t offset,
pc, target;
1438 offset = insn.getOperand(0).getImm();
1444 target =
pc + offset;
1460 bool success =
false;
1461 int64_t offset,
pc, target;
1469 offset = insn.getOperand(0).getImm();
1475 target =
pc + offset;
1495 bool success =
false;
1497 int64_t offset,
pc, rs_val, target = 0;
1498 llvm::StringRef op_name =
m_insn_info->getName(insn.getOpcode());
1500 rs =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1501 offset = insn.getOperand(1).getImm();
1512 if (op_name.equals_insensitive(
"BLEZALC")) {
1514 target =
pc + offset;
1517 }
else if (op_name.equals_insensitive(
"BGEZALC")) {
1519 target =
pc + offset;
1522 }
else if (op_name.equals_insensitive(
"BLTZALC")) {
1524 target =
pc + offset;
1527 }
else if (op_name.equals_insensitive(
"BGTZALC")) {
1529 target =
pc + offset;
1532 }
else if (op_name.equals_insensitive(
"BEQZALC")) {
1534 target =
pc + offset;
1537 }
else if (op_name.equals_insensitive(
"BNEZALC")) {
1539 target =
pc + offset;
1563 bool success =
false;
1565 int64_t offset,
pc, rs_val, target = 0;
1566 llvm::StringRef op_name =
m_insn_info->getName(insn.getOpcode());
1568 rs =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1569 offset = insn.getOperand(1).getImm();
1580 if (op_name.equals_insensitive(
"BLTZL") ||
1581 op_name.equals_insensitive(
"BLTZ") ||
1582 op_name.equals_insensitive(
"BLTZ64")) {
1584 target =
pc + offset;
1587 }
else if (op_name.equals_insensitive(
"BGEZL") ||
1588 op_name.equals_insensitive(
"BGEZ") ||
1589 op_name.equals_insensitive(
"BGEZ64")) {
1591 target =
pc + offset;
1594 }
else if (op_name.equals_insensitive(
"BGTZL") ||
1595 op_name.equals_insensitive(
"BGTZ") ||
1596 op_name.equals_insensitive(
"BGTZ64")) {
1598 target =
pc + offset;
1601 }
else if (op_name.equals_insensitive(
"BLEZL") ||
1602 op_name.equals_insensitive(
"BLEZ") ||
1603 op_name.equals_insensitive(
"BLEZ64")) {
1605 target =
pc + offset;
1619 bool success =
false;
1620 int64_t offset,
pc, target;
1627 offset = insn.getOperand(0).getImm();
1633 target =
pc + offset;
1642 int64_t r = (uint64_t)a + (uint64_t)b;
1643 return (a < 0 && b < 0 && r >= 0) || (a >= 0 && b >= 0 && r < 0);
1652 bool success =
false;
1654 int64_t offset,
pc, rs_val, rt_val, target = 0;
1655 llvm::StringRef op_name =
m_insn_info->getName(insn.getOpcode());
1658 rs =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1659 rt =
m_reg_info->getEncodingValue(insn.getOperand(1).getReg());
1660 offset = insn.getOperand(2).getImm();
1676 if (op_name.equals_insensitive(
"BEQC") ||
1677 op_name.equals_insensitive(
"BEQC64")) {
1678 if (rs_val == rt_val)
1679 target =
pc + offset;
1682 }
else if (op_name.equals_insensitive(
"BNEC") ||
1683 op_name.equals_insensitive(
"BNEC64")) {
1684 if (rs_val != rt_val)
1685 target =
pc + offset;
1688 }
else if (op_name.equals_insensitive(
"BLTC") ||
1689 op_name.equals_insensitive(
"BLTC64")) {
1690 if (rs_val < rt_val)
1691 target =
pc + offset;
1694 }
else if (op_name.equals_insensitive(
"BGEC64") ||
1695 op_name.equals_insensitive(
"BGEC")) {
1696 if (rs_val >= rt_val)
1697 target =
pc + offset;
1700 }
else if (op_name.equals_insensitive(
"BLTUC") ||
1701 op_name.equals_insensitive(
"BLTUC64")) {
1702 if (rs_val < rt_val)
1703 target =
pc + offset;
1706 }
else if (op_name.equals_insensitive(
"BGEUC") ||
1707 op_name.equals_insensitive(
"BGEUC64")) {
1709 target =
pc + offset;
1712 }
else if (op_name.equals_insensitive(
"BOVC")) {
1714 target =
pc + offset;
1717 }
else if (op_name.equals_insensitive(
"BNVC")) {
1719 target =
pc + offset;
1737 bool success =
false;
1739 int64_t offset,
pc, target = 0;
1741 llvm::StringRef op_name =
m_insn_info->getName(insn.getOpcode());
1744 rs =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1745 offset = insn.getOperand(1).getImm();
1756 if (op_name.equals_insensitive(
"BLTZC") ||
1757 op_name.equals_insensitive(
"BLTZC64")) {
1759 target =
pc + offset;
1762 }
else if (op_name.equals_insensitive(
"BLEZC") ||
1763 op_name.equals_insensitive(
"BLEZC64")) {
1765 target =
pc + offset;
1768 }
else if (op_name.equals_insensitive(
"BGEZC") ||
1769 op_name.equals_insensitive(
"BGEZC64")) {
1771 target =
pc + offset;
1774 }
else if (op_name.equals_insensitive(
"BGTZC") ||
1775 op_name.equals_insensitive(
"BGTZC64")) {
1777 target =
pc + offset;
1780 }
else if (op_name.equals_insensitive(
"BEQZC") ||
1781 op_name.equals_insensitive(
"BEQZC64")) {
1783 target =
pc + offset;
1786 }
else if (op_name.equals_insensitive(
"BNEZC") ||
1787 op_name.equals_insensitive(
"BNEZC64")) {
1789 target =
pc + offset;
1803 bool success =
false;
1804 uint64_t offset,
pc;
1811 offset = insn.getOperand(0).getImm();
1818 pc = (
pc & 0xFFFFFFFFF0000000ULL) | offset;
1827 bool success =
false;
1828 uint64_t offset, target,
pc;
1835 offset = insn.getOperand(0).getImm();
1842 target = (
pc & 0xFFFFFFFFF0000000ULL) | offset;
1858 bool success =
false;
1860 uint64_t
pc, rs_val;
1867 rt =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1868 rs =
m_reg_info->getEncodingValue(insn.getOperand(1).getReg());
1893 bool success =
false;
1895 int64_t target, offset,
pc, rt_val;
1903 rt =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1904 offset = insn.getOperand(1).getImm();
1915 target = rt_val + offset;
1931 bool success =
false;
1933 int64_t target, offset, rt_val;
1940 rt =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1941 offset = insn.getOperand(1).getImm();
1948 target = rt_val + offset;
1957 bool success =
false;
1965 rs =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1984 bool success =
false;
1986 int64_t
pc, offset, target = 0;
1987 llvm::StringRef op_name =
m_insn_info->getName(insn.getOpcode());
1996 cc =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1997 offset = insn.getOperand(1).getImm();
2009 fcsr = ((fcsr >> 24) & 0xfe) | ((fcsr >> 23) & 0x01);
2011 if (op_name.equals_insensitive(
"BC1F") ||
2012 op_name.equals_insensitive(
"BC1FL")) {
2013 if ((fcsr & (1 << cc)) == 0)
2014 target =
pc + offset;
2017 }
else if (op_name.equals_insensitive(
"BC1T") ||
2018 op_name.equals_insensitive(
"BC1TL")) {
2019 if ((fcsr & (1 << cc)) != 0)
2020 target =
pc + offset;
2032 bool success =
false;
2035 int64_t target,
pc, offset;
2044 ft =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
2045 offset = insn.getOperand(1).getImm();
2056 if ((ft_val & 1) == 0)
2057 target =
pc + 4 + offset;
2068 bool success =
false;
2071 int64_t target,
pc, offset;
2080 ft =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
2081 offset = insn.getOperand(1).getImm();
2092 if ((ft_val & 1) != 0)
2093 target =
pc + 4 + offset;
2111 bool success =
false;
2113 int64_t
pc, offset, target = 0;
2114 llvm::StringRef op_name =
m_insn_info->getName(insn.getOpcode());
2116 cc =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
2117 offset = insn.getOperand(1).getImm();
2129 fcsr = ((fcsr >> 24) & 0xfe) | ((fcsr >> 23) & 0x01);
2131 if (op_name.equals_insensitive(
"BC1ANY2F")) {
2133 if (((fcsr >> cc) & 3) != 3)
2134 target =
pc + offset;
2137 }
else if (op_name.equals_insensitive(
"BC1ANY2T")) {
2139 if (((fcsr >> cc) & 3) != 0)
2140 target =
pc + offset;
2143 }
else if (op_name.equals_insensitive(
"BC1ANY4F")) {
2145 if (((fcsr >> cc) & 0xf) != 0xf)
2146 target =
pc + offset;
2149 }
else if (op_name.equals_insensitive(
"BC1ANY4T")) {
2151 if (((fcsr >> cc) & 0xf) != 0)
2152 target =
pc + offset;
2196 int element_byte_size,
2198 bool success =
false, branch_hit =
true;
2201 const uint8_t *ptr =
nullptr;
2204 int64_t offset = insn.getOperand(1).getImm();
2212 ptr = (
const uint8_t *)reg_value.
GetBytes();
2216 for (
int i = 0; i < 16 / element_byte_size; i++) {
2217 switch (element_byte_size) {
2219 if ((*ptr == 0 && bnz) || (*ptr != 0 && !bnz))
2223 if ((*(
const uint16_t *)ptr == 0 && bnz) ||
2224 (*(
const uint16_t *)ptr != 0 && !bnz))
2228 if ((*(
const uint32_t *)ptr == 0 && bnz) ||
2229 (*(
const uint32_t *)ptr != 0 && !bnz))
2233 if ((*(
const uint64_t *)ptr == 0 && bnz) ||
2234 (*(
const uint64_t *)ptr != 0 && !bnz))
2240 ptr = ptr + element_byte_size;
2244 target =
pc + offset;
2265 bool success =
false;
2267 llvm::APInt wr_val = llvm::APInt::getZero(128);
2268 llvm::APInt fail_value = llvm::APInt::getMaxValue(128);
2269 llvm::APInt zero_value = llvm::APInt::getZero(128);
2273 int64_t offset = insn.getOperand(1).getImm();
2285 if ((llvm::APInt::isSameValue(zero_value, wr_val) && !bnz) ||
2286 (!llvm::APInt::isSameValue(zero_value, wr_val) && bnz))
2287 target =
pc + offset;
2299 bool success =
false;
2301 int64_t imm, address;
2304 uint32_t num_operands = insn.getNumOperands();
2306 m_reg_info->getEncodingValue(insn.getOperand(num_operands - 2).getReg());
2307 imm = insn.getOperand(num_operands - 1).getImm();
2319 address = address + imm;
2330 bool success =
false;
2332 int64_t address, index_address;
2335 uint32_t num_operands = insn.getNumOperands();
2337 m_reg_info->getEncodingValue(insn.getOperand(num_operands - 2).getReg());
2339 m_reg_info->getEncodingValue(insn.getOperand(num_operands - 1).getReg());
2360 address = address + index_address;
static llvm::raw_ostream & error(Stream &strm)
static int IsAdd64bitOverflow(int64_t a, int64_t b)
static int IsAdd64bitOverflow(int32_t a, int32_t b)
#define LLDB_PLUGIN_DEFINE_ADV(ClassName, PluginName)
bool ReadInstruction() override
std::unique_ptr< llvm::MCAsmInfo > m_asm_info
const char * GetRegisterName(unsigned reg_num, bool alternate_name)
bool Emulate_FP_branch(llvm::MCInst &insn)
bool Emulate_JIALC(llvm::MCInst &insn)
bool Emulate_BNZH(llvm::MCInst &insn)
bool Emulate_BXX_2ops(llvm::MCInst &insn)
static lldb_private::EmulateInstruction * CreateInstance(const lldb_private::ArchSpec &arch, lldb_private::InstructionType inst_type)
bool Emulate_Bcond_Link_C(llvm::MCInst &insn)
bool Emulate_SD(llvm::MCInst &insn)
bool Emulate_LD(llvm::MCInst &insn)
bool Emulate_BAL(llvm::MCInst &insn)
bool Emulate_BC(llvm::MCInst &insn)
bool Emulate_BXX_3ops_C(llvm::MCInst &insn)
bool Emulate_MSA_Branch_V(llvm::MCInst &insn, bool bnz)
bool Emulate_BZD(llvm::MCInst &insn)
bool Emulate_BNZV(llvm::MCInst &insn)
bool Emulate_BXX_3ops(llvm::MCInst &insn)
bool SetTargetTriple(const lldb_private::ArchSpec &arch) override
std::unique_ptr< llvm::MCDisassembler > m_disasm
bool Emulate_JR(llvm::MCInst &insn)
bool Emulate_JIC(llvm::MCInst &insn)
bool Emulate_LUI(llvm::MCInst &insn)
std::unique_ptr< llvm::MCContext > m_context
static MipsOpcode * GetOpcodeForInstruction(llvm::StringRef op_name)
bool Emulate_BXX_2ops_C(llvm::MCInst &insn)
bool Emulate_BNZB(llvm::MCInst &insn)
bool Emulate_3D_branch(llvm::MCInst &insn)
bool Emulate_BNZD(llvm::MCInst &insn)
static llvm::StringRef GetPluginDescriptionStatic()
static bool SupportsEmulatingInstructionsOfTypeStatic(lldb_private::InstructionType inst_type)
bool Emulate_LDST_Reg(llvm::MCInst &insn)
bool Emulate_LDST_Imm(llvm::MCInst &insn)
bool Emulate_BZW(llvm::MCInst &insn)
bool Emulate_DSUBU_DADDU(llvm::MCInst &insn)
bool Emulate_BZB(llvm::MCInst &insn)
bool Emulate_J(llvm::MCInst &insn)
bool Emulate_JALR(llvm::MCInst &insn)
bool Emulate_DADDiu(llvm::MCInst &insn)
std::unique_ptr< llvm::MCSubtargetInfo > m_subtype_info
std::unique_ptr< llvm::MCInstrInfo > m_insn_info
bool Emulate_BC1NEZ(llvm::MCInst &insn)
bool Emulate_MSA_Branch_DF(llvm::MCInst &insn, int element_byte_size, bool bnz)
std::unique_ptr< llvm::MCRegisterInfo > m_reg_info
bool Emulate_Bcond_Link(llvm::MCInst &insn)
bool Emulate_BC1EQZ(llvm::MCInst &insn)
bool Emulate_BZH(llvm::MCInst &insn)
bool Emulate_JAL(llvm::MCInst &insn)
bool Emulate_BZV(llvm::MCInst &insn)
bool nonvolatile_reg_p(uint64_t regnum)
bool CreateFunctionEntryUnwind(lldb_private::UnwindPlan &unwind_plan) override
EmulateInstructionMIPS64(const lldb_private::ArchSpec &arch)
bool Emulate_BALC(llvm::MCInst &insn)
std::optional< lldb_private::RegisterInfo > GetRegisterInfo(lldb::RegisterKind reg_kind, uint32_t reg_num) override
bool Emulate_BNZW(llvm::MCInst &insn)
static llvm::StringRef GetPluginNameStatic()
bool EvaluateInstruction(uint32_t evaluate_options) override
An architecture specification class.
llvm::Triple & GetTriple()
Architecture triple accessor.
uint32_t GetFlags() const
"lldb/Core/EmulateInstruction.h" A class that allows emulation of CPU opcodes.
@ eContextRelativeBranchImmediate
@ eContextAdjustStackPointer
@ eContextPushRegisterOnStack
lldb::ByteOrder GetByteOrder() const
std::optional< RegisterValue > ReadRegister(const RegisterInfo ®_info)
bool WriteRegister(const Context &context, const RegisterInfo &ref_info, const RegisterValue ®_value)
bool WriteRegisterUnsigned(const Context &context, const RegisterInfo ®_info, uint64_t reg_value)
bool WriteMemory(const Context &context, lldb::addr_t addr, const void *src, size_t src_len)
uint64_t ReadMemoryUnsigned(const Context &context, lldb::addr_t addr, size_t byte_size, uint64_t fail_value, bool *success_ptr)
uint64_t ReadRegisterUnsigned(const RegisterInfo ®_info, uint64_t fail_value, bool *success_ptr)
uint32_t GetData(DataExtractor &data) const
void SetOpcode32(uint32_t inst, lldb::ByteOrder order)
static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description, ABICreateInstance create_callback)
static bool UnregisterPlugin(ABICreateInstance create_callback)
llvm::APInt GetAsUInt128(const llvm::APInt &fail_value, bool *success_ptr=nullptr) const
const void * GetBytes() const
void SetUnwindPlanForSignalTrap(lldb_private::LazyBool is_for_signal_trap)
void SetRegisterKind(lldb::RegisterKind kind)
void SetReturnAddressRegister(uint32_t regnum)
void AppendRow(const RowSP &row_sp)
std::shared_ptr< Row > RowSP
void SetSourcedFromCompiler(lldb_private::LazyBool from_compiler)
void SetSourceName(const char *)
void SetUnwindPlanValidAtAllInstructions(lldb_private::LazyBool valid_at_all_insn)
#define LLDB_REGNUM_GENERIC_RA
#define LLDB_REGNUM_GENERIC_SP
#define LLDB_REGNUM_GENERIC_FLAGS
#define LLDB_INVALID_ADDRESS
#define LLDB_INVALID_REGNUM
#define LLDB_REGNUM_GENERIC_PC
#define LLDB_REGNUM_GENERIC_FP
A class that represents a running process on the host machine.
InstructionType
Instruction types.
static int64_t SignedBits(const uint64_t value, const uint64_t msbit, const uint64_t lsbit)
@ eEncodingVector
vector registers
@ eEncodingUint
unsigned integer
RegisterKind
Register numbering types.
@ eRegisterKindGeneric
insn ptr reg, stack ptr reg, etc not specific to any particular target
@ eRegisterKindDWARF
the register numbers seen DWARF
bool(EmulateInstructionMIPS64::* callback)(llvm::MCInst &insn)
void SetImmediate(uint64_t immediate)
void SetRegisterPlusOffset(RegisterInfo base_reg, int64_t signed_offset)
void SetImmediateSigned(int64_t signed_immediate)
void SetRegisterToRegisterPlusOffset(RegisterInfo data_reg, RegisterInfo base_reg, int64_t offset)