LLVM 22.0.0git
ARCDisassembler.cpp File Reference

This file is part of the ARC Disassembler. More...

#include "ARC.h"
#include "ARCRegisterInfo.h"
#include "MCTargetDesc/ARCMCTargetDesc.h"
#include "TargetInfo/ARCTargetInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCDecoder.h"
#include "llvm/MC/MCDecoderOps.h"
#include "llvm/MC/MCDisassembler/MCDisassembler.h"
#include "llvm/MC/MCInst.h"
#include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/MC/TargetRegistry.h"
#include "ARCGenDisassemblerTables.inc"

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "arc-disassembler"

Functions

static bool readInstruction32 (ArrayRef< uint8_t > Bytes, uint64_t Address, uint64_t &Size, uint32_t &Insn)
static bool readInstruction64 (ArrayRef< uint8_t > Bytes, uint64_t Address, uint64_t &Size, uint64_t &Insn)
static bool readInstruction48 (ArrayRef< uint8_t > Bytes, uint64_t Address, uint64_t &Size, uint64_t &Insn)
static bool readInstruction16 (ArrayRef< uint8_t > Bytes, uint64_t Address, uint64_t &Size, uint32_t &Insn)
template<unsigned B>
static DecodeStatus DecodeSignedOperand (MCInst &Inst, unsigned InsnS, uint64_t Address=0, const MCDisassembler *Decoder=nullptr)
template<unsigned B>
static DecodeStatus DecodeFromCyclicRange (MCInst &Inst, unsigned InsnS, uint64_t Address=0, const MCDisassembler *Decoder=nullptr)
template<unsigned B>
static DecodeStatus DecodeBranchTargetS (MCInst &Inst, unsigned InsnS, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeMEMrs9 (MCInst &, unsigned, uint64_t, const MCDisassembler *)
static DecodeStatus DecodeLdLImmInstruction (MCInst &, uint64_t, uint64_t, const MCDisassembler *)
static DecodeStatus DecodeStLImmInstruction (MCInst &, uint64_t, uint64_t, const MCDisassembler *)
static DecodeStatus DecodeLdRLImmInstruction (MCInst &, uint64_t, uint64_t, const MCDisassembler *)
static DecodeStatus DecodeSOPwithRS12 (MCInst &, uint64_t, uint64_t, const MCDisassembler *)
static DecodeStatus DecodeSOPwithRU6 (MCInst &, uint64_t, uint64_t, const MCDisassembler *)
static DecodeStatus DecodeCCRU6Instruction (MCInst &, uint64_t, uint64_t, const MCDisassembler *)
static DecodeStatus DecodeMoveHRegInstruction (MCInst &Inst, uint64_t, uint64_t, const MCDisassembler *)
static DecodeStatus DecodeGPR32RegisterClass (MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeGBR32ShortRegister (MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static unsigned decodeCField (unsigned Insn)
static unsigned decodeBField (unsigned Insn)
static unsigned decodeAField (unsigned Insn)
static bool DecodeSymbolicOperand (MCInst &Inst, uint64_t Address, uint64_t Value, const MCDisassembler *Decoder)
static void DecodeSymbolicOperandOff (MCInst &Inst, uint64_t Address, uint64_t Offset, const MCDisassembler *Decoder)
static MCDisassemblercreateARCDisassembler (const Target &T, const MCSubtargetInfo &STI, MCContext &Ctx)
LLVM_EXTERNAL_VISIBILITY void LLVMInitializeARCDisassembler ()

Variables

static const uint16_t GPR32DecoderTable []

Detailed Description

This file is part of the ARC Disassembler.

Definition in file ARCDisassembler.cpp.

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "arc-disassembler"

Definition at line 30 of file ARCDisassembler.cpp.

Function Documentation

◆ createARCDisassembler()

MCDisassembler * createARCDisassembler ( const Target & T,
const MCSubtargetInfo & STI,
MCContext & Ctx )
static

Definition at line 413 of file ARCDisassembler.cpp.

References T.

Referenced by LLVMInitializeARCDisassembler().

◆ decodeAField()

unsigned decodeAField ( unsigned Insn)
static

◆ decodeBField()

◆ DecodeBranchTargetS()

template<unsigned B>
DecodeStatus DecodeBranchTargetS ( MCInst & Inst,
unsigned InsnS,
uint64_t Address,
const MCDisassembler * Decoder )
static

◆ DecodeCCRU6Instruction()

◆ decodeCField()

unsigned decodeCField ( unsigned Insn)
static

◆ DecodeFromCyclicRange()

template<unsigned B>
DecodeStatus DecodeFromCyclicRange ( MCInst & Inst,
unsigned InsnS,
uint64_t Address = 0,
const MCDisassembler * Decoder = nullptr )
static

◆ DecodeGBR32ShortRegister()

DecodeStatus DecodeGBR32ShortRegister ( MCInst & Inst,
unsigned RegNo,
uint64_t Address,
const MCDisassembler * Decoder )
static

Definition at line 146 of file ARCDisassembler.cpp.

References DecodeGPR32RegisterClass().

◆ DecodeGPR32RegisterClass()

◆ DecodeLdLImmInstruction()

◆ DecodeLdRLImmInstruction()

◆ DecodeMEMrs9()

◆ DecodeMoveHRegInstruction()

◆ DecodeSignedOperand()

template<unsigned B>
DecodeStatus DecodeSignedOperand ( MCInst & Inst,
unsigned InsnS,
uint64_t Address = 0,
const MCDisassembler * Decoder = nullptr )
static

◆ DecodeSOPwithRS12()

◆ DecodeSOPwithRU6()

◆ DecodeStLImmInstruction()

◆ DecodeSymbolicOperand()

bool DecodeSymbolicOperand ( MCInst & Inst,
uint64_t Address,
uint64_t Value,
const MCDisassembler * Decoder )
static

◆ DecodeSymbolicOperandOff()

void DecodeSymbolicOperandOff ( MCInst & Inst,
uint64_t Address,
uint64_t Offset,
const MCDisassembler * Decoder )
static

◆ LLVMInitializeARCDisassembler()

◆ readInstruction16()

bool readInstruction16 ( ArrayRef< uint8_t > Bytes,
uint64_t Address,
uint64_t & Size,
uint32_t & Insn )
static

Definition at line 80 of file ARCDisassembler.cpp.

References Size.

◆ readInstruction32()

bool readInstruction32 ( ArrayRef< uint8_t > Bytes,
uint64_t Address,
uint64_t & Size,
uint32_t & Insn )
static

Definition at line 52 of file ARCDisassembler.cpp.

References Size.

Referenced by llvm::LanaiDisassembler::getInstruction().

◆ readInstruction48()

bool readInstruction48 ( ArrayRef< uint8_t > Bytes,
uint64_t Address,
uint64_t & Size,
uint64_t & Insn )
static

Definition at line 71 of file ARCDisassembler.cpp.

References Size.

◆ readInstruction64()

bool readInstruction64 ( ArrayRef< uint8_t > Bytes,
uint64_t Address,
uint64_t & Size,
uint64_t & Insn )
static

Definition at line 61 of file ARCDisassembler.cpp.

References Size.

Variable Documentation

◆ GPR32DecoderTable

const uint16_t GPR32DecoderTable[]
static
Initial value:
= {
ARC::R0, ARC::R1, ARC::R2, ARC::R3, ARC::R4, ARC::R5, ARC::R6,
ARC::R7, ARC::R8, ARC::R9, ARC::R10, ARC::R11, ARC::R12, ARC::R13,
ARC::R14, ARC::R15, ARC::R16, ARC::R17, ARC::R18, ARC::R19, ARC::R20,
ARC::R21, ARC::R22, ARC::R23, ARC::R24, ARC::R25, ARC::GP, ARC::FP,
ARC::SP, ARC::ILINK, ARC::R30, ARC::BLINK}

Definition at line 126 of file ARCDisassembler.cpp.

Referenced by DecodeGPR32RegisterClass(), and DecodeGPR32RegisterClass().