1 //===-- EmulateInstructionPPC64.h -------------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef EmulateInstructionPPC64_h_
10 #define EmulateInstructionPPC64_h_
12 #include "lldb/Core/EmulateInstruction.h"
13 #include "lldb/Interpreter/OptionValue.h"
14 #include "lldb/Utility/Log.h"
16 namespace lldb_private {
18 class EmulateInstructionPPC64 : public EmulateInstruction {
20 EmulateInstructionPPC64(const ArchSpec &arch);
22 static void Initialize();
24 static void Terminate();
26 static ConstString GetPluginNameStatic();
28 static const char *GetPluginDescriptionStatic();
30 static EmulateInstruction *CreateInstance(const ArchSpec &arch,
31 InstructionType inst_type);
34 SupportsEmulatingInstructionsOfTypeStatic(InstructionType inst_type) {
36 case eInstructionTypeAny:
37 case eInstructionTypePrologueEpilogue:
40 case eInstructionTypePCModifying:
41 case eInstructionTypeAll:
47 ConstString GetPluginName() override;
49 uint32_t GetPluginVersion() override { return 1; }
51 bool SetTargetTriple(const ArchSpec &arch) override;
53 bool SupportsEmulatingInstructionsOfType(InstructionType inst_type) override {
54 return SupportsEmulatingInstructionsOfTypeStatic(inst_type);
57 bool ReadInstruction() override;
59 bool EvaluateInstruction(uint32_t evaluate_options) override;
61 bool TestEmulation(Stream *out_stream, ArchSpec &arch,
62 OptionValueDictionary *test_data) override {
66 bool GetRegisterInfo(lldb::RegisterKind reg_kind, uint32_t reg_num,
67 RegisterInfo ®_info) override;
69 bool CreateFunctionEntryUnwind(UnwindPlan &unwind_plan) override;
75 bool (EmulateInstructionPPC64::*callback)(uint32_t opcode);
79 uint32_t m_fp = LLDB_INVALID_REGNUM;
81 Opcode *GetOpcodeForInstruction(uint32_t opcode);
83 bool EmulateMFSPR(uint32_t opcode);
84 bool EmulateLD(uint32_t opcode);
85 bool EmulateSTD(uint32_t opcode);
86 bool EmulateOR(uint32_t opcode);
87 bool EmulateADDI(uint32_t opcode);
90 } // namespace lldb_private
92 #endif // EmulateInstructionPPC64_h_