19 #define DEBUG_TYPE "systemz-disassembler"
28 ~SystemZDisassembler()
override {}
40 return new SystemZDisassembler(STI, Ctx);
50 const unsigned *Regs,
unsigned Size) {
51 assert(RegNo < Size &&
"Invalid register");
61 const void *Decoder) {
67 const void *Decoder) {
73 const void *Decoder) {
79 const void *Decoder) {
85 const void *Decoder) {
91 const void *Decoder) {
97 const void *Decoder) {
103 const void *Decoder) {
109 const void *Decoder) {
115 const void *Decoder) {
121 const void *Decoder) {
143 const void *Decoder) {
144 return decodeUImmOperand<4>(Inst, Imm);
148 uint64_t
Address,
const void *Decoder) {
149 return decodeUImmOperand<1>(Inst, Imm);
153 uint64_t
Address,
const void *Decoder) {
154 return decodeUImmOperand<2>(Inst, Imm);
158 uint64_t
Address,
const void *Decoder) {
159 return decodeUImmOperand<3>(Inst, Imm);
163 uint64_t
Address,
const void *Decoder) {
164 return decodeUImmOperand<4>(Inst, Imm);
168 uint64_t
Address,
const void *Decoder) {
169 return decodeUImmOperand<6>(Inst, Imm);
173 uint64_t
Address,
const void *Decoder) {
174 return decodeUImmOperand<8>(Inst, Imm);
178 uint64_t
Address,
const void *Decoder) {
179 return decodeUImmOperand<12>(Inst, Imm);
183 uint64_t
Address,
const void *Decoder) {
184 return decodeUImmOperand<16>(Inst, Imm);
188 uint64_t
Address,
const void *Decoder) {
189 return decodeUImmOperand<32>(Inst, Imm);
193 uint64_t
Address,
const void *Decoder) {
194 return decodeSImmOperand<8>(Inst, Imm);
198 uint64_t
Address,
const void *Decoder) {
199 return decodeSImmOperand<16>(Inst, Imm);
203 uint64_t
Address,
const void *Decoder) {
204 return decodeSImmOperand<32>(Inst, Imm);
210 assert(isUInt<N>(Imm) &&
"Invalid PC-relative offset");
217 const void *Decoder) {
218 return decodePCDBLOperand<16>(Inst, Imm,
Address);
223 const void *Decoder) {
224 return decodePCDBLOperand<32>(Inst, Imm,
Address);
228 const unsigned *Regs) {
229 uint64_t Base = Field >> 12;
230 uint64_t Disp = Field & 0xfff;
231 assert(Base < 16 &&
"Invalid BDAddr12");
238 const unsigned *Regs) {
239 uint64_t Base = Field >> 20;
240 uint64_t Disp = ((Field << 12) & 0xff000) | ((Field >> 8) & 0xfff);
241 assert(Base < 16 &&
"Invalid BDAddr20");
248 const unsigned *Regs) {
249 uint64_t Index = Field >> 16;
250 uint64_t Base = (Field >> 12) & 0xf;
251 uint64_t Disp = Field & 0xfff;
252 assert(Index < 16 &&
"Invalid BDXAddr12");
260 const unsigned *Regs) {
261 uint64_t Index = Field >> 24;
262 uint64_t Base = (Field >> 20) & 0xf;
263 uint64_t Disp = ((Field & 0xfff00) >> 8) | ((Field & 0xff) << 12);
264 assert(Index < 16 &&
"Invalid BDXAddr20");
272 const unsigned *Regs) {
273 uint64_t Length = Field >> 16;
274 uint64_t Base = (Field >> 12) & 0xf;
275 uint64_t Disp = Field & 0xfff;
276 assert(Length < 256 &&
"Invalid BDLAddr12Len8");
284 const unsigned *Regs) {
285 uint64_t Index = Field >> 16;
286 uint64_t Base = (Field >> 12) & 0xf;
287 uint64_t Disp = Field & 0xfff;
288 assert(Index < 32 &&
"Invalid BDVAddr12");
297 const void *Decoder) {
303 const void *Decoder) {
309 const void *Decoder) {
315 const void *Decoder) {
321 const void *Decoder) {
327 const void *Decoder) {
334 const void *Decoder) {
340 const void *Decoder) {
344 #include "SystemZGenDisassemblerTables.inc"
353 if (Bytes.
size() < 2)
357 const uint8_t *Table;
358 if (Bytes[0] < 0x40) {
360 Table = DecoderTable16;
361 }
else if (Bytes[0] < 0xc0) {
363 Table = DecoderTable32;
366 Table = DecoderTable48;
370 if (Bytes.
size() < Size)
375 for (uint64_t
I = 0;
I < Size; ++
I)
376 Inst = (Inst << 8) | Bytes[
I];
static DecodeStatus decodeBDAddr12Operand(MCInst &Inst, uint64_t Field, const unsigned *Regs)
const unsigned GR32Regs[16]
const unsigned FP128Regs[16]
static DecodeStatus decodeBDAddr32Disp12Operand(MCInst &Inst, uint64_t Field, uint64_t Address, const void *Decoder)
DecodeStatus
Ternary decode status.
static DecodeStatus decodeBDAddr20Operand(MCInst &Inst, uint64_t Field, const unsigned *Regs)
Superclass for all disassemblers.
static DecodeStatus decodePC32DBLOperand(MCInst &Inst, uint64_t Imm, uint64_t Address, const void *Decoder)
static DecodeStatus decodeBDXAddr12Operand(MCInst &Inst, uint64_t Field, const unsigned *Regs)
static DecodeStatus decodeU1ImmOperand(MCInst &Inst, uint64_t Imm, uint64_t Address, const void *Decoder)
MCDisassembler::DecodeStatus DecodeStatus
static DecodeStatus DecodeADDR64BitRegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeVR64BitRegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder)
static void RegisterMCDisassembler(Target &T, Target::MCDisassemblerCtorTy Fn)
RegisterMCDisassembler - Register a MCDisassembler implementation for the given target.
const unsigned FP32Regs[16]
static DecodeStatus DecodeFP32BitRegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder)
static DecodeStatus decodeBDVAddr12Operand(MCInst &Inst, uint64_t Field, const unsigned *Regs)
static DecodeStatus decodeBDVAddr64Disp12Operand(MCInst &Inst, uint64_t Field, uint64_t Address, const void *Decoder)
static DecodeStatus decodePC16DBLOperand(MCInst &Inst, uint64_t Imm, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeFP128BitRegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder)
const unsigned VR64Regs[32]
static DecodeStatus decodeS32ImmOperand(MCInst &Inst, uint64_t Imm, uint64_t Address, const void *Decoder)
static MCOperand createReg(unsigned Reg)
static DecodeStatus decodeU6ImmOperand(MCInst &Inst, uint64_t Imm, uint64_t Address, const void *Decoder)
static DecodeStatus decodeBDAddr64Disp20Operand(MCInst &Inst, uint64_t Field, uint64_t Address, const void *Decoder)
static DecodeStatus decodeBDXAddr20Operand(MCInst &Inst, uint64_t Field, const unsigned *Regs)
const unsigned GRH32Regs[16]
static MCDisassembler * createSystemZDisassembler(const Target &T, const MCSubtargetInfo &STI, MCContext &Ctx)
Context object for machine code objects.
static DecodeStatus decodeU16ImmOperand(MCInst &Inst, uint64_t Imm, uint64_t Address, const void *Decoder)
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 DecodeStatus decodeBDAddr32Disp20Operand(MCInst &Inst, uint64_t Field, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeGR32BitRegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder)
static DecodeStatus decodeBDAddr64Disp12Operand(MCInst &Inst, uint64_t Field, uint64_t Address, const void *Decoder)
size_t size() const
size - Get the array size.
Instances of this class represent a single low-level machine instruction.
static DecodeStatus decodeBDXAddr64Disp12Operand(MCInst &Inst, uint64_t Field, uint64_t Address, const void *Decoder)
static DecodeStatus decodeS8ImmOperand(MCInst &Inst, uint64_t Imm, uint64_t Address, const void *Decoder)
static DecodeStatus decodeBDLAddr12Len8Operand(MCInst &Inst, uint64_t Field, const unsigned *Regs)
static DecodeStatus decodeU32ImmOperand(MCInst &Inst, uint64_t Imm, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeGR64BitRegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder)
static DecodeStatus decodeUImmOperand(MCInst &Inst, uint64_t Imm)
static DecodeStatus decodeBDXAddr64Disp20Operand(MCInst &Inst, uint64_t Field, uint64_t Address, const void *Decoder)
static DecodeStatus decodeU2ImmOperand(MCInst &Inst, uint64_t Imm, uint64_t Address, const void *Decoder)
static DecodeStatus decodeAccessRegOperand(MCInst &Inst, uint64_t Imm, uint64_t Address, const void *Decoder)
static DecodeStatus decodeS16ImmOperand(MCInst &Inst, uint64_t Imm, uint64_t Address, const void *Decoder)
static DecodeStatus decodePCDBLOperand(MCInst &Inst, uint64_t Imm, uint64_t Address)
static DecodeStatus decodeBDLAddr64Disp12Len8Operand(MCInst &Inst, uint64_t Field, uint64_t Address, const void *Decoder)
const unsigned FP64Regs[16]
const unsigned GR128Regs[16]
const unsigned GR64Regs[16]
static DecodeStatus decodeU8ImmOperand(MCInst &Inst, uint64_t Imm, uint64_t Address, const void *Decoder)
Target - Wrapper for Target specific information.
static DecodeStatus decodeU12ImmOperand(MCInst &Inst, uint64_t Imm, uint64_t Address, const void *Decoder)
static DecodeStatus decodeU4ImmOperand(MCInst &Inst, uint64_t Imm, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeGRH32BitRegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder)
MCSubtargetInfo - Generic base class for all target subtargets.
static DecodeStatus DecodeGR128BitRegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder)
static DecodeStatus decodeSImmOperand(MCInst &Inst, uint64_t Imm)
const unsigned VR32Regs[32]
static DecodeStatus decodeU3ImmOperand(MCInst &Inst, uint64_t Imm, uint64_t Address, const void *Decoder)
void LLVMInitializeSystemZDisassembler()
static DecodeStatus DecodeVR128BitRegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeFP64BitRegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder)
This class implements an extremely fast bulk output stream that can only output to a stream...
void addOperand(const MCOperand &Op)
static DecodeStatus decodeRegisterClass(MCInst &Inst, uint64_t RegNo, const unsigned *Regs, unsigned Size)
static MCOperand createImm(int64_t Val)
const unsigned VR128Regs[32]
static DecodeStatus DecodeVR32BitRegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder)