llvm/llvm/tools/llvm-exegesis/lib/Mips/Target.cpp

//===-- Target.cpp ----------------------------------------------*- C++ -*-===//
//
// 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 "../Error.h"
#include "../Target.h"
#include "MCTargetDesc/MipsBaseInfo.h"
#include "Mips.h"
#include "MipsRegisterInfo.h"

#define GET_AVAILABLE_OPCODE_CHECKER
#include "MipsGenInstrInfo.inc"

namespace llvm {
namespace exegesis {

#ifndef NDEBUG
// Returns an error if we cannot handle the memory references in this
// instruction.
static Error isInvalidMemoryInstr(const Instruction &Instr) {
  switch (Instr.Description.TSFlags & MipsII::FormMask) {
  default:
    llvm_unreachable("Unknown FormMask value");
  // These have no memory access.
  case MipsII::Pseudo:
  case MipsII::FrmR:
  case MipsII::FrmJ:
  case MipsII::FrmFR:
    return Error::success();
  // These access memory and are handled.
  case MipsII::FrmI:
    return Error::success();
  // These access memory and are not handled yet.
  case MipsII::FrmFI:
  case MipsII::FrmOther:
    return make_error<Failure>("unsupported opcode: non uniform memory access");
  }
}
#endif

// Helper to fill a memory operand with a value.
static void setMemOp(InstructionTemplate &IT, int OpIdx,
                     const MCOperand &OpVal) {}

#include "MipsGenExegesis.inc"

namespace {
class ExegesisMipsTarget : public ExegesisTarget {};
} // end anonymous namespace

// Generates instructions to load an immediate value into a register.
static std::vector<MCInst> loadImmediate(unsigned Reg, bool IsGPR32,
                                         const APInt &Value) {}

unsigned ExegesisMipsTarget::getScratchMemoryRegister(const Triple &TT) const {}

void ExegesisMipsTarget::fillMemoryOperands(InstructionTemplate &IT,
                                            unsigned Reg,
                                            unsigned Offset) const {}

std::vector<MCInst> ExegesisMipsTarget::setRegTo(const MCSubtargetInfo &STI,
                                                 unsigned Reg,
                                                 const APInt &Value) const {}

static ExegesisTarget *getTheExegesisMipsTarget() {}

void InitializeMipsExegesisTarget() {}

} // namespace exegesis
} // namespace llvm