43 #define DEBUG_TYPE "mccodeemitter" 45 STATISTIC(MCNumEmitted,
"Number of MC instructions emitted.");
46 STATISTIC(MCNumCPRelocations,
"Number of constant pool relocations created.");
57 : MCII(mcii), CTX(ctx), IsLittleEndian(IsLittle) {
59 ARMMCCodeEmitter(
const ARMMCCodeEmitter &) =
delete;
60 ARMMCCodeEmitter &operator=(
const ARMMCCodeEmitter &) =
delete;
61 ~ARMMCCodeEmitter()
override =
default;
76 unsigned getMachineSoImmOpValue(
unsigned SoImm)
const;
80 uint64_t getBinaryCodeForInstr(
const MCInst &
MI,
97 bool EncodeAddrModeOpValues(
const MCInst &
MI,
unsigned OpIdx,
98 unsigned &
Reg,
unsigned &Imm,
206 template<
unsigned Bits,
unsigned Shift>
260 uint32_t getAddrMode2OffsetOpValue(
const MCInst &MI,
unsigned OpIdx,
270 uint32_t getAddrMode3OffsetOpValue(
const MCInst &MI,
unsigned OpIdx,
281 uint32_t getAddrModeThumbSPOpValue(
const MCInst &MI,
unsigned OpIdx,
301 uint32_t getAddrMode5FP16OpValue(
const MCInst &MI,
unsigned OpIdx,
306 unsigned getCCOutOpValue(
const MCInst &MI,
unsigned Op,
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,
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,
416 template <u
int8_t shift,
bool invert>
417 unsigned getExpandedImmOpValue(
const MCInst &MI,
unsigned Op,
420 static_assert(shift <= 32,
"Shift count must be less than or equal to 32.");
422 return (invert ? (MO.
getImm() ^ 0xff) : MO.
getImm()) >> shift;
425 unsigned NEONThumb2DataIPostEncoder(
const MCInst &MI,
426 unsigned EncodedValue,
428 unsigned NEONThumb2LoadStorePostEncoder(
const MCInst &MI,
429 unsigned EncodedValue,
431 unsigned NEONThumb2DupPostEncoder(
const MCInst &MI,
432 unsigned EncodedValue,
434 unsigned NEONThumb2V8PostEncoder(
const MCInst &MI,
435 unsigned EncodedValue,
438 unsigned VFPThumb2PostEncoder(
const MCInst &MI,
439 unsigned EncodedValue,
450 void EmitConstant(uint64_t Val,
unsigned Size,
raw_ostream &OS)
const {
452 for (
unsigned i = 0; i !=
Size; ++i) {
453 unsigned Shift = IsLittleEndian ? i * 8 : (Size - 1 - i) * 8;
454 EmitByte((Val >> Shift) & 0xff, OS);
462 template <
bool isNeg, ARM::Fixups fixup>
467 uint32_t getBFAfterTargetOpValue(
const MCInst &MI,
unsigned OpIdx,
474 uint32_t getRestrictedCondCodeOpValue(
const MCInst &MI,
unsigned OpIdx,
477 template <
unsigned size>
478 uint32_t getMVEPairVectorIndexOpValue(
const MCInst &MI,
unsigned OpIdx,
488 unsigned ARMMCCodeEmitter::NEONThumb2DataIPostEncoder(
const MCInst &MI,
489 unsigned EncodedValue,
495 unsigned Bit24 = EncodedValue & 0x01000000;
496 unsigned Bit28 = Bit24 << 4;
497 EncodedValue &= 0xEFFFFFFF;
498 EncodedValue |= Bit28;
499 EncodedValue |= 0x0F000000;
508 unsigned ARMMCCodeEmitter::NEONThumb2LoadStorePostEncoder(
const MCInst &MI,
509 unsigned EncodedValue,
512 EncodedValue &= 0xF0FFFFFF;
513 EncodedValue |= 0x09000000;
522 unsigned ARMMCCodeEmitter::NEONThumb2DupPostEncoder(
const MCInst &MI,
523 unsigned EncodedValue,
526 EncodedValue &= 0x00FFFFFF;
527 EncodedValue |= 0xEE000000;
535 unsigned ARMMCCodeEmitter::NEONThumb2V8PostEncoder(
const MCInst &MI,
536 unsigned EncodedValue,
539 EncodedValue |= 0xC000000;
547 unsigned ARMMCCodeEmitter::
548 VFPThumb2PostEncoder(
const MCInst &MI,
unsigned EncodedValue,
551 EncodedValue &= 0x0FFFFFFF;
552 EncodedValue |= 0xE0000000;
559 unsigned ARMMCCodeEmitter::
579 case ARM::Q0:
case ARM::Q1:
case ARM::Q2:
case ARM::Q3:
580 case ARM::Q4:
case ARM::Q5:
case ARM::Q6:
case ARM::Q7:
581 case ARM::Q8:
case ARM::Q9:
case ARM::Q10:
case ARM::Q11:
582 case ARM::Q12:
case ARM::Q13:
case ARM::Q14:
case ARM::Q15:
585 }
else if (MO.
isImm()) {
586 return static_cast<unsigned>(MO.
getImm());
589 .bitcastToAPInt().getHiBits(32).getLimitedValue());
596 bool ARMMCCodeEmitter::
597 EncodeAddrModeOpValues(
const MCInst &MI,
unsigned OpIdx,
unsigned &Reg,
605 int32_t SImm = MO1.
getImm();
609 if (SImm == INT32_MIN) {
634 assert(MO.
isExpr() &&
"Unexpected branch target type!");
647 uint32_t S = (offset & 0x800000) >> 23;
648 uint32_t J1 = (offset & 0x400000) >> 22;
649 uint32_t J2 = (offset & 0x200000) >> 21;
664 getThumbBLTargetOpValue(
const MCInst &MI,
unsigned OpIdx,
677 getThumbBLXTargetOpValue(
const MCInst &MI,
unsigned OpIdx,
689 getThumbBRTargetOpValue(
const MCInst &MI,
unsigned OpIdx,
696 return (MO.
getImm() >> 1);
701 getThumbBCCTargetOpValue(
const MCInst &MI,
unsigned OpIdx,
708 return (MO.
getImm() >> 1);
713 getThumbCBTargetOpValue(
const MCInst &MI,
unsigned OpIdx,
719 return (MO.
getImm() >> 1);
726 for (
int i = 0; i < NumOp-1; ++i) {
750 return getARMBranchTargetOpValue(MI, OpIdx, Fixups, STI);
756 getARMBranchTargetOpValue(
const MCInst &MI,
unsigned OpIdx,
772 getARMBLTargetOpValue(
const MCInst &MI,
unsigned OpIdx,
787 getARMBLXTargetOpValue(
const MCInst &MI,
unsigned OpIdx,
799 uint32_t ARMMCCodeEmitter::getThumbBranchTargetOpValue(
810 bool I = (Val & 0x800000);
811 bool J1 = (Val & 0x400000);
812 bool J2 = (Val & 0x200000);
829 getAdrLabelOpValue(
const MCInst &MI,
unsigned OpIdx,
836 int64_t offset = MO.
getImm();
840 if (offset == INT32_MIN) {
843 }
else if (offset < 0) {
861 assert(SoImmVal != -1 &&
"Not a valid so_imm value!");
870 getT2AdrLabelOpValue(
const MCInst &MI,
unsigned OpIdx,
877 int32_t Val = MO.
getImm();
878 if (Val == INT32_MIN)
890 getITMaskOpValue(
const MCInst &MI,
unsigned OpIdx,
894 assert(MaskMO.
isImm() &&
"Unexpected operand type!");
902 assert(OpIdx > 0 &&
"IT mask appears first!");
904 assert(CondMO.
isImm() &&
"Unexpected operand type!");
905 if (CondMO.
getImm() & 1) {
906 unsigned LowBit = Mask & -
Mask;
907 unsigned BitsAboveLowBit = 0xF & (-LowBit << 1);
908 Mask ^= BitsAboveLowBit;
917 getThumbAdrLabelOpValue(
const MCInst &MI,
unsigned OpIdx,
930 getThumbAddrModeRegRegOpValue(
const MCInst &MI,
unsigned OpIdx,
940 return (Rm << 3) | Rn;
946 ARMMCCodeEmitter::getMVEShiftImmOpValue(
const MCInst &MI,
unsigned OpIdx,
957 unsigned Size, ShiftImm;
959 case ARM::MVE_VSHLL_imms16bh:
960 case ARM::MVE_VSHLL_imms16th:
961 case ARM::MVE_VSHLL_immu16bh:
962 case ARM::MVE_VSHLL_immu16th:
965 case ARM::MVE_VSHLL_imms8bh:
966 case ARM::MVE_VSHLL_imms8th:
967 case ARM::MVE_VSHLL_immu8bh:
968 case ARM::MVE_VSHLL_immu8th:
975 return Size + ShiftImm;
980 getAddrModeImm12OpValue(
const MCInst &MI,
unsigned OpIdx,
1005 ++MCNumCPRelocations;
1009 if (Offset == INT32_MIN) {
1012 }
else if (Offset < 0) {
1019 isAdd = EncodeAddrModeOpValues(MI, OpIdx, Reg, Imm12, Fixups, STI);
1024 Binary |= (1 << 12);
1025 Binary |= (Reg << 13);
1029 template<
unsigned Bits,
unsigned Shift>
1031 getT2ScaledImmOpValue(
const MCInst &MI,
unsigned OpIdx,
1044 bool isAdd = Imm >= 0;
1055 Binary |= (1U <<
Bits);
1062 getMveAddrModeRQOpValue(
const MCInst &MI,
unsigned OpIdx,
1073 assert(Qm < 8 &&
"Qm is supposed to be encodable in 3 bits");
1075 return (Rn << 3) | Qm;
1082 getMveAddrModeQOpValue(
const MCInst &MI,
unsigned OpIdx,
1091 int32_t Imm = M1.
getImm();
1093 bool isAdd = Imm >= 0;
1105 assert(Qm < 8 &&
"Qm is supposed to be encodable in 3 bits");
1107 return (Qm << 8) | Imm;
1113 getT2AddrModeImm8s4OpValue(
const MCInst &MI,
unsigned OpIdx,
1128 assert(MO.
isExpr() &&
"Unexpected machine operand type!");
1133 ++MCNumCPRelocations;
1135 isAdd = EncodeAddrModeOpValues(MI, OpIdx, Reg, Imm8, Fixups, STI);
1143 uint32_t Binary = (Imm8 >> 2) & 0xff;
1147 Binary |= (Reg << 9);
1154 ARMMCCodeEmitter::getT2AddrModeImm7s4OpValue(
const MCInst &MI,
unsigned OpIdx,
1162 bool isAdd = EncodeAddrModeOpValues(MI, OpIdx, Reg, Imm7, Fixups, STI);
1170 uint32_t Binary = (Imm7 >> 2) & 0xff;
1174 Binary |= (Reg << 8);
1181 getT2AddrModeImm0_1020s4OpValue(
const MCInst &MI,
unsigned OpIdx,
1190 return (Reg << 8) |
Imm8;
1194 ARMMCCodeEmitter::getHiLo16ImmOpValue(
const MCInst &MI,
unsigned OpIdx,
1202 return static_cast<unsigned>(MO.
getImm());
1208 const ARMMCExpr *ARM16Expr = cast<ARMMCExpr>(
E);
1212 const int64_t
Value = MCE->getValue();
1213 if (Value > UINT32_MAX)
1216 switch (ARM16Expr->
getKind()) {
1218 return (int32_t(Value) & 0xffff0000) >> 16;
1220 return (int32_t(Value) & 0x0000ffff);
1225 switch (ARM16Expr->
getKind()) {
1250 getLdStSORegOpValue(
const MCInst &MI,
unsigned OpIdx,
1261 unsigned SBits = getShiftOp(ShOp);
1265 assert((ShImm & ~0x1f) == 0 &&
"Out of range shift amount");
1276 Binary |= SBits << 5;
1277 Binary |= ShImm << 7;
1284 getAddrMode2OffsetOpValue(
const MCInst &MI,
unsigned OpIdx,
1292 unsigned Imm = MO1.
getImm();
1300 Binary |= getShiftOp(ShOp) << 5;
1303 return Binary | (isAdd << 12) | (isReg << 13);
1307 getPostIdxRegOpValue(
const MCInst &MI,
unsigned OpIdx,
1314 bool isAdd = MO1.
getImm() != 0;
1319 getAddrMode3OffsetOpValue(
const MCInst &MI,
unsigned OpIdx,
1328 unsigned Imm = MO1.
getImm();
1330 bool isImm = MO.
getReg() == 0;
1335 return Imm8 | (isAdd << 8) | (isImm << 9);
1339 getAddrMode3OpValue(
const MCInst &MI,
unsigned OpIdx,
1355 assert(MO.
isExpr() &&
"Unexpected machine operand type!");
1360 ++MCNumCPRelocations;
1361 return (Rn << 9) | (1 << 13);
1364 unsigned Imm = MO2.
getImm();
1366 bool isImm = MO1.
getReg() == 0;
1371 return (Rn << 9) | Imm8 | (isAdd << 8) | (isImm << 13);
1376 getAddrModeThumbSPOpValue(
const MCInst &MI,
unsigned OpIdx,
1383 "Unexpected base register!");
1387 return MO1.
getImm() & 0xff;
1392 getAddrModeISOpValue(
const MCInst &MI,
unsigned OpIdx,
1401 unsigned Imm5 = MO1.
getImm();
1402 return ((Imm5 & 0x1f) << 3) | Rn;
1407 getAddrModePCOpValue(
const MCInst &MI,
unsigned OpIdx,
1413 return (MO.
getImm() >> 2);
1418 getAddrMode5OpValue(
const MCInst &MI,
unsigned OpIdx,
1433 assert(MO.
isExpr() &&
"Unexpected machine operand type!");
1442 ++MCNumCPRelocations;
1444 EncodeAddrModeOpValues(MI, OpIdx, Reg, Imm8, Fixups, STI);
1452 Binary |= (Reg << 9);
1458 getAddrMode5FP16OpValue(
const MCInst &MI,
unsigned OpIdx,
1473 assert(MO.
isExpr() &&
"Unexpected machine operand type!");
1482 ++MCNumCPRelocations;
1484 EncodeAddrModeOpValues(MI, OpIdx, Reg, Imm8, Fixups, STI);
1492 Binary |= (Reg << 9);
1496 unsigned ARMMCCodeEmitter::
1497 getSORegRegOpValue(
const MCInst &MI,
unsigned OpIdx,
1520 unsigned Rs = MO1.
getReg();
1536 Binary |= SBits << 4;
1544 unsigned ARMMCCodeEmitter::
1545 getSORegImmOpValue(
const MCInst &MI,
unsigned OpIdx,
1584 Binary |= SBits << 4;
1586 assert(Offset < 32 &&
"Offset must be in range 0-31!");
1587 return Binary | (Offset << 7);
1591 unsigned ARMMCCodeEmitter::
1592 getT2AddrModeSORegOpValue(
const MCInst &MI,
unsigned OpNum,
1610 template<
unsigned Bits,
unsigned Shift>
1611 unsigned ARMMCCodeEmitter::
1612 getT2AddrModeImmOpValue(
const MCInst &MI,
unsigned OpNum,
1623 Value <<= (
Bits + 1);
1624 int32_t tmp = (int32_t)MO2.
getImm();
1625 if (tmp == INT32_MIN) {
1627 }
else if (tmp < 0) {
1630 Value |= (1U <<
Bits);
1632 Value |= (tmp >> Shift) & ((1U <<
Bits) - 1);
1636 unsigned ARMMCCodeEmitter::
1637 getT2AddrModeImm8OffsetOpValue(
const MCInst &MI,
unsigned OpNum,
1644 int32_t tmp = (int32_t)MO1.
getImm();
1653 unsigned ARMMCCodeEmitter::
1654 getT2SORegOpValue(
const MCInst &MI,
unsigned OpIdx,
1688 Binary |= SBits << 4;
1696 unsigned ARMMCCodeEmitter::
1697 getBitfieldInvertedMaskOpValue(
const MCInst &MI,
unsigned Op,
1706 assert(v != 0 && lsb < 32 && msb < 32 &&
"Illegal bitfield mask!");
1707 return lsb | (msb << 5);
1710 unsigned ARMMCCodeEmitter::
1711 getRegisterListOpValue(
const MCInst &MI,
unsigned Op,
1721 bool SPRRegs = ARMMCRegisterClasses[ARM::SPRRegClassID].contains(Reg);
1722 bool DPRRegs = ARMMCRegisterClasses[ARM::DPRRegClassID].contains(Reg);
1724 unsigned Binary = 0;
1726 if (SPRRegs || DPRRegs) {
1730 Binary |= (RegNo & 0x1f) << 8;
1738 Binary |= NumRegs * 2;
1748 Binary |= 1 << RegNo;
1757 unsigned ARMMCCodeEmitter::
1758 getAddrMode6AddressOpValue(
const MCInst &MI,
unsigned Op,
1771 case 8: Align = 0x01;
break;
1772 case 16: Align = 0x02;
break;
1773 case 32: Align = 0x03;
break;
1776 return RegNo | (Align << 4);
1781 unsigned ARMMCCodeEmitter::
1782 getAddrMode6OneLane32AddressOpValue(
const MCInst &MI,
unsigned Op,
1796 case 2: Align = 0x00;
break;
1797 case 4: Align = 0x03;
break;
1800 return RegNo | (Align << 4);
1808 unsigned ARMMCCodeEmitter::
1809 getAddrMode6DupAddressOpValue(
const MCInst &MI,
unsigned Op,
1822 case 8: Align = 0x01;
break;
1823 case 16: Align = 0x03;
break;
1826 return RegNo | (Align << 4);
1829 unsigned ARMMCCodeEmitter::
1830 getAddrMode6OffsetOpValue(
const MCInst &MI,
unsigned Op,
1834 if (MO.
getReg() == 0)
return 0x0D;
1838 unsigned ARMMCCodeEmitter::
1839 getShiftRight8Imm(
const MCInst &MI,
unsigned Op,
1845 unsigned ARMMCCodeEmitter::
1846 getShiftRight16Imm(
const MCInst &MI,
unsigned Op,
1852 unsigned ARMMCCodeEmitter::
1853 getShiftRight32Imm(
const MCInst &MI,
unsigned Op,
1859 unsigned ARMMCCodeEmitter::
1860 getShiftRight64Imm(
const MCInst &MI,
unsigned Op,
1866 void ARMMCCodeEmitter::
1872 uint64_t TSFlags = Desc.
TSFlags;
1882 uint32_t Binary = getBinaryCodeForInstr(MI, Fixups, STI);
1885 if (
isThumb(STI) && Size == 4) {
1886 EmitConstant(Binary >> 16, 2, OS);
1887 EmitConstant(Binary & 0xffff, 2, OS);
1889 EmitConstant(Binary, Size, OS);
1893 template <
bool isNeg, ARM::Fixups fixup>
1895 ARMMCCodeEmitter::getBFTargetOpValue(
const MCInst &MI,
unsigned OpIdx,
1901 return isNeg ? -(MO.
getImm() >> 1) : (MO.
getImm() >> 1);
1905 ARMMCCodeEmitter::getBFAfterTargetOpValue(
const MCInst &MI,
unsigned OpIdx,
1922 assert(Diff == 4 || Diff == 2);
1927 uint32_t ARMMCCodeEmitter::getVPTMaskOpValue(
const MCInst &MI,
unsigned OpIdx,
1938 unsigned PrevBit = 0;
1939 for (
int i = 3; i >= 0; --i) {
1940 unsigned Bit = (Value >> i) & 1;
1943 if ((Value & ~(~0U << i)) == 0) {
1958 uint32_t ARMMCCodeEmitter::getRestrictedCondCodeOpValue(
1967 assert(0 &&
"Unexpected Condition!");
1987 getPowerTwoOpValue(
const MCInst &MI,
unsigned OpIdx,
1995 template <
unsigned start>
1997 getMVEPairVectorIndexOpValue(
const MCInst &MI,
unsigned OpIdx,
2004 return Value - start;
2007 #include "ARMGenMCCodeEmitter.inc" 2012 return new ARMMCCodeEmitter(MCII, Ctx,
true);
2018 return new ARMMCCodeEmitter(MCII, Ctx,
false);
static bool isReg(const MCInst &MI, unsigned OpNo)
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
This class represents lattice values for constants.
VariantKind getKind() const
getOpcode - Get the kind of this expression.
void push_back(const T &Elt)
Describe properties that are true of each instruction in the target description file.
STATISTIC(NumFunctions, "Total number of functions")
static Lanai::Fixups FixupKind(const MCExpr *Expr)
static bool isThumb(const MCSubtargetInfo &STI)
const Triple & getTargetTriple() const
unsigned countTrailingZeros(T Val, ZeroBehavior ZB=ZB_Width)
Count number of 0's from the least significant bit to the most stopping at the first 1...
ShiftOpc getAM2ShiftOpc(unsigned AM2Opc)
const FeatureBitset & getFeatureBits() const
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Base class for the full range of assembler expressions which are needed for parsing.
This file implements a class to represent arbitrary precision integral constant values and operations...
unsigned getReg() const
Returns the register number.
Context object for machine code objects.
static const MCBinaryExpr * createSub(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
unsigned char getAM3Offset(unsigned AM3Opc)
const MCExpr * getExpr() const
Instances of this class represent a single low-level machine instruction.
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
AddrOpc getAM2Op(unsigned AM2Opc)
unsigned char getAM5Offset(unsigned AM5Opc)
AddrOpc getAM3Op(unsigned AM3Opc)
unsigned const MachineRegisterInfo * MRI
unsigned getSORegOffset(unsigned Op)
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
MCCodeEmitter - Generic instruction encoding interface.
Interface to description of machine instruction set.
MCFixupKind
Extensible enumeration to represent the type of a fixup.
This file declares a class to represent arbitrary precision floating point values and provide a varie...
int getT2SOImmVal(unsigned Arg)
getT2SOImmVal - Given a 32-bit immediate, if it is something that can fit into a Thumb-2 shifter_oper...
unsigned getNumOperands() const
uint16_t getEncodingValue(MCRegister RegNo) const
Returns the encoding for RegNo.
bool isOSBinFormatMachO() const
Tests whether the environment is MachO.
static MCFixup create(uint32_t Offset, const MCExpr *Value, MCFixupKind Kind, SMLoc Loc=SMLoc())
unsigned countLeadingZeros(T Val, ZeroBehavior ZB=ZB_Width)
Count number of 0's from the most significant bit to the least stopping at the first 1...
static int32_t encodeThumbBLOffset(int32_t offset)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This struct is a compact representation of a valid (non-zero power of two) alignment.
Triple - Helper class for working with autoconf configuration names.
static bool HasConditionalBranch(const MCInst &MI)
Return true if this branch has a non-always predication.
int getSOImmVal(unsigned Arg)
getSOImmVal - Given a 32-bit immediate, if it is something that can fit into an shifter_operand immed...
void fixup(unsigned Size, const MCFixup &Fixup, uint64_t &Value, MCContext *Ctx=nullptr)
Adjusts a value to fix up the immediate of an LDI Rd, K instruction.
const MCOperand & getOperand(unsigned i) const
unsigned getAM2Offset(unsigned AM2Opc)
ShiftOpc getSORegShOp(unsigned Op)
MCCodeEmitter * createARMLEMCCodeEmitter(const MCInstrInfo &MCII, const MCRegisterInfo &MRI, MCContext &Ctx)
const MCExpr * getSubExpr() const
getSubExpr - Get the child of this expression.
const MCInstrDesc & get(unsigned Opcode) const
Return the machine instruction descriptor that corresponds to the specified instruction opcode...
APFloat abs(APFloat X)
Returns the absolute value of the argument.
Generic base class for all target subtargets.
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...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
const MCRegisterInfo * getRegisterInfo() const
LLVM Value Representation.
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
std::underlying_type< E >::type Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
This class implements an extremely fast bulk output stream that can only output to a stream...
Target specific expression.
AddrOpc getAM5Op(unsigned AM5Opc)
unsigned getOpcode() const
Instances of this class represent operands of the MCInst class.
MCCodeEmitter * createARMBEMCCodeEmitter(const MCInstrInfo &MCII, const MCRegisterInfo &MRI, MCContext &Ctx)
Function Alias Analysis false
unsigned getSize() const
Return the number of bytes in the encoding of this instruction, or zero if the encoding size cannot b...