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,
Status);
82 LLVMInitializeMipsTargetInfo();
83 LLVMInitializeMipsTarget();
84 LLVMInitializeMipsAsmPrinter();
85 LLVMInitializeMipsTargetMC();
86 LLVMInitializeMipsDisassembler();
87 target = llvm::TargetRegistry::lookupTarget(triple,
Status);
141 std::string features;
142 uint32_t arch_flags = arch.
GetFlags();
148 features +=
"+dspr2,";
150 features +=
"+mips16,";
152 features +=
"+micromips,";
154 m_reg_info.reset(target->createMCRegInfo(triple));
161 m_subtype_info.reset(target->createMCSubtargetInfo(triple, cpu, features));
164 m_context = std::make_unique<llvm::MCContext>(
182 return "Emulate instructions for the MIPS64 architecture.";
190 if (arch.
GetTriple().getArch() == llvm::Triple::mips64 ||
191 arch.
GetTriple().getArch() == llvm::Triple::mips64el) {
200 return arch.
GetTriple().getArch() == llvm::Triple::mips64 ||
201 arch.
GetTriple().getArch() == llvm::Triple::mips64el;
205 bool alternate_name) {
206 if (alternate_name) {
573std::optional<RegisterInfo>
661 "DADDIU rt, rs, immediate"},
663 "ADDIU rt, rs, immediate"},
685 "LB rt, offset(base)"},
687 "LBE rt, offset(base)"},
689 "LBU rt, offset(base)"},
691 "LBUE rt, offset(base)"},
693 "LDC1 ft, offset(base)"},
695 "LDL rt, offset(base)"},
697 "LDR rt, offset(base)"},
699 "LLD rt, offset(base)"},
701 "LDC2 rt, offset(base)"},
703 "LDXC1 fd, index (base)"},
705 "LH rt, offset(base)"},
707 "LHE rt, offset(base)"},
709 "LHU rt, offset(base)"},
711 "LHUE rt, offset(base)"},
713 "LL rt, offset(base)"},
715 "LLE rt, offset(base)"},
717 "LUXC1 fd, index (base)"},
719 "LW rt, offset(rs)"},
721 "LWC1 ft, offset(base)"},
723 "LWC2 rt, offset(base)"},
725 "LWE rt, offset(base)"},
727 "LWL rt, offset(base)"},
729 "LWLE rt, offset(base)"},
731 "LWR rt, offset(base)"},
733 "LWRE rt, offset(base)"},
735 "LWXC1 fd, index (base)"},
738 "SB rt, offset(base)"},
740 "SBE rt, offset(base)"},
742 "SC rt, offset(base)"},
744 "SCE rt, offset(base)"},
746 "SCD rt, offset(base)"},
748 "SDL rt, offset(base)"},
750 "SDR rt, offset(base)"},
752 "SDC1 ft, offset(base)"},
754 "SDC2 rt, offset(base)"},
756 "SDXC1 fs, index (base)"},
758 "SH rt, offset(base)"},
760 "SHE rt, offset(base)"},
762 "SUXC1 fs, index (base)"},
764 "SW rt, offset(rs)"},
766 "SWC1 ft, offset(base)"},
768 "SWC2 rt, offset(base)"},
770 "SWE rt, offset(base)"},
772 "SWL rt, offset(base)"},
774 "SWLE rt, offset(base)"},
776 "SWR rt, offset(base)"},
778 "SWRE rt, offset(base)"},
780 "SWXC1 fs, index (base)"},
788 "BEQL rs,rt,offset"},
790 "BNEL rs,rt,offset"},
792 "BGEZALL rt,offset"},
801 "BLEZALC rs,offset"},
803 "BGEZALC rs,offset"},
805 "BLTZALC rs,offset"},
807 "BGTZALC rs,offset"},
809 "BEQZALC rs,offset"},
811 "BNEZALC rs,offset"},
813 "BEQC rs,rt,offset"},
815 "BEQC rs,rt,offset"},
817 "BNEC rs,rt,offset"},
819 "BNEC rs,rt,offset"},
821 "BLTC rs,rt,offset"},
823 "BLTC rs,rt,offset"},
825 "BGEC rs,rt,offset"},
827 "BGEC rs,rt,offset"},
829 "BLTUC rs,rt,offset"},
831 "BLTUC rs,rt,offset"},
833 "BGEUC rs,rt,offset"},
835 "BGEUC rs,rt,offset"},
872 "BLTZALL rt,offset"},
875 "BOVC rs,rt,offset"},
877 "BNVC rs,rt,offset"},
898 "BC1EQZ ft, offset"},
900 "BC1NEZ ft, offset"},
902 "BC1ANY2F cc, offset"},
904 "BC1ANY2T cc, offset"},
906 "BC1ANY4F cc, offset"},
908 "BC1ANY4T cc, offset"},
922 if (op_name.equals_insensitive(opcode.op_name))
929 bool success =
false;
946 bool success =
false;
947 llvm::MCInst mc_insn;
954 llvm::MCDisassembler::DecodeStatus decode_status;
956 decode_status =
m_disasm->getInstruction(mc_insn, insn_size, raw_insn,
958 if (decode_status != llvm::MCDisassembler::Success)
966 llvm::StringRef op_name =
m_insn_info->getName(mc_insn.getOpcode());
974 if (opcode_data ==
nullptr)
977 uint64_t old_pc = 0, new_pc = 0;
978 const bool auto_advance_pc =
979 evaluate_options & eEmulateInstructionOptionAutoAdvancePC;
981 if (auto_advance_pc) {
989 success = (this->*opcode_data->
callback)(mc_insn);
993 if (auto_advance_pc) {
1000 if (old_pc == new_pc) {
1014 unwind_plan.
Clear();
1018 const bool can_replace =
false;
1065 bool success =
false;
1066 const uint32_t imm16 = insn.getOperand(2).getImm();
1069 dst =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1070 src =
m_reg_info->getEncodingValue(insn.getOperand(1).getReg());
1098 uint64_t result = src_opd_val + imm;
1099 std::optional<RegisterInfo> reg_info_sp =
1126 bool success =
false;
1127 uint32_t imm16 = insn.getOperand(2).getImm();
1132 src =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1133 base =
m_reg_info->getEncodingValue(insn.getOperand(1).getReg());
1135 std::optional<RegisterInfo> reg_info_base =
1137 std::optional<RegisterInfo> reg_info_src =
1139 if (!reg_info_base || !reg_info_src)
1149 address = address + imm;
1157 std::optional<RegisterValue> data_src =
ReadRegister(*reg_info_base);
1163 if (data_src->GetAsMemoryData(*reg_info_src, buffer.data(),
1168 if (!
WriteMemory(context, address, buffer.data(), reg_info_src->byte_size))
1181 bool success =
false;
1183 int64_t imm, address;
1186 src =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1187 base =
m_reg_info->getEncodingValue(insn.getOperand(1).getReg());
1188 imm = insn.getOperand(2).getImm();
1200 address = address + imm;
1209 std::optional<RegisterInfo> reg_info_src =
1227 const uint32_t imm32 = insn.getOperand(1).getImm() << 16;
1232 rt =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1245 bool success =
false;
1247 uint8_t src, dst, rt;
1248 llvm::StringRef op_name =
m_insn_info->getName(insn.getOpcode());
1250 dst =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1251 src =
m_reg_info->getEncodingValue(insn.getOperand(1).getReg());
1255 rt =
m_reg_info->getEncodingValue(insn.getOperand(2).getReg());
1269 if (op_name.equals_insensitive(
"DSUBU") ||
1270 op_name.equals_insensitive(
"SUBU"))
1271 result = src_opd_val - rt_opd_val;
1273 result = src_opd_val + rt_opd_val;
1276 std::optional<RegisterInfo> reg_info_sp =
1288 rt =
m_reg_info->getEncodingValue(insn.getOperand(2).getReg());
1304 if (op_name.equals_insensitive(
"DSUBU") ||
1305 op_name.equals_insensitive(
"SUBU"))
1306 result = src_opd_val - rt_opd_val;
1308 result = src_opd_val + rt_opd_val;
1327 bool success =
false;
1329 int64_t offset,
pc, rs_val, rt_val, target = 0;
1330 llvm::StringRef op_name =
m_insn_info->getName(insn.getOpcode());
1332 rs =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1333 rt =
m_reg_info->getEncodingValue(insn.getOperand(1).getReg());
1334 offset = insn.getOperand(2).getImm();
1350 if (op_name.equals_insensitive(
"BEQ") || op_name.equals_insensitive(
"BEQL") ||
1351 op_name.equals_insensitive(
"BEQ64")) {
1352 if (rs_val == rt_val)
1353 target =
pc + offset;
1356 }
else if (op_name.equals_insensitive(
"BNE") ||
1357 op_name.equals_insensitive(
"BNEL") ||
1358 op_name.equals_insensitive(
"BNE64")) {
1359 if (rs_val != rt_val)
1360 target =
pc + offset;
1379 bool success =
false;
1381 int64_t offset,
pc, target = 0;
1383 llvm::StringRef op_name =
m_insn_info->getName(insn.getOpcode());
1385 rs =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1386 offset = insn.getOperand(1).getImm();
1397 if (op_name.equals_insensitive(
"BLTZAL") ||
1398 op_name.equals_insensitive(
"BLTZALL")) {
1400 target =
pc + offset;
1403 }
else if (op_name.equals_insensitive(
"BGEZAL") ||
1404 op_name.equals_insensitive(
"BGEZALL")) {
1406 target =
pc + offset;
1425 bool success =
false;
1426 int64_t offset,
pc, target;
1434 offset = insn.getOperand(0).getImm();
1440 target =
pc + offset;
1456 bool success =
false;
1457 int64_t offset,
pc, target;
1465 offset = insn.getOperand(0).getImm();
1471 target =
pc + offset;
1491 bool success =
false;
1493 int64_t offset,
pc, rs_val, target = 0;
1494 llvm::StringRef op_name =
m_insn_info->getName(insn.getOpcode());
1496 rs =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1497 offset = insn.getOperand(1).getImm();
1508 if (op_name.equals_insensitive(
"BLEZALC")) {
1510 target =
pc + offset;
1513 }
else if (op_name.equals_insensitive(
"BGEZALC")) {
1515 target =
pc + offset;
1518 }
else if (op_name.equals_insensitive(
"BLTZALC")) {
1520 target =
pc + offset;
1523 }
else if (op_name.equals_insensitive(
"BGTZALC")) {
1525 target =
pc + offset;
1528 }
else if (op_name.equals_insensitive(
"BEQZALC")) {
1530 target =
pc + offset;
1533 }
else if (op_name.equals_insensitive(
"BNEZALC")) {
1535 target =
pc + offset;
1559 bool success =
false;
1561 int64_t offset,
pc, rs_val, target = 0;
1562 llvm::StringRef op_name =
m_insn_info->getName(insn.getOpcode());
1564 rs =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1565 offset = insn.getOperand(1).getImm();
1576 if (op_name.equals_insensitive(
"BLTZL") ||
1577 op_name.equals_insensitive(
"BLTZ") ||
1578 op_name.equals_insensitive(
"BLTZ64")) {
1580 target =
pc + offset;
1583 }
else if (op_name.equals_insensitive(
"BGEZL") ||
1584 op_name.equals_insensitive(
"BGEZ") ||
1585 op_name.equals_insensitive(
"BGEZ64")) {
1587 target =
pc + offset;
1590 }
else if (op_name.equals_insensitive(
"BGTZL") ||
1591 op_name.equals_insensitive(
"BGTZ") ||
1592 op_name.equals_insensitive(
"BGTZ64")) {
1594 target =
pc + offset;
1597 }
else if (op_name.equals_insensitive(
"BLEZL") ||
1598 op_name.equals_insensitive(
"BLEZ") ||
1599 op_name.equals_insensitive(
"BLEZ64")) {
1601 target =
pc + offset;
1615 bool success =
false;
1616 int64_t offset,
pc, target;
1623 offset = insn.getOperand(0).getImm();
1629 target =
pc + offset;
1638 int64_t r = (uint64_t)a + (uint64_t)b;
1639 return (a < 0 && b < 0 && r >= 0) || (a >= 0 && b >= 0 && r < 0);
1648 bool success =
false;
1650 int64_t offset,
pc, rs_val, rt_val, target = 0;
1651 llvm::StringRef op_name =
m_insn_info->getName(insn.getOpcode());
1652 uint32_t current_inst_size =
m_insn_info->get(insn.getOpcode()).getSize();
1654 rs =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1655 rt =
m_reg_info->getEncodingValue(insn.getOperand(1).getReg());
1656 offset = insn.getOperand(2).getImm();
1672 if (op_name.equals_insensitive(
"BEQC") ||
1673 op_name.equals_insensitive(
"BEQC64")) {
1674 if (rs_val == rt_val)
1675 target =
pc + offset;
1678 }
else if (op_name.equals_insensitive(
"BNEC") ||
1679 op_name.equals_insensitive(
"BNEC64")) {
1680 if (rs_val != rt_val)
1681 target =
pc + offset;
1684 }
else if (op_name.equals_insensitive(
"BLTC") ||
1685 op_name.equals_insensitive(
"BLTC64")) {
1686 if (rs_val < rt_val)
1687 target =
pc + offset;
1690 }
else if (op_name.equals_insensitive(
"BGEC64") ||
1691 op_name.equals_insensitive(
"BGEC")) {
1692 if (rs_val >= rt_val)
1693 target =
pc + offset;
1696 }
else if (op_name.equals_insensitive(
"BLTUC") ||
1697 op_name.equals_insensitive(
"BLTUC64")) {
1698 if (rs_val < rt_val)
1699 target =
pc + offset;
1702 }
else if (op_name.equals_insensitive(
"BGEUC") ||
1703 op_name.equals_insensitive(
"BGEUC64")) {
1704 if ((uint32_t)rs_val >= (uint32_t)rt_val)
1705 target =
pc + offset;
1708 }
else if (op_name.equals_insensitive(
"BOVC")) {
1710 target =
pc + offset;
1713 }
else if (op_name.equals_insensitive(
"BNVC")) {
1715 target =
pc + offset;
1733 bool success =
false;
1735 int64_t offset,
pc, target = 0;
1737 llvm::StringRef op_name =
m_insn_info->getName(insn.getOpcode());
1738 uint32_t current_inst_size =
m_insn_info->get(insn.getOpcode()).getSize();
1740 rs =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1741 offset = insn.getOperand(1).getImm();
1752 if (op_name.equals_insensitive(
"BLTZC") ||
1753 op_name.equals_insensitive(
"BLTZC64")) {
1755 target =
pc + offset;
1758 }
else if (op_name.equals_insensitive(
"BLEZC") ||
1759 op_name.equals_insensitive(
"BLEZC64")) {
1761 target =
pc + offset;
1764 }
else if (op_name.equals_insensitive(
"BGEZC") ||
1765 op_name.equals_insensitive(
"BGEZC64")) {
1767 target =
pc + offset;
1770 }
else if (op_name.equals_insensitive(
"BGTZC") ||
1771 op_name.equals_insensitive(
"BGTZC64")) {
1773 target =
pc + offset;
1776 }
else if (op_name.equals_insensitive(
"BEQZC") ||
1777 op_name.equals_insensitive(
"BEQZC64")) {
1779 target =
pc + offset;
1782 }
else if (op_name.equals_insensitive(
"BNEZC") ||
1783 op_name.equals_insensitive(
"BNEZC64")) {
1785 target =
pc + offset;
1799 bool success =
false;
1800 uint64_t offset,
pc;
1807 offset = insn.getOperand(0).getImm();
1814 pc = (
pc & 0xFFFFFFFFF0000000ULL) | offset;
1823 bool success =
false;
1824 uint64_t offset, target,
pc;
1831 offset = insn.getOperand(0).getImm();
1838 target = (
pc & 0xFFFFFFFFF0000000ULL) | offset;
1854 bool success =
false;
1856 uint64_t
pc, rs_val;
1863 rt =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1864 rs =
m_reg_info->getEncodingValue(insn.getOperand(1).getReg());
1889 bool success =
false;
1891 int64_t target, offset,
pc, rt_val;
1899 rt =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1900 offset = insn.getOperand(1).getImm();
1911 target = rt_val + offset;
1927 bool success =
false;
1929 int64_t target, offset, rt_val;
1936 rt =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1937 offset = insn.getOperand(1).getImm();
1944 target = rt_val + offset;
1953 bool success =
false;
1961 rs =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1980 bool success =
false;
1982 int64_t
pc, offset, target = 0;
1983 llvm::StringRef op_name =
m_insn_info->getName(insn.getOpcode());
1992 cc =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1993 offset = insn.getOperand(1).getImm();
2005 fcsr = ((fcsr >> 24) & 0xfe) | ((fcsr >> 23) & 0x01);
2007 if (op_name.equals_insensitive(
"BC1F") ||
2008 op_name.equals_insensitive(
"BC1FL")) {
2009 if ((fcsr & (1 << cc)) == 0)
2010 target =
pc + offset;
2013 }
else if (op_name.equals_insensitive(
"BC1T") ||
2014 op_name.equals_insensitive(
"BC1TL")) {
2015 if ((fcsr & (1 << cc)) != 0)
2016 target =
pc + offset;
2028 bool success =
false;
2031 int64_t target,
pc, offset;
2040 ft =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
2041 offset = insn.getOperand(1).getImm();
2052 if ((ft_val & 1) == 0)
2053 target =
pc + 4 + offset;
2064 bool success =
false;
2067 int64_t target,
pc, offset;
2076 ft =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
2077 offset = insn.getOperand(1).getImm();
2088 if ((ft_val & 1) != 0)
2089 target =
pc + 4 + offset;
2107 bool success =
false;
2109 int64_t
pc, offset, target = 0;
2110 llvm::StringRef op_name =
m_insn_info->getName(insn.getOpcode());
2112 cc =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
2113 offset = insn.getOperand(1).getImm();
2125 fcsr = ((fcsr >> 24) & 0xfe) | ((fcsr >> 23) & 0x01);
2127 if (op_name.equals_insensitive(
"BC1ANY2F")) {
2129 if (((fcsr >> cc) & 3) != 3)
2130 target =
pc + offset;
2133 }
else if (op_name.equals_insensitive(
"BC1ANY2T")) {
2135 if (((fcsr >> cc) & 3) != 0)
2136 target =
pc + offset;
2139 }
else if (op_name.equals_insensitive(
"BC1ANY4F")) {
2141 if (((fcsr >> cc) & 0xf) != 0xf)
2142 target =
pc + offset;
2145 }
else if (op_name.equals_insensitive(
"BC1ANY4T")) {
2147 if (((fcsr >> cc) & 0xf) != 0)
2148 target =
pc + offset;
2192 int element_byte_size,
2194 bool success =
false, branch_hit =
true;
2197 const uint8_t *ptr =
nullptr;
2199 uint32_t wt =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
2200 int64_t offset = insn.getOperand(1).getImm();
2208 ptr = (
const uint8_t *)reg_value.
GetBytes();
2212 for (
int i = 0; i < 16 / element_byte_size; i++) {
2213 switch (element_byte_size) {
2215 if ((*ptr == 0 && bnz) || (*ptr != 0 && !bnz))
2219 if ((*(
const uint16_t *)ptr == 0 && bnz) ||
2220 (*(
const uint16_t *)ptr != 0 && !bnz))
2224 if ((*(
const uint32_t *)ptr == 0 && bnz) ||
2225 (*(
const uint32_t *)ptr != 0 && !bnz))
2229 if ((*(
const uint64_t *)ptr == 0 && bnz) ||
2230 (*(
const uint64_t *)ptr != 0 && !bnz))
2236 ptr = ptr + element_byte_size;
2240 target =
pc + offset;
2261 bool success =
false;
2263 llvm::APInt wr_val = llvm::APInt::getZero(128);
2264 llvm::APInt fail_value = llvm::APInt::getMaxValue(128);
2265 llvm::APInt zero_value = llvm::APInt::getZero(128);
2268 uint32_t wt =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
2269 int64_t offset = insn.getOperand(1).getImm();
2281 if ((llvm::APInt::isSameValue(zero_value, wr_val) && !bnz) ||
2282 (!llvm::APInt::isSameValue(zero_value, wr_val) && bnz))
2283 target =
pc + offset;
2295 bool success =
false;
2297 int64_t imm, address;
2300 uint32_t num_operands = insn.getNumOperands();
2302 m_reg_info->getEncodingValue(insn.getOperand(num_operands - 2).getReg());
2303 imm = insn.getOperand(num_operands - 1).getImm();
2315 address = address + imm;
2326 bool success =
false;
2327 uint32_t base, index;
2328 int64_t address, index_address;
2331 uint32_t num_operands = insn.getNumOperands();
2333 m_reg_info->getEncodingValue(insn.getOperand(num_operands - 2).getReg());
2335 m_reg_info->getEncodingValue(insn.getOperand(num_operands - 1).getReg());
2356 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
llvm::MCTargetOptions m_mc_options
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)
EmulateInstruction(const ArchSpec &arch)
uint64_t ReadRegisterUnsigned(const RegisterInfo ®_info, uint64_t fail_value, bool *success_ptr)
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
llvm::SmallVector< uint8_t, kTypicalRegisterByteSize > BytesContainer
void SetIsRegisterPlusOffset(uint32_t reg_num, int32_t offset)
const FAValue & GetCFAValue() const
bool SetRegisterLocationToRegister(uint32_t reg_num, uint32_t other_reg_num, bool can_replace)
void SetUnwindPlanForSignalTrap(lldb_private::LazyBool is_for_signal_trap)
void SetRegisterKind(lldb::RegisterKind kind)
void SetReturnAddressRegister(uint32_t regnum)
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)
Every register is described in detail including its name, alternate name (optional),...
lldb::Encoding encoding
Encoding of the register bits.
const char * alt_name
Alternate name of this register, can be NULL.
uint32_t byte_size
Size in bytes of the register.
uint32_t kinds[lldb::kNumRegisterKinds]
Holds all of the various register numbers for all register kinds.
const char * name
Name of this register, can't be NULL.
lldb::Format format
Default display format.