llvm/llvm/utils/TableGen/X86RecognizableInstr.h

//===- X86RecognizableInstr.h - Disassembler instruction spec ---*- 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
//
//===----------------------------------------------------------------------===//
//
// This file is part of the X86 Disassembler Emitter.
// It contains the interface of a single recognizable instruction.
// Documentation for the disassembler emitter in general can be found in
//  X86DisassemblerEmitter.h.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_UTILS_TABLEGEN_X86RECOGNIZABLEINSTR_H
#define LLVM_UTILS_TABLEGEN_X86RECOGNIZABLEINSTR_H

#include "Common/CodeGenInstruction.h"
#include "llvm/Support/X86DisassemblerDecoderCommon.h"
#include <cstdint>
#include <string>
#include <vector>

struct InstructionSpecifier;

namespace llvm {
class Record;
#define X86_INSTR_MRM_MAPPING

// A clone of X86 since we can't depend on something that is generated.
namespace X86Local {
enum {};

enum {};

enum {};
enum {};
enum {};
enum {};
enum {};
} // namespace X86Local

namespace X86Disassembler {
class DisassemblerTables;
/// Extract common fields of a single X86 instruction from a CodeGenInstruction
struct RecognizableInstrBase {};

/// RecognizableInstr - Encapsulates all information required to decode a single
///   instruction, as extracted from the LLVM instruction tables.  Has methods
///   to interpret the information available in the LLVM tables, and to emit the
///   instruction into DisassemblerTables.
class RecognizableInstr : public RecognizableInstrBase {};

std::string getMnemonic(const CodeGenInstruction *I, unsigned Variant);
bool isRegisterOperand(const Record *Rec);
bool isMemoryOperand(const Record *Rec);
bool isImmediateOperand(const Record *Rec);
unsigned getRegOperandSize(const Record *RegRec);
unsigned getMemOperandSize(const Record *MemRec);
} // namespace X86Disassembler
} // namespace llvm
#endif