llvm/lldb/source/Plugins/Instruction/LoongArch/EmulateInstructionLoongArch.cpp

//===---EmulateInstructionLoongArch.cpp------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include <cstdlib>
#include <optional>

#include "EmulateInstructionLoongArch.h"
#include "Plugins/Process/Utility/InstructionUtils.h"
#include "Plugins/Process/Utility/RegisterInfoPOSIX_loongarch64.h"
#include "Plugins/Process/Utility/lldb-loongarch-register-enums.h"
#include "lldb/Core/Address.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Interpreter/OptionValueArray.h"
#include "lldb/Interpreter/OptionValueDictionary.h"
#include "lldb/Symbol/UnwindPlan.h"
#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/LLDBLog.h"
#include "lldb/Utility/RegisterValue.h"
#include "lldb/Utility/Stream.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/MathExtras.h"

usingnamespacelldb;
usingnamespacelldb_private;

LLDB_PLUGIN_DEFINE_ADV(EmulateInstructionLoongArch, InstructionLoongArch)

namespace lldb_private {

EmulateInstructionLoongArch::Opcode *
EmulateInstructionLoongArch::GetOpcodeForInstruction(uint32_t inst) {}

bool EmulateInstructionLoongArch::TestExecute(uint32_t inst) {}

bool EmulateInstructionLoongArch::EvaluateInstruction(uint32_t options) {}

bool EmulateInstructionLoongArch::ReadInstruction() {}

lldb::addr_t EmulateInstructionLoongArch::ReadPC(bool *success) {}

bool EmulateInstructionLoongArch::WritePC(lldb::addr_t pc) {}

std::optional<RegisterInfo>
EmulateInstructionLoongArch::GetRegisterInfo(lldb::RegisterKind reg_kind,
                                             uint32_t reg_index) {}

bool EmulateInstructionLoongArch::SetTargetTriple(const ArchSpec &arch) {}

bool EmulateInstructionLoongArch::TestEmulation(
    Stream &out_stream, ArchSpec &arch, OptionValueDictionary *test_data) {}

void EmulateInstructionLoongArch::Initialize() {}

void EmulateInstructionLoongArch::Terminate() {}

lldb_private::EmulateInstruction *
EmulateInstructionLoongArch::CreateInstance(const ArchSpec &arch,
                                            InstructionType inst_type) {}

bool EmulateInstructionLoongArch::SupportsThisArch(const ArchSpec &arch) {}

bool EmulateInstructionLoongArch::EmulateBEQZ(uint32_t inst) {}

bool EmulateInstructionLoongArch::EmulateBNEZ(uint32_t inst) {}

bool EmulateInstructionLoongArch::EmulateBCEQZ(uint32_t inst) {}

bool EmulateInstructionLoongArch::EmulateBCNEZ(uint32_t inst) {}

bool EmulateInstructionLoongArch::EmulateJIRL(uint32_t inst) {}

bool EmulateInstructionLoongArch::EmulateB(uint32_t inst) {}

bool EmulateInstructionLoongArch::EmulateBL(uint32_t inst) {}

bool EmulateInstructionLoongArch::EmulateBEQ(uint32_t inst) {}

bool EmulateInstructionLoongArch::EmulateBNE(uint32_t inst) {}

bool EmulateInstructionLoongArch::EmulateBLT(uint32_t inst) {}

bool EmulateInstructionLoongArch::EmulateBGE(uint32_t inst) {}

bool EmulateInstructionLoongArch::EmulateBLTU(uint32_t inst) {}

bool EmulateInstructionLoongArch::EmulateBGEU(uint32_t inst) {}

bool EmulateInstructionLoongArch::EmulateNonJMP(uint32_t inst) {}

// beqz rj, offs21
// if GR[rj] == 0:
//   PC = PC + SignExtend({offs21, 2'b0}, GRLEN)
bool EmulateInstructionLoongArch::EmulateBEQZ64(uint32_t inst) {}

// bnez rj, offs21
// if GR[rj] != 0:
//   PC = PC + SignExtend({offs21, 2'b0}, GRLEN)
bool EmulateInstructionLoongArch::EmulateBNEZ64(uint32_t inst) {}

// bceqz cj, offs21
// if CFR[cj] == 0:
//	PC = PC + SignExtend({offs21, 2'b0}, GRLEN)
bool EmulateInstructionLoongArch::EmulateBCEQZ64(uint32_t inst) {}

// bcnez cj, offs21
// if CFR[cj] != 0:
//	PC = PC + SignExtend({offs21, 2'b0}, GRLEN)
bool EmulateInstructionLoongArch::EmulateBCNEZ64(uint32_t inst) {}

// jirl rd, rj, offs16
// GR[rd] = PC + 4
// PC = GR[rj] + SignExtend({offs16, 2'b0}, GRLEN)
bool EmulateInstructionLoongArch::EmulateJIRL64(uint32_t inst) {}

// b offs26
// PC = PC + SignExtend({offs26, 2' b0}, GRLEN)
bool EmulateInstructionLoongArch::EmulateB64(uint32_t inst) {}

// bl offs26
// GR[1] = PC + 4
// PC = PC + SignExtend({offs26, 2'b0}, GRLEN)
bool EmulateInstructionLoongArch::EmulateBL64(uint32_t inst) {}

// beq rj, rd, offs16
// if GR[rj] == GR[rd]:
//   PC = PC + SignExtend({offs16, 2'b0}, GRLEN)
bool EmulateInstructionLoongArch::EmulateBEQ64(uint32_t inst) {}

// bne rj, rd, offs16
// if GR[rj] != GR[rd]:
//   PC = PC + SignExtend({offs16, 2'b0}, GRLEN)
bool EmulateInstructionLoongArch::EmulateBNE64(uint32_t inst) {}

// blt rj, rd, offs16
// if signed(GR[rj]) < signed(GR[rd]):
//   PC = PC + SignExtend({offs16, 2'b0}, GRLEN)
bool EmulateInstructionLoongArch::EmulateBLT64(uint32_t inst) {}

// bge rj, rd, offs16
// if signed(GR[rj]) >= signed(GR[rd]):
//   PC = PC + SignExtend({offs16, 2'b0}, GRLEN)
bool EmulateInstructionLoongArch::EmulateBGE64(uint32_t inst) {}

// bltu rj, rd, offs16
// if unsigned(GR[rj]) < unsigned(GR[rd]):
//   PC = PC + SignExtend({offs16, 2'b0}, GRLEN)
bool EmulateInstructionLoongArch::EmulateBLTU64(uint32_t inst) {}

// bgeu rj, rd, offs16
// if unsigned(GR[rj]) >= unsigned(GR[rd]):
//   PC = PC + SignExtend({offs16, 2'b0}, GRLEN)
bool EmulateInstructionLoongArch::EmulateBGEU64(uint32_t inst) {}

} // namespace lldb_private