#include "MCTargetDesc/MSP430MCTargetDesc.h"
#include "MSP430.h"
#include "TargetInfo/MSP430TargetInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCDecoderOps.h"
#include "llvm/MC/MCDisassembler/MCDisassembler.h"
#include "llvm/MC/MCInst.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/MC/TargetRegistry.h"
#include "llvm/Support/Endian.h"
usingnamespacellvm;
#define DEBUG_TYPE …
DecodeStatus;
namespace {
class MSP430Disassembler : public MCDisassembler { … };
}
static MCDisassembler *createMSP430Disassembler(const Target &T,
const MCSubtargetInfo &STI,
MCContext &Ctx) { … }
extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeMSP430Disassembler() { … }
static const unsigned GR8DecoderTable[] = …;
static DecodeStatus DecodeGR8RegisterClass(MCInst &MI, uint64_t RegNo,
uint64_t Address,
const MCDisassembler *Decoder) { … }
static const unsigned GR16DecoderTable[] = …;
static DecodeStatus DecodeGR16RegisterClass(MCInst &MI, uint64_t RegNo,
uint64_t Address,
const MCDisassembler *Decoder) { … }
static DecodeStatus DecodeCGImm(MCInst &MI, uint64_t Bits, uint64_t Address,
const MCDisassembler *Decoder);
static DecodeStatus DecodeMemOperand(MCInst &MI, uint64_t Bits,
uint64_t Address,
const MCDisassembler *Decoder);
#include "MSP430GenDisassemblerTables.inc"
static DecodeStatus DecodeCGImm(MCInst &MI, uint64_t Bits, uint64_t Address,
const MCDisassembler *Decoder) { … }
static DecodeStatus DecodeMemOperand(MCInst &MI, uint64_t Bits,
uint64_t Address,
const MCDisassembler *Decoder) { … }
enum AddrMode { … };
static AddrMode DecodeSrcAddrMode(unsigned Rs, unsigned As) { … }
static AddrMode DecodeSrcAddrModeI(unsigned Insn) { … }
static AddrMode DecodeSrcAddrModeII(unsigned Insn) { … }
static AddrMode DecodeDstAddrMode(unsigned Insn) { … }
static const uint8_t *getDecoderTable(AddrMode SrcAM, unsigned Words) { … }
DecodeStatus MSP430Disassembler::getInstructionI(MCInst &MI, uint64_t &Size,
ArrayRef<uint8_t> Bytes,
uint64_t Address,
raw_ostream &CStream) const { … }
DecodeStatus MSP430Disassembler::getInstructionII(MCInst &MI, uint64_t &Size,
ArrayRef<uint8_t> Bytes,
uint64_t Address,
raw_ostream &CStream) const { … }
static MSP430CC::CondCodes getCondCode(unsigned Cond) { … }
DecodeStatus MSP430Disassembler::getInstructionCJ(MCInst &MI, uint64_t &Size,
ArrayRef<uint8_t> Bytes,
uint64_t Address,
raw_ostream &CStream) const { … }
DecodeStatus MSP430Disassembler::getInstruction(MCInst &MI, uint64_t &Size,
ArrayRef<uint8_t> Bytes,
uint64_t Address,
raw_ostream &CStream) const { … }