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));
160 llvm::MCTargetOptions MCOptions;
162 m_subtype_info.reset(target->createMCSubtargetInfo(triple, cpu, features));
165 m_context = std::make_unique<llvm::MCContext>(
183 return "Emulate instructions for the MIPS64 architecture.";
191 if (arch.
GetTriple().getArch() == llvm::Triple::mips64 ||
192 arch.
GetTriple().getArch() == llvm::Triple::mips64el) {
201 return arch.
GetTriple().getArch() == llvm::Triple::mips64 ||
202 arch.
GetTriple().getArch() == llvm::Triple::mips64el;
206 bool alternate_name) {
207 if (alternate_name) {
574std::optional<RegisterInfo>
662 "DADDIU rt, rs, immediate"},
664 "ADDIU rt, rs, immediate"},
686 "LB rt, offset(base)"},
688 "LBE rt, offset(base)"},
690 "LBU rt, offset(base)"},
692 "LBUE rt, offset(base)"},
694 "LDC1 ft, offset(base)"},
696 "LDL rt, offset(base)"},
698 "LDR rt, offset(base)"},
700 "LLD rt, offset(base)"},
702 "LDC2 rt, offset(base)"},
704 "LDXC1 fd, index (base)"},
706 "LH rt, offset(base)"},
708 "LHE rt, offset(base)"},
710 "LHU rt, offset(base)"},
712 "LHUE rt, offset(base)"},
714 "LL rt, offset(base)"},
716 "LLE rt, offset(base)"},
718 "LUXC1 fd, index (base)"},
720 "LW rt, offset(rs)"},
722 "LWC1 ft, offset(base)"},
724 "LWC2 rt, offset(base)"},
726 "LWE rt, offset(base)"},
728 "LWL rt, offset(base)"},
730 "LWLE rt, offset(base)"},
732 "LWR rt, offset(base)"},
734 "LWRE rt, offset(base)"},
736 "LWXC1 fd, index (base)"},
739 "SB rt, offset(base)"},
741 "SBE rt, offset(base)"},
743 "SC rt, offset(base)"},
745 "SCE rt, offset(base)"},
747 "SCD rt, offset(base)"},
749 "SDL rt, offset(base)"},
751 "SDR rt, offset(base)"},
753 "SDC1 ft, offset(base)"},
755 "SDC2 rt, offset(base)"},
757 "SDXC1 fs, index (base)"},
759 "SH rt, offset(base)"},
761 "SHE rt, offset(base)"},
763 "SUXC1 fs, index (base)"},
765 "SW rt, offset(rs)"},
767 "SWC1 ft, offset(base)"},
769 "SWC2 rt, offset(base)"},
771 "SWE rt, offset(base)"},
773 "SWL rt, offset(base)"},
775 "SWLE rt, offset(base)"},
777 "SWR rt, offset(base)"},
779 "SWRE rt, offset(base)"},
781 "SWXC1 fs, index (base)"},
789 "BEQL rs,rt,offset"},
791 "BNEL rs,rt,offset"},
793 "BGEZALL rt,offset"},
802 "BLEZALC rs,offset"},
804 "BGEZALC rs,offset"},
806 "BLTZALC rs,offset"},
808 "BGTZALC rs,offset"},
810 "BEQZALC rs,offset"},
812 "BNEZALC rs,offset"},
814 "BEQC rs,rt,offset"},
816 "BEQC rs,rt,offset"},
818 "BNEC rs,rt,offset"},
820 "BNEC rs,rt,offset"},
822 "BLTC rs,rt,offset"},
824 "BLTC rs,rt,offset"},
826 "BGEC rs,rt,offset"},
828 "BGEC rs,rt,offset"},
830 "BLTUC rs,rt,offset"},
832 "BLTUC rs,rt,offset"},
834 "BGEUC rs,rt,offset"},
836 "BGEUC rs,rt,offset"},
873 "BLTZALL rt,offset"},
876 "BOVC rs,rt,offset"},
878 "BNVC rs,rt,offset"},
899 "BC1EQZ ft, offset"},
901 "BC1NEZ ft, offset"},
903 "BC1ANY2F cc, offset"},
905 "BC1ANY2T cc, offset"},
907 "BC1ANY4F cc, offset"},
909 "BC1ANY4T cc, offset"},
923 if (op_name.equals_insensitive(opcode.op_name))
930 bool success =
false;
947 bool success =
false;
948 llvm::MCInst mc_insn;
955 llvm::MCDisassembler::DecodeStatus decode_status;
957 decode_status =
m_disasm->getInstruction(mc_insn, insn_size, raw_insn,
959 if (decode_status != llvm::MCDisassembler::Success)
967 llvm::StringRef op_name =
m_insn_info->getName(mc_insn.getOpcode());
975 if (opcode_data ==
nullptr)
978 uint64_t old_pc = 0, new_pc = 0;
979 const bool auto_advance_pc =
980 evaluate_options & eEmulateInstructionOptionAutoAdvancePC;
982 if (auto_advance_pc) {
990 success = (this->*opcode_data->
callback)(mc_insn);
994 if (auto_advance_pc) {
1001 if (old_pc == new_pc) {
1015 unwind_plan.
Clear();
1019 const bool can_replace =
false;
1066 bool success =
false;
1067 const uint32_t imm16 = insn.getOperand(2).getImm();
1070 dst =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1071 src =
m_reg_info->getEncodingValue(insn.getOperand(1).getReg());
1099 uint64_t result = src_opd_val + imm;
1100 std::optional<RegisterInfo> reg_info_sp =
1127 bool success =
false;
1128 uint32_t imm16 = insn.getOperand(2).getImm();
1133 src =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1134 base =
m_reg_info->getEncodingValue(insn.getOperand(1).getReg());
1136 std::optional<RegisterInfo> reg_info_base =
1138 std::optional<RegisterInfo> reg_info_src =
1140 if (!reg_info_base || !reg_info_src)
1150 address = address + imm;
1158 std::optional<RegisterValue> data_src =
ReadRegister(*reg_info_base);
1164 if (data_src->GetAsMemoryData(*reg_info_src, buffer.data(),
1169 if (!
WriteMemory(context, address, buffer.data(), reg_info_src->byte_size))
1182 bool success =
false;
1184 int64_t imm, address;
1187 src =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1188 base =
m_reg_info->getEncodingValue(insn.getOperand(1).getReg());
1189 imm = insn.getOperand(2).getImm();
1201 address = address + imm;
1210 std::optional<RegisterInfo> reg_info_src =
1228 const uint32_t imm32 = insn.getOperand(1).getImm() << 16;
1233 rt =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1246 bool success =
false;
1248 uint8_t src, dst, rt;
1249 llvm::StringRef op_name =
m_insn_info->getName(insn.getOpcode());
1251 dst =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1252 src =
m_reg_info->getEncodingValue(insn.getOperand(1).getReg());
1256 rt =
m_reg_info->getEncodingValue(insn.getOperand(2).getReg());
1270 if (op_name.equals_insensitive(
"DSUBU") ||
1271 op_name.equals_insensitive(
"SUBU"))
1272 result = src_opd_val - rt_opd_val;
1274 result = src_opd_val + rt_opd_val;
1277 std::optional<RegisterInfo> reg_info_sp =
1289 rt =
m_reg_info->getEncodingValue(insn.getOperand(2).getReg());
1305 if (op_name.equals_insensitive(
"DSUBU") ||
1306 op_name.equals_insensitive(
"SUBU"))
1307 result = src_opd_val - rt_opd_val;
1309 result = src_opd_val + rt_opd_val;
1328 bool success =
false;
1330 int64_t offset,
pc, rs_val, rt_val, target = 0;
1331 llvm::StringRef op_name =
m_insn_info->getName(insn.getOpcode());
1333 rs =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1334 rt =
m_reg_info->getEncodingValue(insn.getOperand(1).getReg());
1335 offset = insn.getOperand(2).getImm();
1351 if (op_name.equals_insensitive(
"BEQ") || op_name.equals_insensitive(
"BEQL") ||
1352 op_name.equals_insensitive(
"BEQ64")) {
1353 if (rs_val == rt_val)
1354 target =
pc + offset;
1357 }
else if (op_name.equals_insensitive(
"BNE") ||
1358 op_name.equals_insensitive(
"BNEL") ||
1359 op_name.equals_insensitive(
"BNE64")) {
1360 if (rs_val != rt_val)
1361 target =
pc + offset;
1380 bool success =
false;
1382 int64_t offset,
pc, target = 0;
1384 llvm::StringRef op_name =
m_insn_info->getName(insn.getOpcode());
1386 rs =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1387 offset = insn.getOperand(1).getImm();
1398 if (op_name.equals_insensitive(
"BLTZAL") ||
1399 op_name.equals_insensitive(
"BLTZALL")) {
1401 target =
pc + offset;
1404 }
else if (op_name.equals_insensitive(
"BGEZAL") ||
1405 op_name.equals_insensitive(
"BGEZALL")) {
1407 target =
pc + offset;
1426 bool success =
false;
1427 int64_t offset,
pc, target;
1435 offset = insn.getOperand(0).getImm();
1441 target =
pc + offset;
1457 bool success =
false;
1458 int64_t offset,
pc, target;
1466 offset = insn.getOperand(0).getImm();
1472 target =
pc + offset;
1492 bool success =
false;
1494 int64_t offset,
pc, rs_val, target = 0;
1495 llvm::StringRef op_name =
m_insn_info->getName(insn.getOpcode());
1497 rs =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1498 offset = insn.getOperand(1).getImm();
1509 if (op_name.equals_insensitive(
"BLEZALC")) {
1511 target =
pc + offset;
1514 }
else if (op_name.equals_insensitive(
"BGEZALC")) {
1516 target =
pc + offset;
1519 }
else if (op_name.equals_insensitive(
"BLTZALC")) {
1521 target =
pc + offset;
1524 }
else if (op_name.equals_insensitive(
"BGTZALC")) {
1526 target =
pc + offset;
1529 }
else if (op_name.equals_insensitive(
"BEQZALC")) {
1531 target =
pc + offset;
1534 }
else if (op_name.equals_insensitive(
"BNEZALC")) {
1536 target =
pc + offset;
1560 bool success =
false;
1562 int64_t offset,
pc, rs_val, target = 0;
1563 llvm::StringRef op_name =
m_insn_info->getName(insn.getOpcode());
1565 rs =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1566 offset = insn.getOperand(1).getImm();
1577 if (op_name.equals_insensitive(
"BLTZL") ||
1578 op_name.equals_insensitive(
"BLTZ") ||
1579 op_name.equals_insensitive(
"BLTZ64")) {
1581 target =
pc + offset;
1584 }
else if (op_name.equals_insensitive(
"BGEZL") ||
1585 op_name.equals_insensitive(
"BGEZ") ||
1586 op_name.equals_insensitive(
"BGEZ64")) {
1588 target =
pc + offset;
1591 }
else if (op_name.equals_insensitive(
"BGTZL") ||
1592 op_name.equals_insensitive(
"BGTZ") ||
1593 op_name.equals_insensitive(
"BGTZ64")) {
1595 target =
pc + offset;
1598 }
else if (op_name.equals_insensitive(
"BLEZL") ||
1599 op_name.equals_insensitive(
"BLEZ") ||
1600 op_name.equals_insensitive(
"BLEZ64")) {
1602 target =
pc + offset;
1616 bool success =
false;
1617 int64_t offset,
pc, target;
1624 offset = insn.getOperand(0).getImm();
1630 target =
pc + offset;
1639 int64_t r = (uint64_t)a + (uint64_t)b;
1640 return (a < 0 && b < 0 && r >= 0) || (a >= 0 && b >= 0 && r < 0);
1649 bool success =
false;
1651 int64_t offset,
pc, rs_val, rt_val, target = 0;
1652 llvm::StringRef op_name =
m_insn_info->getName(insn.getOpcode());
1653 uint32_t current_inst_size =
m_insn_info->get(insn.getOpcode()).getSize();
1655 rs =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1656 rt =
m_reg_info->getEncodingValue(insn.getOperand(1).getReg());
1657 offset = insn.getOperand(2).getImm();
1673 if (op_name.equals_insensitive(
"BEQC") ||
1674 op_name.equals_insensitive(
"BEQC64")) {
1675 if (rs_val == rt_val)
1676 target =
pc + offset;
1679 }
else if (op_name.equals_insensitive(
"BNEC") ||
1680 op_name.equals_insensitive(
"BNEC64")) {
1681 if (rs_val != rt_val)
1682 target =
pc + offset;
1685 }
else if (op_name.equals_insensitive(
"BLTC") ||
1686 op_name.equals_insensitive(
"BLTC64")) {
1687 if (rs_val < rt_val)
1688 target =
pc + offset;
1691 }
else if (op_name.equals_insensitive(
"BGEC64") ||
1692 op_name.equals_insensitive(
"BGEC")) {
1693 if (rs_val >= rt_val)
1694 target =
pc + offset;
1697 }
else if (op_name.equals_insensitive(
"BLTUC") ||
1698 op_name.equals_insensitive(
"BLTUC64")) {
1699 if (rs_val < rt_val)
1700 target =
pc + offset;
1703 }
else if (op_name.equals_insensitive(
"BGEUC") ||
1704 op_name.equals_insensitive(
"BGEUC64")) {
1705 if ((uint32_t)rs_val >= (uint32_t)rt_val)
1706 target =
pc + offset;
1709 }
else if (op_name.equals_insensitive(
"BOVC")) {
1711 target =
pc + offset;
1714 }
else if (op_name.equals_insensitive(
"BNVC")) {
1716 target =
pc + offset;
1734 bool success =
false;
1736 int64_t offset,
pc, target = 0;
1738 llvm::StringRef op_name =
m_insn_info->getName(insn.getOpcode());
1739 uint32_t current_inst_size =
m_insn_info->get(insn.getOpcode()).getSize();
1741 rs =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1742 offset = insn.getOperand(1).getImm();
1753 if (op_name.equals_insensitive(
"BLTZC") ||
1754 op_name.equals_insensitive(
"BLTZC64")) {
1756 target =
pc + offset;
1759 }
else if (op_name.equals_insensitive(
"BLEZC") ||
1760 op_name.equals_insensitive(
"BLEZC64")) {
1762 target =
pc + offset;
1765 }
else if (op_name.equals_insensitive(
"BGEZC") ||
1766 op_name.equals_insensitive(
"BGEZC64")) {
1768 target =
pc + offset;
1771 }
else if (op_name.equals_insensitive(
"BGTZC") ||
1772 op_name.equals_insensitive(
"BGTZC64")) {
1774 target =
pc + offset;
1777 }
else if (op_name.equals_insensitive(
"BEQZC") ||
1778 op_name.equals_insensitive(
"BEQZC64")) {
1780 target =
pc + offset;
1783 }
else if (op_name.equals_insensitive(
"BNEZC") ||
1784 op_name.equals_insensitive(
"BNEZC64")) {
1786 target =
pc + offset;
1800 bool success =
false;
1801 uint64_t offset,
pc;
1808 offset = insn.getOperand(0).getImm();
1815 pc = (
pc & 0xFFFFFFFFF0000000ULL) | offset;
1824 bool success =
false;
1825 uint64_t offset, target,
pc;
1832 offset = insn.getOperand(0).getImm();
1839 target = (
pc & 0xFFFFFFFFF0000000ULL) | offset;
1855 bool success =
false;
1857 uint64_t
pc, rs_val;
1864 rt =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1865 rs =
m_reg_info->getEncodingValue(insn.getOperand(1).getReg());
1890 bool success =
false;
1892 int64_t target, offset,
pc, rt_val;
1900 rt =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1901 offset = insn.getOperand(1).getImm();
1912 target = rt_val + offset;
1928 bool success =
false;
1930 int64_t target, offset, rt_val;
1937 rt =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1938 offset = insn.getOperand(1).getImm();
1945 target = rt_val + offset;
1954 bool success =
false;
1962 rs =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1981 bool success =
false;
1983 int64_t
pc, offset, target = 0;
1984 llvm::StringRef op_name =
m_insn_info->getName(insn.getOpcode());
1993 cc =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
1994 offset = insn.getOperand(1).getImm();
2006 fcsr = ((fcsr >> 24) & 0xfe) | ((fcsr >> 23) & 0x01);
2008 if (op_name.equals_insensitive(
"BC1F") ||
2009 op_name.equals_insensitive(
"BC1FL")) {
2010 if ((fcsr & (1 << cc)) == 0)
2011 target =
pc + offset;
2014 }
else if (op_name.equals_insensitive(
"BC1T") ||
2015 op_name.equals_insensitive(
"BC1TL")) {
2016 if ((fcsr & (1 << cc)) != 0)
2017 target =
pc + offset;
2029 bool success =
false;
2032 int64_t target,
pc, offset;
2041 ft =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
2042 offset = insn.getOperand(1).getImm();
2053 if ((ft_val & 1) == 0)
2054 target =
pc + 4 + offset;
2065 bool success =
false;
2068 int64_t target,
pc, offset;
2077 ft =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
2078 offset = insn.getOperand(1).getImm();
2089 if ((ft_val & 1) != 0)
2090 target =
pc + 4 + offset;
2108 bool success =
false;
2110 int64_t
pc, offset, target = 0;
2111 llvm::StringRef op_name =
m_insn_info->getName(insn.getOpcode());
2113 cc =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
2114 offset = insn.getOperand(1).getImm();
2126 fcsr = ((fcsr >> 24) & 0xfe) | ((fcsr >> 23) & 0x01);
2128 if (op_name.equals_insensitive(
"BC1ANY2F")) {
2130 if (((fcsr >> cc) & 3) != 3)
2131 target =
pc + offset;
2134 }
else if (op_name.equals_insensitive(
"BC1ANY2T")) {
2136 if (((fcsr >> cc) & 3) != 0)
2137 target =
pc + offset;
2140 }
else if (op_name.equals_insensitive(
"BC1ANY4F")) {
2142 if (((fcsr >> cc) & 0xf) != 0xf)
2143 target =
pc + offset;
2146 }
else if (op_name.equals_insensitive(
"BC1ANY4T")) {
2148 if (((fcsr >> cc) & 0xf) != 0)
2149 target =
pc + offset;
2193 int element_byte_size,
2195 bool success =
false, branch_hit =
true;
2198 const uint8_t *ptr =
nullptr;
2200 uint32_t wt =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
2201 int64_t offset = insn.getOperand(1).getImm();
2209 ptr = (
const uint8_t *)reg_value.
GetBytes();
2213 for (
int i = 0; i < 16 / element_byte_size; i++) {
2214 switch (element_byte_size) {
2216 if ((*ptr == 0 && bnz) || (*ptr != 0 && !bnz))
2220 if ((*(
const uint16_t *)ptr == 0 && bnz) ||
2221 (*(
const uint16_t *)ptr != 0 && !bnz))
2225 if ((*(
const uint32_t *)ptr == 0 && bnz) ||
2226 (*(
const uint32_t *)ptr != 0 && !bnz))
2230 if ((*(
const uint64_t *)ptr == 0 && bnz) ||
2231 (*(
const uint64_t *)ptr != 0 && !bnz))
2237 ptr = ptr + element_byte_size;
2241 target =
pc + offset;
2262 bool success =
false;
2264 llvm::APInt wr_val = llvm::APInt::getZero(128);
2265 llvm::APInt fail_value = llvm::APInt::getMaxValue(128);
2266 llvm::APInt zero_value = llvm::APInt::getZero(128);
2269 uint32_t wt =
m_reg_info->getEncodingValue(insn.getOperand(0).getReg());
2270 int64_t offset = insn.getOperand(1).getImm();
2282 if ((llvm::APInt::isSameValue(zero_value, wr_val) && !bnz) ||
2283 (!llvm::APInt::isSameValue(zero_value, wr_val) && bnz))
2284 target =
pc + offset;
2296 bool success =
false;
2298 int64_t imm, address;
2301 uint32_t num_operands = insn.getNumOperands();
2303 m_reg_info->getEncodingValue(insn.getOperand(num_operands - 2).getReg());
2304 imm = insn.getOperand(num_operands - 1).getImm();
2316 address = address + imm;
2327 bool success =
false;
2328 uint32_t base, index;
2329 int64_t address, index_address;
2332 uint32_t num_operands = insn.getNumOperands();
2334 m_reg_info->getEncodingValue(insn.getOperand(num_operands - 2).getReg());
2336 m_reg_info->getEncodingValue(insn.getOperand(num_operands - 1).getReg());
2357 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)
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.