27 #define DEBUG_TYPE "msp430-disassembler" 62 return new MSP430Disassembler(STI, Ctx);
71 MSP430::PCB, MSP430::SPB, MSP430::SRB, MSP430::CGB,
72 MSP430::FPB, MSP430::R5B, MSP430::R6B, MSP430::R7B,
73 MSP430::R8B, MSP430::R9B, MSP430::R10B, MSP430::R11B,
74 MSP430::R12B, MSP430::R13B, MSP430::R14B, MSP430::R15B
79 const void *Decoder) {
83 unsigned Reg = GR8DecoderTable[RegNo];
89 MSP430::PC, MSP430::SP, MSP430::SR, MSP430::CG,
91 MSP430::R8, MSP430::R9, MSP430::R10, MSP430::R11,
92 MSP430::R12, MSP430::R13, MSP430::R14, MSP430::R15
97 const void *Decoder) {
101 unsigned Reg = GR16DecoderTable[RegNo];
107 const void *Decoder);
111 const void *Decoder);
113 #include "MSP430GenDisassemblerTables.inc" 116 const void *Decoder) {
121 case 0x22: Imm = 4;
break;
122 case 0x32: Imm = 8;
break;
123 case 0x03: Imm = 0;
break;
124 case 0x13: Imm = 1;
break;
125 case 0x23: Imm = 2;
break;
126 case 0x33: Imm = -1;
break;
134 const void *Decoder) {
135 unsigned Reg = Bits & 15;
136 unsigned Imm = Bits >> 4;
186 unsigned Rs = fieldFromInstruction(Insn, 8, 4);
187 unsigned As = fieldFromInstruction(Insn, 4, 2);
192 unsigned Rs = fieldFromInstruction(Insn, 0, 4);
193 unsigned As = fieldFromInstruction(Insn, 4, 2);
198 unsigned Rd = fieldFromInstruction(Insn, 0, 4);
199 unsigned Ad = fieldFromInstruction(Insn, 7, 1);
210 assert(0 < Words && Words < 4 &&
"Incorrect number of words");
215 assert(Words < 3 &&
"Incorrect number of words");
216 return Words == 2 ? DecoderTableAlpha32 : DecoderTableAlpha16;
218 assert(Words < 3 &&
"Incorrect number of words");
219 return Words == 2 ? DecoderTableBeta32 : DecoderTableBeta16;
224 assert(Words > 1 &&
"Incorrect number of words");
225 return Words == 2 ? DecoderTableGamma32 : DecoderTableGamma48;
228 assert(Words < 3 &&
"Incorrect number of words");
229 return Words == 2 ? DecoderTableDelta32 : DecoderTableDelta16;
252 if (Bytes.
size() < (Words + 1) * 2) {
266 if (Bytes.
size() < (Words + 1) * 2) {
307 if (Bytes.
size() < (Words + 1) * 2) {
318 const uint8_t *DecoderTable = Words == 2 ? DecoderTable32 : DecoderTable16;
351 unsigned Cond = fieldFromInstruction(Insn, 10, 3);
352 unsigned Offset = fieldFromInstruction(Insn, 0, 10);
372 if (Bytes.
size() < 2) {
378 unsigned Opc = fieldFromInstruction(Insn, 13, 3);
381 return getInstructionII(MI,
Size, Bytes,
Address, VStream, CStream);
383 return getInstructionCJ(MI,
Size, Bytes,
Address, VStream, CStream);
385 return getInstructionI(MI,
Size, Bytes,
Address, VStream, CStream);
static DecodeStatus DecodeGR16RegisterClass(MCInst &MI, uint64_t RegNo, uint64_t Address, const void *Decoder)
static MSP430CC::CondCodes getCondCode(unsigned Cond)
Target & getTheMSP430Target()
This class represents lattice values for constants.
static DecodeStatus DecodeGR8RegisterClass(MCInst &MI, uint64_t RegNo, uint64_t Address, const void *Decoder)
DecodeStatus
Ternary decode status.
Superclass for all disassemblers.
uint16_t read16le(const void *P)
static void RegisterMCDisassembler(Target &T, Target::MCDisassemblerCtorTy Fn)
RegisterMCDisassembler - Register a MCDisassembler implementation for the given target.
void LLVMInitializeMSP430Disassembler()
static DecodeStatus DecodeMemOperand(MCInst &MI, uint64_t Bits, uint64_t Address, const void *Decoder)
static MCOperand createReg(unsigned Reg)
MCDisassembler::DecodeStatus DecodeStatus
Context object for machine code objects.
static const unsigned GR16DecoderTable[]
int decodeInstruction(InternalInstruction *insn, byteReader_t reader, const void *readerArg, dlog_t logger, void *loggerArg, const void *miiArg, uint64_t startLoc, DisassemblerMode mode)
Decode one instruction and store the decoding results in a buffer provided by the consumer...
static const unsigned GR8DecoderTable[]
Instances of this class represent a single low-level machine instruction.
static AddrMode DecodeDstAddrMode(unsigned Insn)
size_t size() const
size - Get the array size.
static AddrMode DecodeSrcAddrMode(unsigned Rs, unsigned As)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
void setOpcode(unsigned Op)
Target - Wrapper for Target specific information.
static AddrMode DecodeSrcAddrModeII(unsigned Insn)
static AddrMode DecodeSrcAddrModeI(unsigned Insn)
Generic base class for all target subtargets.
constexpr int32_t SignExtend32(uint32_t X)
Sign-extend the number in the bottom B bits of X to a 32-bit integer.
static DecodeStatus DecodeCGImm(MCInst &MI, uint64_t Bits, uint64_t Address, const void *Decoder)
static const uint8_t * getDecoderTable(AddrMode SrcAM, unsigned Words)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This class implements an extremely fast bulk output stream that can only output to a stream...
void addOperand(const MCOperand &Op)
static MCDisassembler * createMSP430Disassembler(const Target &T, const MCSubtargetInfo &STI, MCContext &Ctx)
static MCOperand createImm(int64_t Val)