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 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"
17 namespace lldb_private
{
19 class EmulateInstructionPPC64
: public EmulateInstruction
{
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
);
35 SupportsEmulatingInstructionsOfTypeStatic(InstructionType inst_type
) {
37 case eInstructionTypeAny
:
38 case eInstructionTypePrologueEpilogue
:
41 case eInstructionTypePCModifying
:
42 case eInstructionTypeAll
:
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
{
65 std::optional
<RegisterInfo
> GetRegisterInfo(lldb::RegisterKind reg_kind
,
66 uint32_t reg_num
) override
;
68 bool CreateFunctionEntryUnwind(UnwindPlan
&unwind_plan
) override
;
74 bool (EmulateInstructionPPC64::*callback
)(uint32_t opcode
);
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