42#define DEBUG_TYPE "mccodeemitter"
44STATISTIC(MCNumEmitted,
"Number of MC instructions emitted.");
45STATISTIC(MCNumCPRelocations,
"Number of constant pool relocations created.");
56 : MCII(mcii), CTX(ctx), IsLittleEndian(IsLittle) {
58 ARMMCCodeEmitter(
const ARMMCCodeEmitter &) =
delete;
59 ARMMCCodeEmitter &
operator=(
const ARMMCCodeEmitter &) =
delete;
60 ~ARMMCCodeEmitter()
override =
default;
72 return TT.isOSBinFormatMachO();
75 unsigned getMachineSoImmOpValue(
unsigned SoImm)
const;
97 bool EncodeAddrModeOpValues(
const MCInst &
MI,
unsigned OpIdx,
98 unsigned &Reg,
unsigned &Imm,
206 template<
unsigned Bits,
unsigned Shift>
306 unsigned getCCOutOpValue(
const MCInst &
MI,
unsigned Op,
311 return MI.getOperand(
Op).getReg() == ARM::CPSR;
314 unsigned getModImmOpValue(
const MCInst &
MI,
unsigned Op,
333 unsigned getT2SOImmOpValue(
const MCInst &
MI,
unsigned Op,
346 unsigned SoImm = MO.
getImm();
348 assert(Encoded != ~0U &&
"Not a Thumb2 so_imm value?");
352 unsigned getT2AddrModeSORegOpValue(
const MCInst &
MI,
unsigned OpNum,
355 template<
unsigned Bits,
unsigned Shift>
356 unsigned getT2AddrModeImmOpValue(
const MCInst &
MI,
unsigned OpNum,
359 unsigned getT2AddrModeImm8OffsetOpValue(
const MCInst &
MI,
unsigned OpNum,
364 unsigned getSORegRegOpValue(
const MCInst &
MI,
unsigned Op,
367 unsigned getSORegImmOpValue(
const MCInst &
MI,
unsigned Op,
370 unsigned getT2SORegOpValue(
const MCInst &
MI,
unsigned Op,
374 unsigned getNEONVcvtImm32OpValue(
const MCInst &
MI,
unsigned Op,
377 return 64 -
MI.getOperand(
Op).getImm();
380 unsigned getBitfieldInvertedMaskOpValue(
const MCInst &
MI,
unsigned Op,
384 unsigned getRegisterListOpValue(
const MCInst &
MI,
unsigned Op,
387 unsigned getAddrMode6AddressOpValue(
const MCInst &
MI,
unsigned Op,
390 unsigned getAddrMode6OneLane32AddressOpValue(
const MCInst &
MI,
unsigned Op,
393 unsigned getAddrMode6DupAddressOpValue(
const MCInst &
MI,
unsigned Op,
396 unsigned getAddrMode6OffsetOpValue(
const MCInst &
MI,
unsigned Op,
400 unsigned getShiftRight8Imm(
const MCInst &
MI,
unsigned Op,
403 unsigned getShiftRight16Imm(
const MCInst &
MI,
unsigned Op,
406 unsigned getShiftRight32Imm(
const MCInst &
MI,
unsigned Op,
409 unsigned getShiftRight64Imm(
const MCInst &
MI,
unsigned Op,
413 unsigned getThumbSRImmOpValue(
const MCInst &
MI,
unsigned Op,
417 unsigned NEONThumb2DataIPostEncoder(
const MCInst &
MI,
418 unsigned EncodedValue,
420 unsigned NEONThumb2LoadStorePostEncoder(
const MCInst &
MI,
421 unsigned EncodedValue,
423 unsigned NEONThumb2DupPostEncoder(
const MCInst &
MI,
424 unsigned EncodedValue,
426 unsigned NEONThumb2V8PostEncoder(
const MCInst &
MI,
427 unsigned EncodedValue,
430 unsigned VFPThumb2PostEncoder(
const MCInst &
MI,
431 unsigned EncodedValue,
442 template <
bool isNeg, ARM::Fixups fixup>
457 template <
unsigned size>
468unsigned ARMMCCodeEmitter::NEONThumb2DataIPostEncoder(
const MCInst &
MI,
469 unsigned EncodedValue,
475 unsigned Bit24 = EncodedValue & 0x01000000;
476 unsigned Bit28 = Bit24 << 4;
477 EncodedValue &= 0xEFFFFFFF;
478 EncodedValue |= Bit28;
479 EncodedValue |= 0x0F000000;
488unsigned ARMMCCodeEmitter::NEONThumb2LoadStorePostEncoder(
const MCInst &
MI,
489 unsigned EncodedValue,
492 EncodedValue &= 0xF0FFFFFF;
493 EncodedValue |= 0x09000000;
502unsigned ARMMCCodeEmitter::NEONThumb2DupPostEncoder(
const MCInst &
MI,
503 unsigned EncodedValue,
506 EncodedValue &= 0x00FFFFFF;
507 EncodedValue |= 0xEE000000;
515unsigned ARMMCCodeEmitter::NEONThumb2V8PostEncoder(
const MCInst &
MI,
516 unsigned EncodedValue,
519 EncodedValue |= 0xC000000;
527unsigned ARMMCCodeEmitter::
528VFPThumb2PostEncoder(
const MCInst &
MI,
unsigned EncodedValue,
531 EncodedValue &= 0x0FFFFFFF;
532 EncodedValue |= 0xE0000000;
539unsigned ARMMCCodeEmitter::
559 case ARM::Q0:
case ARM::Q1:
case ARM::Q2:
case ARM::Q3:
560 case ARM::Q4:
case ARM::Q5:
case ARM::Q6:
case ARM::Q7:
561 case ARM::Q8:
case ARM::Q9:
case ARM::Q10:
case ARM::Q11:
562 case ARM::Q12:
case ARM::Q13:
case ARM::Q14:
case ARM::Q15:
565 }
else if (MO.
isImm()) {
566 return static_cast<unsigned>(MO.
getImm());
578bool ARMMCCodeEmitter::
579EncodeAddrModeOpValues(
const MCInst &
MI,
unsigned OpIdx,
unsigned &Reg,
587 int32_t SImm = MO1.
getImm();
591 if (SImm == INT32_MIN) {
616 assert(MO.
isExpr() &&
"Unexpected branch target type!");
629 uint32_t S = (offset & 0x800000) >> 23;
630 uint32_t J1 = (offset & 0x400000) >> 22;
631 uint32_t J2 = (offset & 0x200000) >> 21;
646getThumbBLTargetOpValue(
const MCInst &
MI,
unsigned OpIdx,
659getThumbBLXTargetOpValue(
const MCInst &
MI,
unsigned OpIdx,
671getThumbBRTargetOpValue(
const MCInst &
MI,
unsigned OpIdx,
678 return (MO.
getImm() >> 1);
683getThumbBCCTargetOpValue(
const MCInst &
MI,
unsigned OpIdx,
690 return (MO.
getImm() >> 1);
695getThumbCBTargetOpValue(
const MCInst &
MI,
unsigned OpIdx,
701 return (MO.
getImm() >> 1);
706 int NumOp =
MI.getNumOperands();
708 for (
int i = 0; i < NumOp-1; ++i) {
724getBranchTargetOpValue(
const MCInst &
MI,
unsigned OpIdx,
732 return getARMBranchTargetOpValue(
MI, OpIdx, Fixups, STI);
738getARMBranchTargetOpValue(
const MCInst &
MI,
unsigned OpIdx,
744 return ::getBranchTargetOpValue(
MI, OpIdx,
746 return ::getBranchTargetOpValue(
MI, OpIdx,
754getARMBLTargetOpValue(
const MCInst &
MI,
unsigned OpIdx,
760 return ::getBranchTargetOpValue(
MI, OpIdx,
769getARMBLXTargetOpValue(
const MCInst &
MI,
unsigned OpIdx,
781uint32_t ARMMCCodeEmitter::getThumbBranchTargetOpValue(
792 bool I = (Val & 0x800000);
793 bool J1 = (Val & 0x400000);
794 bool J2 = (Val & 0x200000);
811getAdrLabelOpValue(
const MCInst &
MI,
unsigned OpIdx,
818 int64_t offset = MO.
getImm();
822 if (offset == INT32_MIN) {
825 }
else if (offset < 0) {
843 assert(SoImmVal != -1 &&
"Not a valid so_imm value!");
852getT2AdrLabelOpValue(
const MCInst &
MI,
unsigned OpIdx,
859 int32_t Val = MO.
getImm();
860 if (Val == INT32_MIN)
872getITMaskOpValue(
const MCInst &
MI,
unsigned OpIdx,
876 assert(MaskMO.
isImm() &&
"Unexpected operand type!");
884 assert(OpIdx > 0 &&
"IT mask appears first!");
886 assert(CondMO.
isImm() &&
"Unexpected operand type!");
887 if (CondMO.
getImm() & 1) {
889 unsigned BitsAboveLowBit = 0xF & (-LowBit << 1);
890 Mask ^= BitsAboveLowBit;
899getThumbAdrLabelOpValue(
const MCInst &
MI,
unsigned OpIdx,
912getThumbAddrModeRegRegOpValue(
const MCInst &
MI,
unsigned OpIdx,
922 return (Rm << 3) | Rn;
928ARMMCCodeEmitter::getMVEShiftImmOpValue(
const MCInst &
MI,
unsigned OpIdx,
939 unsigned Size, ShiftImm;
940 switch(
MI.getOpcode()) {
941 case ARM::MVE_VSHLL_imms16bh:
942 case ARM::MVE_VSHLL_imms16th:
943 case ARM::MVE_VSHLL_immu16bh:
944 case ARM::MVE_VSHLL_immu16th:
947 case ARM::MVE_VSHLL_imms8bh:
948 case ARM::MVE_VSHLL_imms8th:
949 case ARM::MVE_VSHLL_immu8bh:
950 case ARM::MVE_VSHLL_immu8th:
956 ShiftImm =
MI.getOperand(OpIdx).getImm();
957 return Size + ShiftImm;
962getAddrModeImm12OpValue(
const MCInst &
MI,
unsigned OpIdx,
968 unsigned Reg = 0, Imm12 = 0;
975 isAdd = EncodeAddrModeOpValues(
MI, OpIdx, Reg, Imm12, Fixups, STI);
976 }
else if (MO1.
isExpr()) {
978 "Thumb mode requires different encoding");
994 ++MCNumCPRelocations;
998 if (
Offset == INT32_MIN) {
1015template<
unsigned Bits,
unsigned Shift>
1017getT2ScaledImmOpValue(
const MCInst &
MI,
unsigned OpIdx,
1029 int32_t
Imm =
MI.getOperand(OpIdx).getImm();
1030 bool isAdd =
Imm >= 0;
1048getMveAddrModeRQOpValue(
const MCInst &
MI,
unsigned OpIdx,
1059 assert(Qm < 8 &&
"Qm is supposed to be encodable in 3 bits");
1061 return (Rn << 3) | Qm;
1068getMveAddrModeQOpValue(
const MCInst &
MI,
unsigned OpIdx,
1077 int32_t
Imm =
M1.getImm();
1079 bool isAdd =
Imm >= 0;
1091 assert(Qm < 8 &&
"Qm is supposed to be encodable in 3 bits");
1093 return (Qm << 8) |
Imm;
1099getT2AddrModeImm8s4OpValue(
const MCInst &
MI,
unsigned OpIdx,
1114 assert(MO.
isExpr() &&
"Unexpected machine operand type!");
1119 ++MCNumCPRelocations;
1121 isAdd = EncodeAddrModeOpValues(
MI, OpIdx, Reg, Imm8, Fixups, STI);
1129 assert(((Imm8 & 0x3) == 0) &&
"Not a valid immediate!");
1141ARMMCCodeEmitter::getT2AddrModeImm7s4OpValue(
const MCInst &
MI,
unsigned OpIdx,
1149 bool isAdd = EncodeAddrModeOpValues(
MI, OpIdx, Reg, Imm7, Fixups, STI);
1168getT2AddrModeImm0_1020s4OpValue(
const MCInst &
MI,
unsigned OpIdx,
1177 return (Reg << 8) |
Imm8;
1180uint32_t ARMMCCodeEmitter::getHiLoImmOpValue(
const MCInst &
MI,
unsigned OpIdx,
1188 return static_cast<unsigned>(MO.
getImm());
1195 const ARMMCExpr *ARM16Expr = cast<ARMMCExpr>(E);
1199 const int64_t
Value = MCE->getValue();
1200 if (
Value > UINT32_MAX)
1203 switch (ARM16Expr->
getKind()) {
1205 return (int32_t(
Value) & 0xffff0000) >> 16;
1207 return (int32_t(
Value) & 0x0000ffff);
1210 return (int32_t(
Value) & 0xff000000) >> 24;
1212 return (int32_t(
Value) & 0x00ff0000) >> 16;
1214 return (int32_t(
Value) & 0x0000ff00) >> 8;
1216 return (int32_t(
Value) & 0x000000ff);
1222 switch (ARM16Expr->
getKind()) {
1264 ":upper0_7:, lower8_15: or :lower0_7:");
1268getLdStSORegOpValue(
const MCInst &
MI,
unsigned OpIdx,
1279 unsigned SBits = getShiftOp(ShOp);
1283 assert((ShImm & ~0x1f) == 0 &&
"Out of range shift amount");
1302getAddrMode2OffsetOpValue(
const MCInst &
MI,
unsigned OpIdx,
1318 Binary |= getShiftOp(ShOp) << 5;
1325getPostIdxRegOpValue(
const MCInst &
MI,
unsigned OpIdx,
1332 bool isAdd = MO1.
getImm() != 0;
1337getAddrMode3OffsetOpValue(
const MCInst &
MI,
unsigned OpIdx,
1353 return Imm8 | (isAdd << 8) | (
isImm << 9);
1357getAddrMode3OpValue(
const MCInst &
MI,
unsigned OpIdx,
1373 assert(MO.
isExpr() &&
"Unexpected machine operand type!");
1378 ++MCNumCPRelocations;
1379 return (Rn << 9) | (1 << 13);
1389 return (Rn << 9) |
Imm8 | (isAdd << 8) | (
isImm << 13);
1394getAddrModeThumbSPOpValue(
const MCInst &
MI,
unsigned OpIdx,
1400 assert(
MI.getOperand(OpIdx).getReg() == ARM::SP &&
1401 "Unexpected base register!");
1405 return MO1.
getImm() & 0xff;
1410getAddrModeISOpValue(
const MCInst &
MI,
unsigned OpIdx,
1419 unsigned Imm5 = MO1.
getImm();
1420 return ((Imm5 & 0x1f) << 3) | Rn;
1425getAddrModePCOpValue(
const MCInst &
MI,
unsigned OpIdx,
1431 return (MO.
getImm() >> 2);
1436getAddrMode5OpValue(
const MCInst &
MI,
unsigned OpIdx,
1451 assert(MO.
isExpr() &&
"Unexpected machine operand type!");
1460 ++MCNumCPRelocations;
1462 EncodeAddrModeOpValues(
MI, OpIdx, Reg, Imm8, Fixups, STI);
1476getAddrMode5FP16OpValue(
const MCInst &
MI,
unsigned OpIdx,
1491 assert(MO.
isExpr() &&
"Unexpected machine operand type!");
1500 ++MCNumCPRelocations;
1502 EncodeAddrModeOpValues(
MI, OpIdx, Reg, Imm8, Fixups, STI);
1514unsigned ARMMCCodeEmitter::
1515getSORegRegOpValue(
const MCInst &
MI,
unsigned OpIdx,
1562unsigned ARMMCCodeEmitter::
1563getSORegImmOpValue(
const MCInst &
MI,
unsigned OpIdx,
1604 assert(
Offset < 32 &&
"Offset must be in range 0-31!");
1609unsigned ARMMCCodeEmitter::
1610getT2AddrModeSORegOpValue(
const MCInst &
MI,
unsigned OpNum,
1628template<
unsigned Bits,
unsigned Shift>
1629unsigned ARMMCCodeEmitter::
1630getT2AddrModeImmOpValue(
const MCInst &
MI,
unsigned OpNum,
1642 int32_t tmp = (int32_t)MO2.
getImm();
1643 if (tmp == INT32_MIN) {
1645 }
else if (tmp < 0) {
1650 Value |= (tmp >> Shift) & ((1U << Bits) - 1);
1654unsigned ARMMCCodeEmitter::
1655getT2AddrModeImm8OffsetOpValue(
const MCInst &
MI,
unsigned OpNum,
1663 if (
static_cast<int32_t
>(tmp) < 0)
1671unsigned ARMMCCodeEmitter::
1672getT2SORegOpValue(
const MCInst &
MI,
unsigned OpIdx,
1714unsigned ARMMCCodeEmitter::
1715getBitfieldInvertedMaskOpValue(
const MCInst &
MI,
unsigned Op,
1724 assert(v != 0 && lsb < 32 && msb < 32 &&
"Illegal bitfield mask!");
1725 return lsb | (msb << 5);
1728unsigned ARMMCCodeEmitter::
1729getRegisterListOpValue(
const MCInst &
MI,
unsigned Op,
1739 bool SPRRegs = ARMMCRegisterClasses[ARM::SPRRegClassID].contains(Reg);
1740 bool DPRRegs = ARMMCRegisterClasses[ARM::DPRRegClassID].contains(Reg);
1744 if (SPRRegs || DPRRegs || Reg == ARM::VPR) {
1747 unsigned NumRegs = (
MI.getNumOperands() -
Op) & 0xff;
1748 Binary |= (RegNo & 0x1f) << 8;
1750 if (
MI.getOpcode() == ARM::VSCCLRMD)
1753 else if (
MI.getOpcode() == ARM::VSCCLRMS) {
1758 for (
unsigned I =
Op, E =
MI.getNumOperands();
I < E; ++
I) {
1759 Reg =
MI.getOperand(
I).getReg();
1760 if (ARMMCRegisterClasses[ARM::SPRRegClassID].
contains(Reg))
1762 else if (ARMMCRegisterClasses[ARM::DPRRegClassID].
contains(Reg))
1774 return MRI.getEncodingValue(
LHS.getReg()) <
1775 MRI.getEncodingValue(
RHS.getReg());
1777 for (
unsigned I =
Op, E =
MI.getNumOperands();
I < E; ++
I) {
1778 unsigned RegNo =
MRI.getEncodingValue(
MI.getOperand(
I).getReg());
1788unsigned ARMMCCodeEmitter::
1789getAddrMode6AddressOpValue(
const MCInst &
MI,
unsigned Op,
1798 switch (
Imm.getImm()) {
1802 case 8:
Align = 0x01;
break;
1803 case 16:
Align = 0x02;
break;
1804 case 32:
Align = 0x03;
break;
1807 return RegNo | (
Align << 4);
1812unsigned ARMMCCodeEmitter::
1813getAddrMode6OneLane32AddressOpValue(
const MCInst &
MI,
unsigned Op,
1822 switch (
Imm.getImm()) {
1827 case 2:
Align = 0x00;
break;
1828 case 4:
Align = 0x03;
break;
1831 return RegNo | (
Align << 4);
1839unsigned ARMMCCodeEmitter::
1840getAddrMode6DupAddressOpValue(
const MCInst &
MI,
unsigned Op,
1849 switch (
Imm.getImm()) {
1853 case 8:
Align = 0x01;
break;
1854 case 16:
Align = 0x03;
break;
1857 return RegNo | (
Align << 4);
1860unsigned ARMMCCodeEmitter::
1861getAddrMode6OffsetOpValue(
const MCInst &
MI,
unsigned Op,
1870unsigned ARMMCCodeEmitter::
1871getShiftRight8Imm(
const MCInst &
MI,
unsigned Op,
1874 return 8 -
MI.getOperand(
Op).getImm();
1877unsigned ARMMCCodeEmitter::
1878getShiftRight16Imm(
const MCInst &
MI,
unsigned Op,
1881 return 16 -
MI.getOperand(
Op).getImm();
1884unsigned ARMMCCodeEmitter::
1885getShiftRight32Imm(
const MCInst &
MI,
unsigned Op,
1888 return 32 -
MI.getOperand(
Op).getImm();
1891unsigned ARMMCCodeEmitter::
1892getShiftRight64Imm(
const MCInst &
MI,
unsigned Op,
1895 return 64 -
MI.getOperand(
Op).getImm();
1898void ARMMCCodeEmitter::encodeInstruction(
const MCInst &
MI,
1909 if (
Desc.getSize() == 2 ||
Desc.getSize() == 4)
1918 support::endian::write<uint16_t>(CB, Binary, Endian);
1922 support::endian::write<uint16_t>(CB, Binary >> 16, Endian);
1923 support::endian::write<uint16_t>(CB, Binary & 0xffff, Endian);
1925 support::endian::write<uint32_t>(CB, Binary, Endian);
1930template <
bool isNeg, ARM::Fixups fixup>
1932ARMMCCodeEmitter::getBFTargetOpValue(
const MCInst &
MI,
unsigned OpIdx,
1937 return ::getBranchTargetOpValue(
MI, OpIdx, fixup, Fixups, STI);
1942ARMMCCodeEmitter::getBFAfterTargetOpValue(
const MCInst &
MI,
unsigned OpIdx,
1959 assert(Diff == 4 || Diff == 2);
1964uint32_t ARMMCCodeEmitter::getVPTMaskOpValue(
const MCInst &
MI,
unsigned OpIdx,
1975 unsigned PrevBit = 0;
1976 for (
int i = 3; i >= 0; --i) {
1980 if ((
Value & ~(~0U << i)) == 0) {
1995uint32_t ARMMCCodeEmitter::getRestrictedCondCodeOpValue(
2004 assert(0 &&
"Unexpected Condition!");
2024getPowerTwoOpValue(
const MCInst &
MI,
unsigned OpIdx,
2032template <
unsigned start>
2034getMVEPairVectorIndexOpValue(
const MCInst &
MI,
unsigned OpIdx,
2041 return Value - start;
2044#include "ARMGenMCCodeEmitter.inc"
2048 return new ARMMCCodeEmitter(MCII, Ctx,
true);
2053 return new ARMMCCodeEmitter(MCII, Ctx,
false);
unsigned const MachineRegisterInfo * MRI
This file declares a class to represent arbitrary precision floating point values and provide a varie...
This file implements a class to represent arbitrary precision integral constant values and operations...
static bool isThumb(const MCSubtargetInfo &STI)
static bool HasConditionalBranch(const MCInst &MI)
Return true if this branch has a non-always predication.
static int32_t encodeThumbBLOffset(int32_t offset)
static uint32_t getBranchTargetOpValue(const MCInst &MI, unsigned OpIdx, unsigned FixupKind, SmallVectorImpl< MCFixup > &Fixups, const MCSubtargetInfo &STI)
getBranchTargetOpValue - Helper function to get the branch target operand, which is either an immedia...
static bool isNeg(Value *V)
Returns true if the operation is a negation of V, and it works for both integers and floats.
static bool isReg(const MCInst &MI, unsigned OpNo)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static bool isImm(const MachineOperand &MO, MachineRegisterInfo *MRI)
static bool contains(SmallPtrSetImpl< ConstantExpr * > &Cache, ConstantExpr *Expr, Constant *C)
This file defines the SmallVector class.
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
#define STATISTIC(VARNAME, DESC)
APInt bitcastToAPInt() const
APInt getHiBits(unsigned numBits) const
Compute an APInt containing numBits highbits from this APInt.
uint64_t getLimitedValue(uint64_t Limit=UINT64_MAX) const
If this value is smaller than the specified limit, return it, otherwise return the limit value.
VariantKind getKind() const
getOpcode - Get the kind of this expression.
const MCExpr * getSubExpr() const
getSubExpr - Get the child of this expression.
This class represents an Operation in the Expression.
static const MCBinaryExpr * createSub(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
MCCodeEmitter - Generic instruction encoding interface.
virtual void encodeInstruction(const MCInst &Inst, SmallVectorImpl< char > &CB, SmallVectorImpl< MCFixup > &Fixups, const MCSubtargetInfo &STI) const =0
Encode the given Inst to bytes and append to CB.
MCCodeEmitter & operator=(const MCCodeEmitter &)=delete
Context object for machine code objects.
const MCRegisterInfo * getRegisterInfo() const
Base class for the full range of assembler expressions which are needed for parsing.
@ Target
Target specific expression.
static MCFixup create(uint32_t Offset, const MCExpr *Value, MCFixupKind Kind, SMLoc Loc=SMLoc())
Instances of this class represent a single low-level machine instruction.
Describe properties that are true of each instruction in the target description file.
Interface to description of machine instruction set.
const MCInstrDesc & get(unsigned Opcode) const
Return the machine instruction descriptor that corresponds to the specified instruction opcode.
Instances of this class represent operands of the MCInst class.
MCRegister getReg() const
Returns the register number.
const MCExpr * getExpr() const
uint64_t getDFPImm() const
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
uint16_t getEncodingValue(MCRegister Reg) const
Returns the encoding for Reg.
Wrapper class representing physical registers. Should be passed by value.
constexpr bool isValid() const
Generic base class for all target subtargets.
bool hasFeature(unsigned Feature) const
const Triple & getTargetTriple() const
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Triple - Helper class for working with autoconf configuration names.
LLVM Value Representation.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
unsigned char getAM3Offset(unsigned AM3Opc)
unsigned getSORegOffset(unsigned Op)
int getSOImmVal(unsigned Arg)
getSOImmVal - Given a 32-bit immediate, if it is something that can fit into an shifter_operand immed...
ShiftOpc getAM2ShiftOpc(unsigned AM2Opc)
unsigned getAM2Offset(unsigned AM2Opc)
int getT2SOImmVal(unsigned Arg)
getT2SOImmVal - Given a 32-bit immediate, if it is something that can fit into a Thumb-2 shifter_oper...
ShiftOpc getSORegShOp(unsigned Op)
AddrOpc getAM5Op(unsigned AM5Opc)
unsigned char getAM5Offset(unsigned AM5Opc)
AddrOpc getAM2Op(unsigned AM2Opc)
AddrOpc getAM3Op(unsigned AM3Opc)
@ fixup_thumb_adr_pcrel_10
@ fixup_arm_thumb_upper_8_15
@ fixup_arm_thumb_lower_0_7
@ fixup_arm_pcrel_10_unscaled
@ fixup_arm_thumb_upper_0_7
@ fixup_bfcsel_else_target
@ fixup_arm_ldst_pcrel_12
@ fixup_arm_thumb_lower_8_15
constexpr std::underlying_type_t< E > Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
Reg
All possible values of the reg field in the ModR/M byte.
This is an optimization pass for GlobalISel generic memory operations.
auto drop_begin(T &&RangeOrContainer, size_t N=1)
Return a range covering RangeOrContainer with the first N elements excluded.
APFloat abs(APFloat X)
Returns the absolute value of the argument.
MCCodeEmitter * createARMLEMCCodeEmitter(const MCInstrInfo &MCII, MCContext &Ctx)
int countr_zero(T Val)
Count number of 0's from the least significant bit to the most stopping at the first 1.
unsigned M1(unsigned Val)
unsigned Log2_32(uint32_t Value)
Return the floor log base 2 of the specified value, -1 if the value is zero.
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
MCFixupKind
Extensible enumeration to represent the type of a fixup.
bool is_sorted(R &&Range, Compare C)
Wrapper function around std::is_sorted to check if elements in a range R are sorted with respect to a...
DWARFExpression::Operation Op
unsigned M0(unsigned Val)
MCCodeEmitter * createARMBEMCCodeEmitter(const MCInstrInfo &MCII, MCContext &Ctx)
This struct is a compact representation of a valid (non-zero power of two) alignment.
Description of the encoding of one expression Op.