[LoongArch][Clang] Make the parameters and return value of {x,}vorn.v builti ns ...
[llvm-project.git] / lldb / source / Plugins / Instruction / PPC64 / EmulateInstructionPPC64.h
bloba9424f16b0ad01ecd5510802aa785eaf43265a3b
1 //===-- EmulateInstructionPPC64.h -------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #ifndef LLDB_SOURCE_PLUGINS_INSTRUCTION_PPC64_EMULATEINSTRUCTIONPPC64_H
10 #define LLDB_SOURCE_PLUGINS_INSTRUCTION_PPC64_EMULATEINSTRUCTIONPPC64_H
12 #include "lldb/Core/EmulateInstruction.h"
13 #include "lldb/Interpreter/OptionValue.h"
14 #include "lldb/Utility/Log.h"
15 #include <optional>
17 namespace lldb_private {
19 class EmulateInstructionPPC64 : public EmulateInstruction {
20 public:
21 EmulateInstructionPPC64(const ArchSpec &arch);
23 static void Initialize();
25 static void Terminate();
27 static llvm::StringRef GetPluginNameStatic() { return "ppc64"; }
29 static llvm::StringRef GetPluginDescriptionStatic();
31 static EmulateInstruction *CreateInstance(const ArchSpec &arch,
32 InstructionType inst_type);
34 static bool
35 SupportsEmulatingInstructionsOfTypeStatic(InstructionType inst_type) {
36 switch (inst_type) {
37 case eInstructionTypeAny:
38 case eInstructionTypePrologueEpilogue:
39 return true;
41 case eInstructionTypePCModifying:
42 case eInstructionTypeAll:
43 return false;
45 return false;
48 llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
50 bool SetTargetTriple(const ArchSpec &arch) override;
52 bool SupportsEmulatingInstructionsOfType(InstructionType inst_type) override {
53 return SupportsEmulatingInstructionsOfTypeStatic(inst_type);
56 bool ReadInstruction() override;
58 bool EvaluateInstruction(uint32_t evaluate_options) override;
60 bool TestEmulation(Stream &out_stream, ArchSpec &arch,
61 OptionValueDictionary *test_data) override {
62 return false;
65 std::optional<RegisterInfo> GetRegisterInfo(lldb::RegisterKind reg_kind,
66 uint32_t reg_num) override;
68 bool CreateFunctionEntryUnwind(UnwindPlan &unwind_plan) override;
70 private:
71 struct Opcode {
72 uint32_t mask;
73 uint32_t value;
74 bool (EmulateInstructionPPC64::*callback)(uint32_t opcode);
75 const char *name;
78 uint32_t m_fp = LLDB_INVALID_REGNUM;
80 Opcode *GetOpcodeForInstruction(uint32_t opcode);
82 bool EmulateMFSPR(uint32_t opcode);
83 bool EmulateLD(uint32_t opcode);
84 bool EmulateSTD(uint32_t opcode);
85 bool EmulateOR(uint32_t opcode);
86 bool EmulateADDI(uint32_t opcode);
89 } // namespace lldb_private
91 #endif // LLDB_SOURCE_PLUGINS_INSTRUCTION_PPC64_EMULATEINSTRUCTIONPPC64_H