LLVM: lib/Target/M68k/Disassembler/M68kDisassembler.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
19
29
30using namespace llvm;
32
33#define DEBUG_TYPE "m68k-disassembler"
34
36
38 M68k::D0, M68k::D1, M68k::D2, M68k::D3, M68k::D4, M68k::D5,
39 M68k::D6, M68k::D7, M68k::A0, M68k::A1, M68k::A2, M68k::A3,
40 M68k::A4, M68k::A5, M68k::A6, M68k::SP, M68k::FP0, M68k::FP1,
41 M68k::FP2, M68k::FP3, M68k::FP4, M68k::FP5, M68k::FP6, M68k::FP7,
42 M68k::FPIAR, M68k::FPS, M68k::FPC};
43
45 uint64_t Address, const void *Decoder) {
46 if (RegNo >= 24)
47 return DecodeStatus::Fail;
49 return DecodeStatus::Success;
50}
51
54 const void *Decoder) {
56}
57
60 const void *Decoder) {
62}
63
66 const void *Decoder) {
68}
69
72 const void *Decoder) {
74}
75
78 const void *Decoder) {
80}
81
84 const void *Decoder) {
86}
87
90 const void *Decoder) {
92}
93
96 const void *Decoder) {
98}
99#define DecodeFPDR32RegisterClass DecodeFPDRRegisterClass
100#define DecodeFPDR64RegisterClass DecodeFPDRRegisterClass
101#define DecodeFPDR80RegisterClass DecodeFPDRRegisterClass
102
105 const void *Decoder) {
107}
108#define DecodeFPICRegisterClass DecodeFPCSCRegisterClass
109
113 return DecodeStatus::Success;
114}
115
119 return DecodeStatus::Success;
120}
121
123 const void *Decoder) {
125 return DecodeStatus::Success;
126}
127
128#include "M68kGenDisassemblerTables.inc"
129
130#undef DecodeFPDR32RegisterClass
131#undef DecodeFPDR64RegisterClass
132#undef DecodeFPDR80RegisterClass
133#undef DecodeFPICRegisterClass
134
135
145
151 auto MakeUp = [&](APInt &Insn, unsigned InstrBits) {
153 unsigned RoundUp = alignTo(InstrBits, Align(16));
155 Insn = Insn.zext(RoundUp);
156 RoundUp = RoundUp >> 3;
157 for (; Idx < RoundUp; Idx += 2) {
159 }
160 };
162
163
164
166 Result = decodeInstruction(DecoderTable80, Instr, Insn, Address, this, STI,
167 MakeUp);
168 if (Result == DecodeStatus::Success)
169 Size = InstrLenTable[Instr.getOpcode()] >> 3;
170 return Result;
171}
172
178
MCDisassembler::DecodeStatus DecodeStatus
#define LLVM_EXTERNAL_VISIBILITY
static const unsigned RegisterDecode[]
Definition M68kDisassembler.cpp:37
static DecodeStatus DecodeXR32RegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder)
Definition M68kDisassembler.cpp:82
static DecodeStatus DecodeFPDRRegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder)
Definition M68kDisassembler.cpp:94
static DecodeStatus DecodeDR32RegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder)
Definition M68kDisassembler.cpp:52
static MCDisassembler * createM68kDisassembler(const Target &T, const MCSubtargetInfo &STI, MCContext &Ctx)
Definition M68kDisassembler.cpp:173
LLVM_EXTERNAL_VISIBILITY void LLVMInitializeM68kDisassembler()
Definition M68kDisassembler.cpp:179
static DecodeStatus DecodeRegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder)
Definition M68kDisassembler.cpp:44
static DecodeStatus DecodeDR8RegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder)
Definition M68kDisassembler.cpp:64
static DecodeStatus DecodeAR32RegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder)
Definition M68kDisassembler.cpp:70
static DecodeStatus DecodeFPCSCRegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder)
Definition M68kDisassembler.cpp:103
static DecodeStatus DecodeCCRCRegisterClass(MCInst &Inst, const MCDisassembler *Decoder)
Definition M68kDisassembler.cpp:110
static DecodeStatus DecodeSRCRegisterClass(MCInst &Inst, const MCDisassembler *Decoder)
Definition M68kDisassembler.cpp:116
static DecodeStatus DecodeXR16RegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder)
Definition M68kDisassembler.cpp:88
static DecodeStatus DecodeAR16RegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder)
Definition M68kDisassembler.cpp:76
static DecodeStatus DecodeDR16RegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder)
Definition M68kDisassembler.cpp:58
static DecodeStatus DecodeImm32(MCInst &Inst, uint64_t Imm, uint64_t Address, const void *Decoder)
Definition M68kDisassembler.cpp:122
This file contains the declarations for the code emitter which are useful outside of the emitter itse...
This file provides M68k specific target descriptions.
This file contains the M68k implementation of the TargetRegisterInfo class.
This file declares the M68k specific subclass of TargetSubtargetInfo.
This file contains the entry points for global functions defined in the M68k target library,...
Class for arbitrary precision integers.
LLVM_ABI APInt zext(unsigned width) const
Zero extend to a new width.
unsigned getBitWidth() const
Return the number of bits in the APInt.
LLVM_ABI void insertBits(const APInt &SubBits, unsigned bitPosition)
Insert the bits from a smaller APInt starting at bitPosition.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Context object for machine code objects.
Superclass for all disassemblers.
MCDisassembler(const MCSubtargetInfo &STI, MCContext &Ctx)
const MCSubtargetInfo & STI
DecodeStatus
Ternary decode status.
Instances of this class represent a single low-level machine instruction.
void addOperand(const MCOperand Op)
static MCOperand createReg(MCRegister Reg)
static MCOperand createImm(int64_t Val)
Generic base class for all target subtargets.
Target - Wrapper for Target specific information.
This class implements an extremely fast bulk output stream that can only output to a stream.
value_t swapWord(value_t Val)
uint16_t read16be(const void *P)
This is an optimization pass for GlobalISel generic memory operations.
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
Target & getTheM68kTarget()
A disassembler class for M68k.
Definition M68kDisassembler.cpp:136
DecodeStatus getInstruction(MCInst &Instr, uint64_t &Size, ArrayRef< uint8_t > Bytes, uint64_t Address, raw_ostream &CStream) const override
Returns the disassembly of a single instruction.
Definition M68kDisassembler.cpp:146
M68kDisassembler(const MCSubtargetInfo &STI, MCContext &Ctx)
Definition M68kDisassembler.cpp:137
virtual ~M68kDisassembler()
Definition M68kDisassembler.cpp:139
This struct is a compact representation of a valid (non-zero power of two) alignment.
static void RegisterMCDisassembler(Target &T, Target::MCDisassemblerCtorTy Fn)
RegisterMCDisassembler - Register a MCDisassembler implementation for the given target.