1 //===-- EmulateInstructionMIPS64.h ------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef EmulateInstructionMIPS64_h_
11 #define EmulateInstructionMIPS64_h_
13 #include "lldb/Core/EmulateInstruction.h"
14 #include "lldb/Interpreter/OptionValue.h"
15 #include "lldb/Utility/Status.h"
19 class MCSubtargetInfo;
27 class EmulateInstructionMIPS64 : public lldb_private::EmulateInstruction {
29 EmulateInstructionMIPS64(const lldb_private::ArchSpec &arch);
31 static void Initialize();
33 static void Terminate();
35 static lldb_private::ConstString GetPluginNameStatic();
37 static const char *GetPluginDescriptionStatic();
39 static lldb_private::EmulateInstruction *
40 CreateInstance(const lldb_private::ArchSpec &arch,
41 lldb_private::InstructionType inst_type);
43 static bool SupportsEmulatingInstructionsOfTypeStatic(
44 lldb_private::InstructionType inst_type) {
46 case lldb_private::eInstructionTypeAny:
47 case lldb_private::eInstructionTypePrologueEpilogue:
48 case lldb_private::eInstructionTypePCModifying:
51 case lldb_private::eInstructionTypeAll:
57 lldb_private::ConstString GetPluginName() override;
59 uint32_t GetPluginVersion() override { return 1; }
61 bool SetTargetTriple(const lldb_private::ArchSpec &arch) override;
63 bool SupportsEmulatingInstructionsOfType(
64 lldb_private::InstructionType inst_type) override {
65 return SupportsEmulatingInstructionsOfTypeStatic(inst_type);
68 bool ReadInstruction() override;
70 bool EvaluateInstruction(uint32_t evaluate_options) override;
72 bool TestEmulation(lldb_private::Stream *out_stream,
73 lldb_private::ArchSpec &arch,
74 lldb_private::OptionValueDictionary *test_data) override {
78 bool GetRegisterInfo(lldb::RegisterKind reg_kind, uint32_t reg_num,
79 lldb_private::RegisterInfo ®_info) override;
82 CreateFunctionEntryUnwind(lldb_private::UnwindPlan &unwind_plan) override;
87 bool (EmulateInstructionMIPS64::*callback)(llvm::MCInst &insn);
88 const char *insn_name;
91 static MipsOpcode *GetOpcodeForInstruction(const char *op_name);
93 bool Emulate_DADDiu(llvm::MCInst &insn);
95 bool Emulate_DSUBU_DADDU(llvm::MCInst &insn);
97 bool Emulate_LUI(llvm::MCInst &insn);
99 bool Emulate_SD(llvm::MCInst &insn);
101 bool Emulate_LD(llvm::MCInst &insn);
103 bool Emulate_LDST_Imm(llvm::MCInst &insn);
105 bool Emulate_LDST_Reg(llvm::MCInst &insn);
107 bool Emulate_BXX_3ops(llvm::MCInst &insn);
109 bool Emulate_BXX_3ops_C(llvm::MCInst &insn);
111 bool Emulate_BXX_2ops(llvm::MCInst &insn);
113 bool Emulate_BXX_2ops_C(llvm::MCInst &insn);
115 bool Emulate_Bcond_Link_C(llvm::MCInst &insn);
117 bool Emulate_Bcond_Link(llvm::MCInst &insn);
119 bool Emulate_FP_branch(llvm::MCInst &insn);
121 bool Emulate_3D_branch(llvm::MCInst &insn);
123 bool Emulate_BAL(llvm::MCInst &insn);
125 bool Emulate_BALC(llvm::MCInst &insn);
127 bool Emulate_BC(llvm::MCInst &insn);
129 bool Emulate_J(llvm::MCInst &insn);
131 bool Emulate_JAL(llvm::MCInst &insn);
133 bool Emulate_JALR(llvm::MCInst &insn);
135 bool Emulate_JIALC(llvm::MCInst &insn);
137 bool Emulate_JIC(llvm::MCInst &insn);
139 bool Emulate_JR(llvm::MCInst &insn);
141 bool Emulate_BC1EQZ(llvm::MCInst &insn);
143 bool Emulate_BC1NEZ(llvm::MCInst &insn);
145 bool Emulate_BNZB(llvm::MCInst &insn);
147 bool Emulate_BNZH(llvm::MCInst &insn);
149 bool Emulate_BNZW(llvm::MCInst &insn);
151 bool Emulate_BNZD(llvm::MCInst &insn);
153 bool Emulate_BZB(llvm::MCInst &insn);
155 bool Emulate_BZH(llvm::MCInst &insn);
157 bool Emulate_BZW(llvm::MCInst &insn);
159 bool Emulate_BZD(llvm::MCInst &insn);
161 bool Emulate_MSA_Branch_DF(llvm::MCInst &insn, int element_byte_size,
164 bool Emulate_BNZV(llvm::MCInst &insn);
166 bool Emulate_BZV(llvm::MCInst &insn);
168 bool Emulate_MSA_Branch_V(llvm::MCInst &insn, bool bnz);
170 bool nonvolatile_reg_p(uint64_t regnum);
172 const char *GetRegisterName(unsigned reg_num, bool altnernate_name);
175 std::unique_ptr<llvm::MCDisassembler> m_disasm;
176 std::unique_ptr<llvm::MCSubtargetInfo> m_subtype_info;
177 std::unique_ptr<llvm::MCRegisterInfo> m_reg_info;
178 std::unique_ptr<llvm::MCAsmInfo> m_asm_info;
179 std::unique_ptr<llvm::MCContext> m_context;
180 std::unique_ptr<llvm::MCInstrInfo> m_insn_info;
183 #endif // EmulateInstructionMIPS64_h_