23 #define DEBUG_TYPE "systemz-disassembler" 33 ~SystemZDisassembler()
override =
default;
45 return new SystemZDisassembler(STI, Ctx);
76 const void *Decoder) {
83 const unsigned *Regs,
unsigned Size) {
84 assert(RegNo < Size &&
"Invalid register");
94 const void *Decoder) {
100 const void *Decoder) {
106 const void *Decoder) {
112 const void *Decoder) {
118 const void *Decoder) {
124 const void *Decoder) {
130 const void *Decoder) {
136 const void *Decoder) {
142 const void *Decoder) {
148 const void *Decoder) {
154 const void *Decoder) {
160 const void *Decoder) {
166 const void *Decoder) {
187 uint64_t
Address,
const void *Decoder) {
188 return decodeUImmOperand<1>(Inst, Imm);
192 uint64_t
Address,
const void *Decoder) {
193 return decodeUImmOperand<2>(Inst, Imm);
197 uint64_t
Address,
const void *Decoder) {
198 return decodeUImmOperand<3>(Inst, Imm);
202 uint64_t
Address,
const void *Decoder) {
203 return decodeUImmOperand<4>(Inst, Imm);
207 uint64_t
Address,
const void *Decoder) {
208 return decodeUImmOperand<6>(Inst, Imm);
212 uint64_t
Address,
const void *Decoder) {
213 return decodeUImmOperand<8>(Inst, Imm);
217 uint64_t
Address,
const void *Decoder) {
218 return decodeUImmOperand<12>(Inst, Imm);
222 uint64_t
Address,
const void *Decoder) {
223 return decodeUImmOperand<16>(Inst, Imm);
227 uint64_t
Address,
const void *Decoder) {
228 return decodeUImmOperand<32>(Inst, Imm);
232 uint64_t
Address,
const void *Decoder) {
233 return decodeSImmOperand<8>(Inst, Imm);
237 uint64_t
Address,
const void *Decoder) {
238 return decodeSImmOperand<16>(Inst, Imm);
242 uint64_t
Address,
const void *Decoder) {
243 return decodeSImmOperand<32>(Inst, Imm);
250 const void *Decoder) {
251 assert(isUInt<N>(Imm) &&
"Invalid PC-relative offset");
252 uint64_t
Value = SignExtend64<N>(Imm) * 2 + Address;
263 const void *Decoder) {
264 return decodePCDBLOperand<12>(Inst, Imm,
Address,
true, Decoder);
269 const void *Decoder) {
270 return decodePCDBLOperand<16>(Inst, Imm,
Address,
true, Decoder);
275 const void *Decoder) {
276 return decodePCDBLOperand<24>(Inst, Imm,
Address,
true, Decoder);
281 const void *Decoder) {
282 return decodePCDBLOperand<32>(Inst, Imm,
Address,
true, Decoder);
287 const void *Decoder) {
288 return decodePCDBLOperand<32>(Inst, Imm,
Address,
false, Decoder);
292 const unsigned *Regs) {
293 uint64_t
Base = Field >> 12;
294 uint64_t Disp = Field & 0xfff;
295 assert(Base < 16 &&
"Invalid BDAddr12");
302 const unsigned *Regs) {
303 uint64_t
Base = Field >> 20;
304 uint64_t Disp = ((Field << 12) & 0xff000) | ((Field >> 8) & 0xfff);
305 assert(Base < 16 &&
"Invalid BDAddr20");
312 const unsigned *Regs) {
313 uint64_t
Index = Field >> 16;
314 uint64_t
Base = (Field >> 12) & 0xf;
315 uint64_t Disp = Field & 0xfff;
316 assert(Index < 16 &&
"Invalid BDXAddr12");
324 const unsigned *Regs) {
325 uint64_t
Index = Field >> 24;
326 uint64_t
Base = (Field >> 20) & 0xf;
327 uint64_t Disp = ((Field & 0xfff00) >> 8) | ((Field & 0xff) << 12);
328 assert(Index < 16 &&
"Invalid BDXAddr20");
336 const unsigned *Regs) {
337 uint64_t Length = Field >> 16;
338 uint64_t
Base = (Field >> 12) & 0xf;
339 uint64_t Disp = Field & 0xfff;
340 assert(Length < 16 &&
"Invalid BDLAddr12Len4");
348 const unsigned *Regs) {
349 uint64_t Length = Field >> 16;
350 uint64_t
Base = (Field >> 12) & 0xf;
351 uint64_t Disp = Field & 0xfff;
352 assert(Length < 256 &&
"Invalid BDLAddr12Len8");
360 const unsigned *Regs) {
361 uint64_t Length = Field >> 16;
362 uint64_t
Base = (Field >> 12) & 0xf;
363 uint64_t Disp = Field & 0xfff;
364 assert(Length < 16 &&
"Invalid BDRAddr12");
372 const unsigned *Regs) {
373 uint64_t
Index = Field >> 16;
374 uint64_t
Base = (Field >> 12) & 0xf;
375 uint64_t Disp = Field & 0xfff;
376 assert(Index < 32 &&
"Invalid BDVAddr12");
385 const void *Decoder) {
391 const void *Decoder) {
397 const void *Decoder) {
403 const void *Decoder) {
409 const void *Decoder) {
415 const void *Decoder) {
422 const void *Decoder) {
429 const void *Decoder) {
436 const void *Decoder) {
442 const void *Decoder) {
446 #include "SystemZGenDisassemblerTables.inc" 454 if (Bytes.
size() < 2)
458 const uint8_t *Table;
459 if (Bytes[0] < 0x40) {
461 Table = DecoderTable16;
462 }
else if (Bytes[0] < 0xc0) {
464 Table = DecoderTable32;
467 Table = DecoderTable48;
476 for (uint64_t
I = 0;
I <
Size; ++
I)
477 Inst = (Inst << 8) | Bytes[
I];
479 return decodeInstruction(Table, MI, Inst,
Address,
this, STI);
static DecodeStatus decodeBDAddr12Operand(MCInst &Inst, uint64_t Field, const unsigned *Regs)
const unsigned GR32Regs[16]
static DecodeStatus decodePCDBLOperand(MCInst &Inst, uint64_t Imm, uint64_t Address, bool isBranch, const void *Decoder)
This class represents lattice values for constants.
const unsigned FP128Regs[16]
static DecodeStatus decodeBDAddr32Disp12Operand(MCInst &Inst, uint64_t Field, uint64_t Address, const void *Decoder)
DecodeStatus
Ternary decode status.
LLVM_EXTERNAL_VISIBILITY void LLVMInitializeSystemZDisassembler()
static DecodeStatus decodeBDAddr20Operand(MCInst &Inst, uint64_t Field, const unsigned *Regs)
Superclass for all disassemblers.
bool tryAddingSymbolicOperand(MCInst &Inst, int64_t Value, uint64_t Address, bool IsBranch, uint64_t Offset, uint64_t InstSize) const
static DecodeStatus decodePC32DBLOperand(MCInst &Inst, uint64_t Imm, uint64_t Address, const void *Decoder)
static DecodeStatus decodePC16DBLBranchOperand(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 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 DecodeStatus decodeBDLAddr64Disp12Len4Operand(MCInst &Inst, uint64_t Field, 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)
const unsigned AR32Regs[16]
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)
static bool tryAddingSymbolicOperand(int64_t Value, bool isBranch, uint64_t Address, uint64_t Offset, uint64_t Width, MCInst &MI, const void *Decoder)
tryAddingSymbolicOperand - trys to add a symbolic operand in place of the immediate Value in the MCIn...
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)
const unsigned CR64Regs[16]
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 decodePC12DBLBranchOperand(MCInst &Inst, uint64_t Imm, 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)
size_t size() const
size - Get the array size.
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 decodeBDLAddr12Len4Operand(MCInst &Inst, uint64_t Field, const unsigned *Regs)
static DecodeStatus decodeU2ImmOperand(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 decodeBDRAddr12Operand(MCInst &Inst, uint64_t Field, const unsigned *Regs)
static DecodeStatus decodeBDLAddr64Disp12Len8Operand(MCInst &Inst, uint64_t Field, uint64_t Address, const void *Decoder)
const unsigned FP64Regs[16]
const unsigned GR128Regs[16]
#define LLVM_EXTERNAL_VISIBILITY
const unsigned GR64Regs[16]
static DecodeStatus decodeU8ImmOperand(MCInst &Inst, uint64_t Imm, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeAR32BitRegisterClass(MCInst &Inst, uint64_t RegNo, 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)
Target & getTheSystemZTarget()
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)
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)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static bool isBranch(unsigned Opcode)
static DecodeStatus DecodeVR128BitRegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder)
LLVM Value Representation.
static DecodeStatus decodePC24DBLBranchOperand(MCInst &Inst, uint64_t Imm, 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 DecodeStatus decodePC32DBLBranchOperand(MCInst &Inst, uint64_t Imm, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeCR64BitRegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder)
static MCOperand createImm(int64_t Val)
const unsigned VR128Regs[32]
static DecodeStatus decodeBDRAddr64Disp12Operand(MCInst &Inst, uint64_t Field, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeVR32BitRegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder)