Coverage Report

Created: 2022-01-18 06:27

/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
16
namespace lldb_private {
17
18
class EmulateInstructionPPC64 : public EmulateInstruction {
19
public:
20
  EmulateInstructionPPC64(const ArchSpec &arch);
21
22
  static void Initialize();
23
24
  static void Terminate();
25
26
3.44k
  static llvm::StringRef GetPluginNameStatic() { return "ppc64"; }
27
28
  static llvm::StringRef GetPluginDescriptionStatic();
29
30
  static EmulateInstruction *CreateInstance(const ArchSpec &arch,
31
                                            InstructionType inst_type);
32
33
  static bool
34
21.0k
  SupportsEmulatingInstructionsOfTypeStatic(InstructionType inst_type) {
35
21.0k
    switch (inst_type) {
36
0
    case eInstructionTypeAny:
37
21.0k
    case eInstructionTypePrologueEpilogue:
38
21.0k
      return true;
39
40
0
    case eInstructionTypePCModifying:
41
0
    case eInstructionTypeAll:
42
0
      return false;
43
21.0k
    }
44
0
    return false;
45
21.0k
  }
46
47
0
  llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
48
49
  bool SetTargetTriple(const ArchSpec &arch) override;
50
51
0
  bool SupportsEmulatingInstructionsOfType(InstructionType inst_type) override {
52
0
    return SupportsEmulatingInstructionsOfTypeStatic(inst_type);
53
0
  }
54
55
  bool ReadInstruction() override;
56
57
  bool EvaluateInstruction(uint32_t evaluate_options) override;
58
59
  bool TestEmulation(Stream *out_stream, ArchSpec &arch,
60
0
                     OptionValueDictionary *test_data) override {
61
0
    return false;
62
0
  }
63
64
  bool GetRegisterInfo(lldb::RegisterKind reg_kind, uint32_t reg_num,
65
                       RegisterInfo &reg_info) override;
66
67
  bool CreateFunctionEntryUnwind(UnwindPlan &unwind_plan) override;
68
69
private:
70
  struct Opcode {
71
    uint32_t mask;
72
    uint32_t value;
73
    bool (EmulateInstructionPPC64::*callback)(uint32_t opcode);
74
    const char *name;
75
  };
76
77
  uint32_t m_fp = LLDB_INVALID_REGNUM;
78
79
  Opcode *GetOpcodeForInstruction(uint32_t opcode);
80
81
  bool EmulateMFSPR(uint32_t opcode);
82
  bool EmulateLD(uint32_t opcode);
83
  bool EmulateSTD(uint32_t opcode);
84
  bool EmulateOR(uint32_t opcode);
85
  bool EmulateADDI(uint32_t opcode);
86
};
87
88
} // namespace lldb_private
89
90
#endif // LLDB_SOURCE_PLUGINS_INSTRUCTION_PPC64_EMULATEINSTRUCTIONPPC64_H