/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.h
Line | Count | Source (jump to first uncovered line) |
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 | | //===----------------------------------------------------------------------===// |
8 | | |
9 | | #ifndef LLDB_SOURCE_PLUGINS_INSTRUCTION_PPC64_EMULATEINSTRUCTIONPPC64_H |
10 | | #define LLDB_SOURCE_PLUGINS_INSTRUCTION_PPC64_EMULATEINSTRUCTIONPPC64_H |
11 | | |
12 | | #include "lldb/Core/EmulateInstruction.h" |
13 | | #include "lldb/Interpreter/OptionValue.h" |
14 | | #include "lldb/Utility/Log.h" |
15 | | #include <optional> |
16 | | |
17 | | namespace lldb_private { |
18 | | |
19 | | class EmulateInstructionPPC64 : public EmulateInstruction { |
20 | | public: |
21 | | EmulateInstructionPPC64(const ArchSpec &arch); |
22 | | |
23 | | static void Initialize(); |
24 | | |
25 | | static void Terminate(); |
26 | | |
27 | 3.92k | static llvm::StringRef GetPluginNameStatic() { return "ppc64"; } |
28 | | |
29 | | static llvm::StringRef GetPluginDescriptionStatic(); |
30 | | |
31 | | static EmulateInstruction *CreateInstance(const ArchSpec &arch, |
32 | | InstructionType inst_type); |
33 | | |
34 | | static bool |
35 | 16.7k | SupportsEmulatingInstructionsOfTypeStatic(InstructionType inst_type) { |
36 | 16.7k | switch (inst_type) { |
37 | 0 | case eInstructionTypeAny: |
38 | 16.7k | case eInstructionTypePrologueEpilogue: |
39 | 16.7k | return true; |
40 | | |
41 | 0 | case eInstructionTypePCModifying: |
42 | 0 | case eInstructionTypeAll: |
43 | 0 | return false; |
44 | 16.7k | } |
45 | 0 | return false; |
46 | 16.7k | } |
47 | | |
48 | 0 | llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); } |
49 | | |
50 | | bool SetTargetTriple(const ArchSpec &arch) override; |
51 | | |
52 | 0 | bool SupportsEmulatingInstructionsOfType(InstructionType inst_type) override { |
53 | 0 | return SupportsEmulatingInstructionsOfTypeStatic(inst_type); |
54 | 0 | } |
55 | | |
56 | | bool ReadInstruction() override; |
57 | | |
58 | | bool EvaluateInstruction(uint32_t evaluate_options) override; |
59 | | |
60 | | bool TestEmulation(Stream &out_stream, ArchSpec &arch, |
61 | 0 | OptionValueDictionary *test_data) override { |
62 | 0 | return false; |
63 | 0 | } |
64 | | |
65 | | std::optional<RegisterInfo> GetRegisterInfo(lldb::RegisterKind reg_kind, |
66 | | uint32_t reg_num) override; |
67 | | |
68 | | bool CreateFunctionEntryUnwind(UnwindPlan &unwind_plan) override; |
69 | | |
70 | | private: |
71 | | struct Opcode { |
72 | | uint32_t mask; |
73 | | uint32_t value; |
74 | | bool (EmulateInstructionPPC64::*callback)(uint32_t opcode); |
75 | | const char *name; |
76 | | }; |
77 | | |
78 | | uint32_t m_fp = LLDB_INVALID_REGNUM; |
79 | | |
80 | | Opcode *GetOpcodeForInstruction(uint32_t opcode); |
81 | | |
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); |
87 | | }; |
88 | | |
89 | | } // namespace lldb_private |
90 | | |
91 | | #endif // LLDB_SOURCE_PLUGINS_INSTRUCTION_PPC64_EMULATEINSTRUCTIONPPC64_H |