Path: blob/main/contrib/llvm-project/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.h
39645 views
//===-- EmulateInstructionPPC64.h -------------------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef LLDB_SOURCE_PLUGINS_INSTRUCTION_PPC64_EMULATEINSTRUCTIONPPC64_H9#define LLDB_SOURCE_PLUGINS_INSTRUCTION_PPC64_EMULATEINSTRUCTIONPPC64_H1011#include "lldb/Core/EmulateInstruction.h"12#include "lldb/Interpreter/OptionValue.h"13#include "lldb/Utility/Log.h"14#include <optional>1516namespace lldb_private {1718class EmulateInstructionPPC64 : public EmulateInstruction {19public:20EmulateInstructionPPC64(const ArchSpec &arch);2122static void Initialize();2324static void Terminate();2526static llvm::StringRef GetPluginNameStatic() { return "ppc64"; }2728static llvm::StringRef GetPluginDescriptionStatic();2930static EmulateInstruction *CreateInstance(const ArchSpec &arch,31InstructionType inst_type);3233static bool34SupportsEmulatingInstructionsOfTypeStatic(InstructionType inst_type) {35switch (inst_type) {36case eInstructionTypeAny:37case eInstructionTypePrologueEpilogue:38return true;3940case eInstructionTypePCModifying:41case eInstructionTypeAll:42return false;43}44return false;45}4647llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }4849bool SetTargetTriple(const ArchSpec &arch) override;5051bool SupportsEmulatingInstructionsOfType(InstructionType inst_type) override {52return SupportsEmulatingInstructionsOfTypeStatic(inst_type);53}5455bool ReadInstruction() override;5657bool EvaluateInstruction(uint32_t evaluate_options) override;5859bool TestEmulation(Stream &out_stream, ArchSpec &arch,60OptionValueDictionary *test_data) override {61return false;62}6364std::optional<RegisterInfo> GetRegisterInfo(lldb::RegisterKind reg_kind,65uint32_t reg_num) override;6667bool CreateFunctionEntryUnwind(UnwindPlan &unwind_plan) override;6869private:70struct Opcode {71uint32_t mask;72uint32_t value;73bool (EmulateInstructionPPC64::*callback)(uint32_t opcode);74const char *name;75};7677uint32_t m_fp = LLDB_INVALID_REGNUM;7879Opcode *GetOpcodeForInstruction(uint32_t opcode);8081bool EmulateMFSPR(uint32_t opcode);82bool EmulateLD(uint32_t opcode);83bool EmulateSTD(uint32_t opcode);84bool EmulateOR(uint32_t opcode);85bool EmulateADDI(uint32_t opcode);86};8788} // namespace lldb_private8990#endif // LLDB_SOURCE_PLUGINS_INSTRUCTION_PPC64_EMULATEINSTRUCTIONPPC64_H919293