16#ifndef LLVM_LIB_TARGET_X86_MCTARGETDESC_X86BASEINFO_H
17#define LLVM_LIB_TARGET_X86_MCTARGETDESC_X86BASEINFO_H
141 case X86::TEST64ri32:
240 case X86::INC16r_alt:
242 case X86::INC32r_alt:
247 case X86::DEC16r_alt:
249 case X86::DEC32r_alt:
969 unsigned NumDefs =
Desc.getNumDefs();
970 unsigned NumOps =
Desc.getNumOperands();
1038 return 1 + HasVEX_4V + HasEVEX_K;
1041 return 1 + HasEVEX_K;
1089 return 0 + HasVEX_4V + HasEVEX_K;
1160 static_assert(X86::XMM15 - X86::XMM0 == 15,
1161 "XMM0-15 registers are not continuous");
1162 static_assert(X86::XMM31 - X86::XMM16 == 15,
1163 "XMM16-31 registers are not continuous");
1164 return (RegNo >= X86::XMM0 && RegNo <= X86::XMM15) ||
1165 (RegNo >= X86::XMM16 && RegNo <= X86::XMM31);
1170 static_assert(X86::YMM15 - X86::YMM0 == 15,
1171 "YMM0-15 registers are not continuous");
1172 static_assert(X86::YMM31 - X86::YMM16 == 15,
1173 "YMM16-31 registers are not continuous");
1174 return (RegNo >= X86::YMM0 && RegNo <= X86::YMM15) ||
1175 (RegNo >= X86::YMM16 && RegNo <= X86::YMM31);
1180 static_assert(X86::ZMM31 - X86::ZMM0 == 31,
1181 "ZMM registers are not continuous");
1182 return RegNo >= X86::ZMM0 && RegNo <= X86::ZMM31;
1187 static_assert(X86::R31WH - X86::R16 == 95,
"EGPRs are not continuous");
1188 return RegNo >= X86::R16 && RegNo <= X86::R31WH;
1194 if ((RegNo >= X86::XMM8 && RegNo <= X86::XMM15) ||
1195 (RegNo >= X86::XMM16 && RegNo <= X86::XMM31) ||
1196 (RegNo >= X86::YMM8 && RegNo <= X86::YMM15) ||
1197 (RegNo >= X86::YMM16 && RegNo <= X86::YMM31) ||
1198 (RegNo >= X86::ZMM8 && RegNo <= X86::ZMM31))
1267 unsigned Opcode =
Desc.Opcode;
1269 if (Opcode == X86::MOV32r0)
1285 case X86::XSAVEOPT64:
1293 case X86::XRSTORS64:
1303 return ((RegNo >= X86::XMM16 && RegNo <= X86::XMM31) ||
1304 (RegNo >= X86::YMM16 && RegNo <= X86::YMM31) ||
1305 (RegNo >= X86::ZMM16 && RegNo <= X86::ZMM31));
1309 return (reg == X86::SPL || reg == X86::BPL || reg == X86::SIL ||
1324inline bool needSIB(
unsigned BaseReg,
unsigned IndexReg,
bool In64BitMode) {
1336 return In64BitMode && !BaseReg;
Describe properties that are true of each instruction in the target description file.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ X86
Windows x64, Windows Itanium (IA-64)
bool isKMergeMasked(uint64_t TSFlags)
bool isXMMReg(unsigned RegNo)
bool isX86_64ExtendedReg(unsigned RegNo)
bool isPrefix(uint64_t TSFlags)
bool hasImm(uint64_t TSFlags)
bool hasNewDataDest(uint64_t TSFlags)
TOF
Target Operand Flag enum.
@ MO_TLSLD
MO_TLSLD - On a symbol operand this indicates that the immediate is the offset of the GOT entry with ...
@ MO_GOTPCREL_NORELAX
MO_GOTPCREL_NORELAX - Same as MO_GOTPCREL except that R_X86_64_GOTPCREL relocations are guaranteed to...
@ MO_GOTOFF
MO_GOTOFF - On a symbol operand this indicates that the immediate is the offset to the location of th...
@ MO_DARWIN_NONLAZY_PIC_BASE
MO_DARWIN_NONLAZY_PIC_BASE - On a symbol operand "FOO", this indicates that the reference is actually...
@ MO_GOT_ABSOLUTE_ADDRESS
MO_GOT_ABSOLUTE_ADDRESS - On a symbol operand, this represents a relocation of: SYMBOL_LABEL + [.
@ MO_COFFSTUB
MO_COFFSTUB - On a symbol operand "FOO", this indicates that the reference is actually to the "....
@ MO_NTPOFF
MO_NTPOFF - On a symbol operand this indicates that the immediate is the negative thread-pointer offs...
@ MO_DARWIN_NONLAZY
MO_DARWIN_NONLAZY - On a symbol operand "FOO", this indicates that the reference is actually to the "...
@ MO_INDNTPOFF
MO_INDNTPOFF - On a symbol operand this indicates that the immediate is the absolute address of the G...
@ MO_GOTNTPOFF
MO_GOTNTPOFF - On a symbol operand this indicates that the immediate is the offset of the GOT entry w...
@ MO_TPOFF
MO_TPOFF - On a symbol operand this indicates that the immediate is the thread-pointer offset for the...
@ MO_TLVP_PIC_BASE
MO_TLVP_PIC_BASE - On a symbol operand this indicates that the immediate is some TLS offset from the ...
@ MO_GOT
MO_GOT - On a symbol operand this indicates that the immediate is the offset to the GOT entry for the...
@ MO_ABS8
MO_ABS8 - On a symbol operand this indicates that the symbol is known to be an absolute symbol in ran...
@ MO_PLT
MO_PLT - On a symbol operand this indicates that the immediate is offset to the PLT entry of symbol n...
@ MO_TLSGD
MO_TLSGD - On a symbol operand this indicates that the immediate is the offset of the GOT entry with ...
@ MO_NO_FLAG
MO_NO_FLAG - No flag for the operand.
@ MO_TLVP
MO_TLVP - On a symbol operand this indicates that the immediate is some TLS offset.
@ MO_DLLIMPORT
MO_DLLIMPORT - On a symbol operand "FOO", this indicates that the reference is actually to the "__imp...
@ MO_GOTTPOFF
MO_GOTTPOFF - On a symbol operand this indicates that the immediate is the offset of the GOT entry wi...
@ MO_SECREL
MO_SECREL - On a symbol operand this indicates that the immediate is the offset from beginning of sec...
@ MO_DTPOFF
MO_DTPOFF - On a symbol operand this indicates that the immediate is the offset of the GOT entry with...
@ MO_PIC_BASE_OFFSET
MO_PIC_BASE_OFFSET - On a symbol operand this indicates that the immediate should get the value of th...
@ MO_TLSLDM
MO_TLSLDM - On a symbol operand this indicates that the immediate is the offset of the GOT entry with...
@ MO_GOTPCREL
MO_GOTPCREL - On a symbol operand this indicates that the immediate is offset to the GOT entry for th...
bool isZMMReg(unsigned RegNo)
bool isX86_64NonExtLowByteReg(unsigned reg)
bool isYMMReg(unsigned RegNo)
bool canUseApxExtendedReg(const MCInstrDesc &Desc)
bool needSIB(unsigned BaseReg, unsigned IndexReg, bool In64BitMode)
bool isPseudo(uint64_t TSFlags)
bool isImmPCRel(uint64_t TSFlags)
unsigned getSizeOfImm(uint64_t TSFlags)
Decode the "size of immediate" field from the TSFlags field of the specified instruction.
uint8_t getBaseOpcodeFor(uint64_t TSFlags)
bool isKMasked(uint64_t TSFlags)
bool isApxExtendedReg(unsigned RegNo)
int getMemoryOperandNo(uint64_t TSFlags)
unsigned getOperandBias(const MCInstrDesc &Desc)
Compute whether all of the def operands are repeated in the uses and therefore should be skipped.
static bool is32ExtendedReg(unsigned RegNo)
@ ExplicitOpPrefixShift
Force REX2/VEX/EVEX encoding.
@ MRM0X
MRM0X-MRM7X - Instructions that operate that have mod=11 and an opcode but ignore r/m.
@ EVEX_ZShift
EVEX_Z - Set if this instruction has EVEX.Z field set.
@ RawFrm
Raw - This form is for instructions that don't have any operands, so they are just a fixed opcode val...
@ VEX_LShift
VEX_L - Stands for a bit in the VEX opcode prefix meaning the current instruction uses 256-bit wide r...
@ SpecialFP
SpecialFP - Special instruction forms. Dispatch by opcode explicitly.
@ RawFrmDstSrc
RawFrmDstSrc - This form is for instructions that use the source index register SI/ESI/RSI with a pos...
@ EVEX_KShift
EVEX_K - Set if this instruction requires masking.
@ EVEX
EVEX - Specifies that this instruction use EVEX form which provides syntax support up to 32 512-bit r...
@ ExplicitREX2Prefix
For instructions that require REX2 prefix even if EGPR is not used.
@ EVEX_BShift
EVEX_B - Set if this instruction has EVEX.B field set.
@ MRMSrcMemCC
MRMSrcMemCC - This form is used for instructions that use the Mod/RM byte to specify the operands and...
@ NotFP
NotFP - The default, set for instructions that do not use FP registers.
@ MRM_C0
MRM_XX (XX: C0-FF)- A mod/rm byte of exactly 0xXX.
@ RawFrmDst
RawFrmDst - This form is for instructions that use the destination index register DI/EDI/RDI.
@ OpPrefixShift
OpPrefix - There are several prefix bytes that are used as opcode extensions.
@ MRMDestMem4VOp3CC
MRMDestMem4VOp3CC - This form is used for instructions that use the Mod/RM byte to specify a destinat...
@ OB
OB - OneByte - Set if this instruction has a one byte opcode.
@ AddCCFrm
AddCCFrm - This form is used for Jcc that encode the condition code in the lower 4 bits of the opcode...
@ T_MAP4
MAP4, MAP5, MAP6, MAP7 - Prefix after the 0x0F prefix.
@ PrefixByte
PrefixByte - This form is used for instructions that represent a prefix byte like data16 or rep.
@ MRMr0
Instructions operate on a register Reg/Opcode operand not the r/m field.
@ TwoConditionalOps_Shift
@ MRMXm
MRMXm - This form is used for instructions that use the Mod/RM byte to specify a memory source,...
@ OneArgFPRW
OneArgFPRW - 1 arg FP instruction which implicitly read ST(0) and write a result back to ST(0).
@ MRM0r
MRM0r-MRM7r - Instructions that operate on a register r/m operand and use reg field to hold extended ...
@ MRMDestMemFSIB
MRMDestMem - But force to use the SIB field.
@ AddRegFrm
AddRegFrm - This form is used for instructions like 'push r32' that have their one register operand a...
@ ExplicitEVEXPrefix
For instructions that are promoted to EVEX space for EGPR.
@ VEX
VEX - encoding using 0xC4/0xC5.
@ RawFrmImm8
RawFrmImm8 - This is used for the ENTER instruction, which has two immediates, the first of which is ...
@ OpSizeShift
OpSize - OpSizeFixed implies instruction never needs a 0x66 prefix.
@ TB
TB - TwoByte - Set if this instruction has a two byte opcode, which starts with a 0x0F byte before th...
@ XOP
XOP - Opcode prefix used by XOP instructions.
@ MRMXr
MRMXr - This form is used for instructions that use the Mod/RM byte to specify a register source,...
@ MRMSrcMem4VOp3
MRMSrcMem4VOp3 - This form is used for instructions that encode operand 3 with VEX....
@ EVEX_L2Shift
EVEX_L2 - Set if this instruction has EVEX.L' field set.
@ XOP8
XOP8 - Prefix to include use of imm byte.
@ ZeroArgFP
ZeroArgFP - 0 arg FP instruction which implicitly pushes ST(0), f.e. fld0.
@ REXShift
REX_W - REX prefixes are instruction prefixes used in 64-bit mode.
@ MRMDestRegCC
MRMDestRegCC - This form is used for the cfcmov instructions, which use the Mod/RM byte to specify th...
@ AdSizeShift
AsSize - AdSizeX implies this instruction determines its need of 0x67 prefix from a normal ModRM memo...
@ PD
PD - Prefix code for packed double precision vector floating point operations performed in the SSE re...
@ MRMDestMem
MRMDestMem - This form is used for instructions that use the Mod/RM byte to specify a destination,...
@ OneArgFP
OneArgFP - 1 arg FP instructions which implicitly read ST(0), such as fst.
@ MRMSrcMemFSIB
MRMSrcMem - But force to use the SIB field.
@ CompareFP
CompareFP - 2 arg FP instructions which implicitly read ST(0) and an explicit argument,...
@ NoTrackShift
NOTRACK prefix.
@ ExplicitVEXPrefix
For instructions that use VEX encoding only when {vex}, {vex2} or {vex3} is present.
@ EVEX_RCShift
Explicitly specified rounding control.
@ MRMSrcRegOp4
MRMSrcRegOp4 - This form is used for instructions that use the Mod/RM byte to specify the fourth sour...
@ MRMXrCC
MRMXCCr - This form is used for instructions that use the Mod/RM byte to specify a register source,...
@ T8
T8, TA - Prefix after the 0x0F prefix.
@ MRMDestMemCC
MRMDestMemCC - This form is used for the cfcmov instructions, which use the Mod/RM byte to specify th...
@ XOP9
XOP9 - Prefix to exclude use of imm byte.
@ MRMXmCC
MRMXm - This form is used for instructions that use the Mod/RM byte to specify a memory source,...
@ RawFrmImm16
RawFrmImm16 - This is used for CALL FAR instructions, which have two immediates, the first of which i...
@ MRMSrcReg
MRMSrcReg - This form is used for instructions that use the Mod/RM byte to specify a source,...
@ RawFrmSrc
RawFrmSrc - This form is for instructions that use the source index register SI/ESI/RSI with a possib...
@ MRMDestReg
MRMDestReg - This form is used for instructions that use the Mod/RM byte to specify a destination,...
@ MRMSrcMem
MRMSrcMem - This form is used for instructions that use the Mod/RM byte to specify a source,...
@ MRMSrcMemOp4
MRMSrcMemOp4 - This form is used for instructions that use the Mod/RM byte to specify the fourth sour...
@ Pseudo
PseudoFrm - This represents an instruction that is a pseudo instruction or one that has not been impl...
@ VEX_4VShift
VEX_4V - Used to specify an additional AVX/SSE register.
@ CD8_Scale_Shift
The scaling factor for the AVX512's 8-bit compressed displacement.
@ MRMSrcRegCC
MRMSrcRegCC - This form is used for instructions that use the Mod/RM byte to specify the operands and...
@ SSEDomainShift
Execution domain for SSE instructions.
@ CondMovFP
CondMovFP - "2 operand" floating point conditional move instructions.
@ MRM0m
MRM0m-MRM7m - Instructions that operate on a memory r/m operand and use reg field to hold extended op...
@ ThreeDNow
ThreeDNow - This indicates that the instruction uses the wacky 0x0F 0x0F prefix for 3DNow!...
@ XS
XS, XD - These prefix codes are for single and double precision scalar floating point operations perf...
@ FPTypeShift
FP Instruction Classification... Zero is non-fp instruction.
@ XOPA
XOPA - Prefix to encode 0xA in VEX.MMMM of XOP instructions.
@ MRMSrcReg4VOp3
MRMSrcReg4VOp3 - This form is used for instructions that encode operand 3 with VEX....
@ OpMapShift
OpMap - This field determines which opcode map this instruction belongs to.
@ LEGACY
LEGACY - encoding using REX/REX2 or w/o opcode prefix.
@ RawFrmMemOffs
RawFrmMemOffs - This form is for instructions that store an absolute memory offset as an immediate wi...
@ TwoArgFP
TwoArgFP - 2 arg FP instructions which implicitly read ST(0), and an explicit argument,...
@ EVEX_NFShift
EVEX_NF - Set if this instruction has EVEX.NF field set.
bool isImmSigned(uint64_t TSFlags)
FirstMacroFusionInstKind classifyFirstOpcodeInMacroFusion(unsigned Opcode)
@ OPERAND_ROUNDING_CONTROL
AlignBranchBoundaryKind
Defines the possible values of the branch boundary alignment mask.
STATIC_ROUNDING
AVX512 static rounding constants.
EncodingOfSegmentOverridePrefix
Defines the encoding values for segment override prefix.
SecondMacroFusionInstKind
IPREFIXES
The constants to describe instr prefixes if there are.
SecondMacroFusionInstKind classifySecondCondCodeInMacroFusion(X86::CondCode CC)
EncodingOfSegmentOverridePrefix getSegmentOverridePrefixForReg(unsigned Reg)
Given a segment register, return the encoding of the segment override prefix for it.
bool isMacroFused(FirstMacroFusionInstKind FirstKind, SecondMacroFusionInstKind SecondKind)
This is an optimization pass for GlobalISel generic memory operations.
Description of the encoding of one expression Op.