]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.h
Merge clang 7.0.1 and several follow-up changes
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / source / Plugins / Instruction / PPC64 / EmulateInstructionPPC64.h
1 //===-- EmulateInstructionPPC64.h -------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef EmulateInstructionPPC64_h_
11 #define EmulateInstructionPPC64_h_
12
13 // C Includes
14 // C++ Includes
15 // Other libraries and framework includes
16 // Project includes
17 #include "lldb/Core/EmulateInstruction.h"
18 #include "lldb/Interpreter/OptionValue.h"
19 #include "lldb/Utility/Log.h"
20
21 namespace lldb_private {
22
23 class EmulateInstructionPPC64 : public EmulateInstruction {
24 public:
25   EmulateInstructionPPC64(const ArchSpec &arch);
26
27   static void Initialize();
28
29   static void Terminate();
30
31   static ConstString GetPluginNameStatic();
32
33   static const char *GetPluginDescriptionStatic();
34
35   static EmulateInstruction *CreateInstance(const ArchSpec &arch,
36                                             InstructionType inst_type);
37
38   static bool
39   SupportsEmulatingInstructionsOfTypeStatic(InstructionType inst_type) {
40     switch (inst_type) {
41     case eInstructionTypeAny:
42     case eInstructionTypePrologueEpilogue:
43       return true;
44
45     case eInstructionTypePCModifying:
46     case eInstructionTypeAll:
47       return false;
48     }
49     return false;
50   }
51
52   ConstString GetPluginName() override;
53
54   uint32_t GetPluginVersion() override { return 1; }
55
56   bool SetTargetTriple(const ArchSpec &arch) override;
57
58   bool SupportsEmulatingInstructionsOfType(InstructionType inst_type) override {
59     return SupportsEmulatingInstructionsOfTypeStatic(inst_type);
60   }
61
62   bool ReadInstruction() override;
63
64   bool EvaluateInstruction(uint32_t evaluate_options) override;
65
66   bool TestEmulation(Stream *out_stream, ArchSpec &arch,
67                      OptionValueDictionary *test_data) override {
68     return false;
69   }
70
71   bool GetRegisterInfo(lldb::RegisterKind reg_kind, uint32_t reg_num,
72                        RegisterInfo &reg_info) override;
73
74   bool CreateFunctionEntryUnwind(UnwindPlan &unwind_plan) override;
75
76 private:
77   struct Opcode {
78     uint32_t mask;
79     uint32_t value;
80     bool (EmulateInstructionPPC64::*callback)(uint32_t opcode);
81     const char *name;
82   };
83
84   uint32_t m_fp = LLDB_INVALID_REGNUM;
85
86   Opcode *GetOpcodeForInstruction(uint32_t opcode);
87
88   bool EmulateMFSPR(uint32_t opcode);
89   bool EmulateLD(uint32_t opcode);
90   bool EmulateSTD(uint32_t opcode);
91   bool EmulateOR(uint32_t opcode);
92   bool EmulateADDI(uint32_t opcode);
93 };
94
95 } // namespace lldb_private
96
97 #endif // EmulateInstructionPPC64_h_