14 #define DEBUG_TYPE "mccodeemitter"
33 STATISTIC(MCNumEmitted,
"Number of MC instructions emitted.");
34 STATISTIC(MCNumCPRelocations,
"Number of constant pool relocations created.");
39 void operator=(const ARMMCCodeEmitter &) LLVM_DELETED_FUNCTION;
47 : MCII(mcii), STI(sti), CTX(ctx) {
50 ~ARMMCCodeEmitter() {}
52 bool isThumb()
const {
54 return (STI.getFeatureBits() & ARM::ModeThumb) != 0;
56 bool isThumb2()
const {
57 return isThumb() && (STI.getFeatureBits() & ARM::FeatureThumb2) != 0;
59 bool isTargetDarwin()
const {
60 Triple TT(STI.getTargetTriple());
64 unsigned getMachineSoImmOpValue(
unsigned SoImm)
const;
68 uint64_t getBinaryCodeForInstr(
const MCInst &
MI,
79 uint32_t getHiLo16ImmOpValue(
const MCInst &
MI,
unsigned OpIdx,
82 bool EncodeAddrModeOpValues(
const MCInst &
MI,
unsigned OpIdx,
83 unsigned &
Reg,
unsigned &Imm,
88 uint32_t getThumbBLTargetOpValue(
const MCInst &
MI,
unsigned OpIdx,
93 uint32_t getThumbBLXTargetOpValue(
const MCInst &
MI,
unsigned OpIdx,
97 uint32_t getThumbBRTargetOpValue(
const MCInst &
MI,
unsigned OpIdx,
101 uint32_t getThumbBCCTargetOpValue(
const MCInst &
MI,
unsigned OpIdx,
105 uint32_t getThumbCBTargetOpValue(
const MCInst &
MI,
unsigned OpIdx,
115 uint32_t getUnconditionalBranchTargetOpValue(
const MCInst &
MI,
unsigned OpIdx,
120 uint32_t getARMBranchTargetOpValue(
const MCInst &
MI,
unsigned OpIdx,
122 uint32_t getARMBLTargetOpValue(
const MCInst &
MI,
unsigned OpIdx,
124 uint32_t getARMBLXTargetOpValue(
const MCInst &
MI,
unsigned OpIdx,
129 uint32_t getAdrLabelOpValue(
const MCInst &
MI,
unsigned OpIdx,
131 uint32_t getThumbAdrLabelOpValue(
const MCInst &
MI,
unsigned OpIdx,
133 uint32_t getT2AdrLabelOpValue(
const MCInst &
MI,
unsigned OpIdx,
139 uint32_t getAddrModeImm12OpValue(
const MCInst &
MI,
unsigned OpIdx,
143 uint32_t getThumbAddrModeRegRegOpValue(
const MCInst &
MI,
unsigned OpIdx,
148 uint32_t getT2AddrModeImm8s4OpValue(
const MCInst &
MI,
unsigned OpIdx,
153 uint32_t getT2AddrModeImm0_1020s4OpValue(
const MCInst &
MI,
unsigned OpIdx,
158 uint32_t getT2Imm8s4OpValue(
const MCInst &
MI,
unsigned OpIdx,
164 uint32_t getLdStSORegOpValue(
const MCInst &
MI,
unsigned OpIdx,
168 uint32_t getLdStmModeOpValue(
const MCInst &
MI,
unsigned OpIdx,
194 uint32_t getAddrMode2OpValue(
const MCInst &MI,
unsigned OpIdx,
198 uint32_t getAddrMode2OffsetOpValue(
const MCInst &MI,
unsigned OpIdx,
202 uint32_t getPostIdxRegOpValue(
const MCInst &MI,
unsigned OpIdx,
206 uint32_t getAddrMode3OffsetOpValue(
const MCInst &MI,
unsigned OpIdx,
210 uint32_t getAddrMode3OpValue(
const MCInst &MI,
unsigned OpIdx,
215 uint32_t getAddrModeThumbSPOpValue(
const MCInst &MI,
unsigned OpIdx,
219 uint32_t getAddrModeISOpValue(
const MCInst &MI,
unsigned OpIdx,
223 uint32_t getAddrModePCOpValue(
const MCInst &MI,
unsigned OpIdx,
227 uint32_t getAddrMode5OpValue(
const MCInst &MI,
unsigned OpIdx,
231 unsigned getCCOutOpValue(
const MCInst &MI,
unsigned Op,
239 unsigned getSOImmOpValue(
const MCInst &MI,
unsigned Op,
243 assert(SoImmVal != -1 &&
"Not a valid so_imm value!");
255 unsigned getT2SOImmOpValue(
const MCInst &MI,
unsigned Op,
259 assert(Encoded != ~0U &&
"Not a Thumb2 so_imm value?");
263 unsigned getT2AddrModeSORegOpValue(
const MCInst &MI,
unsigned OpNum,
265 unsigned getT2AddrModeImm8OpValue(
const MCInst &MI,
unsigned OpNum,
267 unsigned getT2AddrModeImm8OffsetOpValue(
const MCInst &MI,
unsigned OpNum,
269 unsigned getT2AddrModeImm12OffsetOpValue(
const MCInst &MI,
unsigned OpNum,
273 unsigned getSORegRegOpValue(
const MCInst &MI,
unsigned Op,
275 unsigned getSORegImmOpValue(
const MCInst &MI,
unsigned Op,
277 unsigned getT2SORegOpValue(
const MCInst &MI,
unsigned Op,
280 unsigned getNEONVcvtImm32OpValue(
const MCInst &MI,
unsigned Op,
285 unsigned getBitfieldInvertedMaskOpValue(
const MCInst &MI,
unsigned Op,
288 unsigned getRegisterListOpValue(
const MCInst &MI,
unsigned Op,
290 unsigned getAddrMode6AddressOpValue(
const MCInst &MI,
unsigned Op,
292 unsigned getAddrMode6OneLane32AddressOpValue(
const MCInst &MI,
unsigned Op,
294 unsigned getAddrMode6DupAddressOpValue(
const MCInst &MI,
unsigned Op,
296 unsigned getAddrMode6OffsetOpValue(
const MCInst &MI,
unsigned Op,
299 unsigned getShiftRight8Imm(
const MCInst &MI,
unsigned Op,
301 unsigned getShiftRight16Imm(
const MCInst &MI,
unsigned Op,
303 unsigned getShiftRight32Imm(
const MCInst &MI,
unsigned Op,
305 unsigned getShiftRight64Imm(
const MCInst &MI,
unsigned Op,
308 unsigned getThumbSRImmOpValue(
const MCInst &MI,
unsigned Op,
311 unsigned NEONThumb2DataIPostEncoder(
const MCInst &MI,
312 unsigned EncodedValue)
const;
313 unsigned NEONThumb2LoadStorePostEncoder(
const MCInst &MI,
314 unsigned EncodedValue)
const;
315 unsigned NEONThumb2DupPostEncoder(
const MCInst &MI,
316 unsigned EncodedValue)
const;
317 unsigned NEONThumb2V8PostEncoder(
const MCInst &MI,
318 unsigned EncodedValue)
const;
320 unsigned VFPThumb2PostEncoder(
const MCInst &MI,
321 unsigned EncodedValue)
const;
327 void EmitConstant(uint64_t Val,
unsigned Size,
raw_ostream &OS)
const {
329 for (
unsigned i = 0; i != Size; ++i) {
330 EmitByte(Val & 255, OS);
345 return new ARMMCCodeEmitter(MCII, STI, Ctx);
351 unsigned ARMMCCodeEmitter::NEONThumb2DataIPostEncoder(
const MCInst &MI,
352 unsigned EncodedValue)
const {
357 unsigned Bit24 = EncodedValue & 0x01000000;
358 unsigned Bit28 = Bit24 << 4;
359 EncodedValue &= 0xEFFFFFFF;
360 EncodedValue |= Bit28;
361 EncodedValue |= 0x0F000000;
370 unsigned ARMMCCodeEmitter::NEONThumb2LoadStorePostEncoder(
const MCInst &MI,
371 unsigned EncodedValue)
const {
373 EncodedValue &= 0xF0FFFFFF;
374 EncodedValue |= 0x09000000;
383 unsigned ARMMCCodeEmitter::NEONThumb2DupPostEncoder(
const MCInst &MI,
384 unsigned EncodedValue)
const {
386 EncodedValue &= 0x00FFFFFF;
387 EncodedValue |= 0xEE000000;
395 unsigned ARMMCCodeEmitter::NEONThumb2V8PostEncoder(
const MCInst &MI,
396 unsigned EncodedValue)
const {
398 EncodedValue |= 0xC000000;
406 unsigned ARMMCCodeEmitter::
407 VFPThumb2PostEncoder(
const MCInst &MI,
unsigned EncodedValue)
const {
409 EncodedValue &= 0x0FFFFFFF;
410 EncodedValue |= 0xE0000000;
417 unsigned ARMMCCodeEmitter::
422 unsigned RegNo = CTX.getRegisterInfo()->getEncodingValue(Reg);
428 case ARM::Q0:
case ARM::Q1:
case ARM::Q2:
case ARM::Q3:
429 case ARM::Q4:
case ARM::Q5:
case ARM::Q6:
case ARM::Q7:
430 case ARM::Q8:
case ARM::Q9:
case ARM::Q10:
case ARM::Q11:
431 case ARM::Q12:
case ARM::Q13:
case ARM::Q14:
case ARM::Q15:
434 }
else if (MO.
isImm()) {
435 return static_cast<unsigned>(MO.
getImm());
438 .bitcastToAPInt().getHiBits(32).getLimitedValue());
445 bool ARMMCCodeEmitter::
446 EncodeAddrModeOpValues(
const MCInst &MI,
unsigned OpIdx,
unsigned &Reg,
451 Reg = CTX.getRegisterInfo()->getEncodingValue(MO.
getReg());
453 int32_t SImm = MO1.
getImm();
457 if (SImm == INT32_MIN) {
481 assert(MO.
isExpr() &&
"Unexpected branch target type!");
494 uint32_t S = (offset & 0x800000) >> 23;
495 uint32_t J1 = (offset & 0x400000) >> 22;
496 uint32_t J2 = (offset & 0x200000) >> 21;
510 uint32_t ARMMCCodeEmitter::
511 getThumbBLTargetOpValue(
const MCInst &MI,
unsigned OpIdx,
522 uint32_t ARMMCCodeEmitter::
523 getThumbBLXTargetOpValue(
const MCInst &MI,
unsigned OpIdx,
533 uint32_t ARMMCCodeEmitter::
534 getThumbBRTargetOpValue(
const MCInst &MI,
unsigned OpIdx,
540 return (MO.
getImm() >> 1);
544 uint32_t ARMMCCodeEmitter::
545 getThumbBCCTargetOpValue(
const MCInst &MI,
unsigned OpIdx,
551 return (MO.
getImm() >> 1);
555 uint32_t ARMMCCodeEmitter::
556 getThumbCBTargetOpValue(
const MCInst &MI,
unsigned OpIdx,
561 return (MO.
getImm() >> 1);
568 for (
int i = 0; i < NumOp-1; ++i) {
591 return getARMBranchTargetOpValue(MI, OpIdx, Fixups);
596 uint32_t ARMMCCodeEmitter::
597 getARMBranchTargetOpValue(
const MCInst &MI,
unsigned OpIdx,
611 uint32_t ARMMCCodeEmitter::
612 getARMBLTargetOpValue(
const MCInst &MI,
unsigned OpIdx,
625 uint32_t ARMMCCodeEmitter::
626 getARMBLXTargetOpValue(
const MCInst &MI,
unsigned OpIdx,
637 uint32_t ARMMCCodeEmitter::
638 getUnconditionalBranchTargetOpValue(
const MCInst &MI,
unsigned OpIdx,
648 bool I = (Val & 0x800000);
649 bool J1 = (Val & 0x400000);
650 bool J2 = (Val & 0x200000);
666 uint32_t ARMMCCodeEmitter::
667 getAdrLabelOpValue(
const MCInst &MI,
unsigned OpIdx,
673 int64_t offset = MO.
getImm();
674 uint32_t Val = 0x2000;
677 if (offset == INT32_MIN) {
680 }
else if (offset < 0) {
698 assert(SoImmVal != -1 &&
"Not a valid so_imm value!");
706 uint32_t ARMMCCodeEmitter::
707 getT2AdrLabelOpValue(
const MCInst &MI,
unsigned OpIdx,
713 int32_t Val = MO.
getImm();
714 if (Val == INT32_MIN)
725 uint32_t ARMMCCodeEmitter::
726 getThumbAdrLabelOpValue(
const MCInst &MI,
unsigned OpIdx,
737 uint32_t ARMMCCodeEmitter::
738 getThumbAddrModeRegRegOpValue(
const MCInst &MI,
unsigned OpIdx,
745 unsigned Rn = CTX.getRegisterInfo()->getEncodingValue(MO1.
getReg());
746 unsigned Rm = CTX.getRegisterInfo()->getEncodingValue(MO2.
getReg());
747 return (Rm << 3) | Rn;
751 uint32_t ARMMCCodeEmitter::
752 getAddrModeImm12OpValue(
const MCInst &MI,
unsigned OpIdx,
762 Reg = CTX.getRegisterInfo()->getEncodingValue(ARM::PC);
776 ++MCNumCPRelocations;
779 int32_t Offset = MO.
getImm();
780 if (Offset == INT32_MIN) {
783 }
else if (Offset < 0) {
790 isAdd = EncodeAddrModeOpValues(MI, OpIdx, Reg, Imm12, Fixups);
792 uint32_t Binary = Imm12 & 0xfff;
796 Binary |= (Reg << 13);
802 uint32_t ARMMCCodeEmitter::
803 getT2Imm8s4OpValue(
const MCInst &MI,
unsigned OpIdx,
815 bool isAdd = Imm8 >= 0;
819 Imm8 = -(uint32_t)Imm8;
824 uint32_t Binary = Imm8 & 0xff;
833 uint32_t ARMMCCodeEmitter::
834 getT2AddrModeImm8s4OpValue(
const MCInst &MI,
unsigned OpIdx,
844 Reg = CTX.getRegisterInfo()->getEncodingValue(ARM::PC);
848 assert(MO.
isExpr() &&
"Unexpected machine operand type!");
853 ++MCNumCPRelocations;
855 isAdd = EncodeAddrModeOpValues(MI, OpIdx, Reg, Imm8, Fixups);
863 uint32_t Binary = (Imm8 >> 2) & 0xff;
867 Binary |= (Reg << 9);
873 uint32_t ARMMCCodeEmitter::
874 getT2AddrModeImm0_1020s4OpValue(
const MCInst &MI,
unsigned OpIdx,
880 unsigned Reg = CTX.getRegisterInfo()->getEncodingValue(MO.
getReg());
881 unsigned Imm8 = MO1.
getImm();
882 return (Reg << 8) |
Imm8;
899 ARMMCCodeEmitter::getHiLo16ImmOpValue(
const MCInst &MI,
unsigned OpIdx,
906 return static_cast<unsigned>(MO.
getImm());
912 const ARMMCExpr *ARM16Expr = cast<ARMMCExpr>(E);
915 switch (ARM16Expr->
getKind()) {
957 uint32_t ARMMCCodeEmitter::
958 getLdStSORegOpValue(
const MCInst &MI,
unsigned OpIdx,
963 unsigned Rn = CTX.getRegisterInfo()->getEncodingValue(MO.
getReg());
964 unsigned Rm = CTX.getRegisterInfo()->getEncodingValue(MO1.
getReg());
968 unsigned SBits = getShiftOp(ShOp);
972 assert((ShImm & ~0x1f) == 0 &&
"Out of range shift amount");
981 uint32_t Binary = Rm;
983 Binary |= SBits << 5;
984 Binary |= ShImm << 7;
990 uint32_t ARMMCCodeEmitter::
991 getAddrMode2OpValue(
const MCInst &MI,
unsigned OpIdx,
998 unsigned Rn = CTX.getRegisterInfo()->getEncodingValue(MO.
getReg());
999 uint32_t Binary = getAddrMode2OffsetOpValue(MI, OpIdx + 1, Fixups);
1004 uint32_t ARMMCCodeEmitter::
1005 getAddrMode2OffsetOpValue(
const MCInst &MI,
unsigned OpIdx,
1012 unsigned Imm = MO1.
getImm();
1020 Binary |= getShiftOp(ShOp) << 5;
1021 Binary |= CTX.getRegisterInfo()->getEncodingValue(MO.
getReg());
1023 return Binary | (isAdd << 12) | (isReg << 13);
1026 uint32_t ARMMCCodeEmitter::
1027 getPostIdxRegOpValue(
const MCInst &MI,
unsigned OpIdx,
1033 bool isAdd = MO1.
getImm() != 0;
1034 return CTX.getRegisterInfo()->getEncodingValue(MO.
getReg()) | (isAdd << 4);
1037 uint32_t ARMMCCodeEmitter::
1038 getAddrMode3OffsetOpValue(
const MCInst &MI,
unsigned OpIdx,
1046 unsigned Imm = MO1.
getImm();
1048 bool isImm = MO.
getReg() == 0;
1052 Imm8 = CTX.getRegisterInfo()->getEncodingValue(MO.
getReg());
1053 return Imm8 | (isAdd << 8) | (isImm << 9);
1056 uint32_t ARMMCCodeEmitter::
1057 getAddrMode3OpValue(
const MCInst &MI,
unsigned OpIdx,
1070 unsigned Rn = CTX.getRegisterInfo()->getEncodingValue(ARM::PC);
1072 assert(MO.
isExpr() &&
"Unexpected machine operand type!");
1077 ++MCNumCPRelocations;
1078 return (Rn << 9) | (1 << 13);
1080 unsigned Rn = CTX.getRegisterInfo()->getEncodingValue(MO.
getReg());
1081 unsigned Imm = MO2.
getImm();
1083 bool isImm = MO1.
getReg() == 0;
1087 Imm8 = CTX.getRegisterInfo()->getEncodingValue(MO1.
getReg());
1088 return (Rn << 9) | Imm8 | (isAdd << 8) | (isImm << 13);
1092 uint32_t ARMMCCodeEmitter::
1093 getAddrModeThumbSPOpValue(
const MCInst &MI,
unsigned OpIdx,
1099 "Unexpected base register!");
1103 return MO1.
getImm() & 0xff;
1107 uint32_t ARMMCCodeEmitter::
1108 getAddrModeISOpValue(
const MCInst &MI,
unsigned OpIdx,
1115 unsigned Rn = CTX.getRegisterInfo()->getEncodingValue(MO.
getReg());
1116 unsigned Imm5 = MO1.
getImm();
1117 return ((Imm5 & 0x1f) << 3) | Rn;
1121 uint32_t ARMMCCodeEmitter::
1122 getAddrModePCOpValue(
const MCInst &MI,
unsigned OpIdx,
1127 return (MO.
getImm() >> 2);
1131 uint32_t ARMMCCodeEmitter::
1132 getAddrMode5OpValue(
const MCInst &MI,
unsigned OpIdx,
1142 Reg = CTX.getRegisterInfo()->getEncodingValue(ARM::PC);
1146 assert(MO.
isExpr() &&
"Unexpected machine operand type!");
1155 ++MCNumCPRelocations;
1157 EncodeAddrModeOpValues(MI, OpIdx, Reg, Imm8, Fixups);
1165 Binary |= (Reg << 9);
1169 unsigned ARMMCCodeEmitter::
1170 getSORegRegOpValue(
const MCInst &MI,
unsigned OpIdx,
1188 unsigned Binary = CTX.getRegisterInfo()->getEncodingValue(MO.
getReg());
1192 unsigned Rs = MO1.
getReg();
1208 Binary |= SBits << 4;
1213 return Binary | (CTX.getRegisterInfo()->getEncodingValue(Rs) <<
ARMII::RegRsShift);
1216 unsigned ARMMCCodeEmitter::
1217 getSORegImmOpValue(
const MCInst &MI,
unsigned OpIdx,
1232 unsigned Binary = CTX.getRegisterInfo()->getEncodingValue(MO.
getReg());
1255 Binary |= SBits << 4;
1257 assert(Offset < 32 &&
"Offset must be in range 0-31!");
1258 return Binary | (Offset << 7);
1262 unsigned ARMMCCodeEmitter::
1263 getT2AddrModeSORegOpValue(
const MCInst &MI,
unsigned OpNum,
1271 unsigned Value = CTX.getRegisterInfo()->getEncodingValue(MO1.
getReg());
1273 Value |= CTX.getRegisterInfo()->getEncodingValue(MO2.
getReg());
1280 unsigned ARMMCCodeEmitter::
1281 getT2AddrModeImm8OpValue(
const MCInst &MI,
unsigned OpNum,
1287 unsigned Value = CTX.getRegisterInfo()->getEncodingValue(MO1.
getReg());
1292 int32_t tmp = (int32_t)MO2.
getImm();
1301 unsigned ARMMCCodeEmitter::
1302 getT2AddrModeImm8OffsetOpValue(
const MCInst &MI,
unsigned OpNum,
1308 int32_t tmp = (int32_t)MO1.
getImm();
1317 unsigned ARMMCCodeEmitter::
1318 getT2AddrModeImm12OffsetOpValue(
const MCInst &MI,
unsigned OpNum,
1324 int32_t tmp = (int32_t)MO1.
getImm();
1329 Value |= tmp & 4095;
1333 unsigned ARMMCCodeEmitter::
1334 getT2SORegOpValue(
const MCInst &MI,
unsigned OpIdx,
1349 unsigned Binary = CTX.getRegisterInfo()->getEncodingValue(MO.
getReg());
1367 Binary |= SBits << 4;
1375 unsigned ARMMCCodeEmitter::
1376 getBitfieldInvertedMaskOpValue(
const MCInst &MI,
unsigned Op,
1381 uint32_t v = ~MO.
getImm();
1384 assert (v != 0 && lsb < 32 && msb < 32 &&
"Illegal bitfield mask!");
1385 return lsb | (msb << 5);
1388 unsigned ARMMCCodeEmitter::
1389 getRegisterListOpValue(
const MCInst &MI,
unsigned Op,
1398 bool SPRRegs = ARMMCRegisterClasses[ARM::SPRRegClassID].contains(Reg);
1399 bool DPRRegs = ARMMCRegisterClasses[ARM::DPRRegClassID].contains(Reg);
1401 unsigned Binary = 0;
1403 if (SPRRegs || DPRRegs) {
1405 unsigned RegNo = CTX.getRegisterInfo()->getEncodingValue(Reg);
1407 Binary |= (RegNo & 0x1f) << 8;
1411 Binary |= NumRegs * 2;
1414 unsigned RegNo = CTX.getRegisterInfo()->getEncodingValue(MI.
getOperand(I).
getReg());
1415 Binary |= 1 << RegNo;
1424 unsigned ARMMCCodeEmitter::
1425 getAddrMode6AddressOpValue(
const MCInst &MI,
unsigned Op,
1430 unsigned RegNo = CTX.getRegisterInfo()->getEncodingValue(Reg.
getReg());
1437 case 8: Align = 0x01;
break;
1438 case 16: Align = 0x02;
break;
1439 case 32: Align = 0x03;
break;
1442 return RegNo | (Align << 4);
1447 unsigned ARMMCCodeEmitter::
1448 getAddrMode6OneLane32AddressOpValue(
const MCInst &MI,
unsigned Op,
1453 unsigned RegNo = CTX.getRegisterInfo()->getEncodingValue(Reg.
getReg());
1461 case 2: Align = 0x00;
break;
1462 case 4: Align = 0x03;
break;
1465 return RegNo | (Align << 4);
1473 unsigned ARMMCCodeEmitter::
1474 getAddrMode6DupAddressOpValue(
const MCInst &MI,
unsigned Op,
1479 unsigned RegNo = CTX.getRegisterInfo()->getEncodingValue(Reg.
getReg());
1486 case 8: Align = 0x01;
break;
1487 case 16: Align = 0x03;
break;
1490 return RegNo | (Align << 4);
1493 unsigned ARMMCCodeEmitter::
1494 getAddrMode6OffsetOpValue(
const MCInst &MI,
unsigned Op,
1497 if (MO.
getReg() == 0)
return 0x0D;
1498 return CTX.getRegisterInfo()->getEncodingValue(MO.
getReg());
1501 unsigned ARMMCCodeEmitter::
1502 getShiftRight8Imm(
const MCInst &MI,
unsigned Op,
1507 unsigned ARMMCCodeEmitter::
1508 getShiftRight16Imm(
const MCInst &MI,
unsigned Op,
1513 unsigned ARMMCCodeEmitter::
1514 getShiftRight32Imm(
const MCInst &MI,
unsigned Op,
1519 unsigned ARMMCCodeEmitter::
1520 getShiftRight64Imm(
const MCInst &MI,
unsigned Op,
1525 void ARMMCCodeEmitter::
1530 uint64_t TSFlags = Desc.
TSFlags;
1540 uint32_t Binary = getBinaryCodeForInstr(MI, Fixups);
1543 if (isThumb() && Size == 4) {
1544 EmitConstant(Binary >> 16, 2, OS);
1545 EmitConstant(Binary & 0xffff, 2, OS);
1547 EmitConstant(Binary, Size, OS);
1551 #include "ARMGenMCCodeEmitter.inc"
static bool isReg(const MCInst &MI, unsigned OpNo)
void push_back(const T &Elt)
static unsigned char getAM3Offset(unsigned AM3Opc)
VariantKind getKind() const
getOpcode - Get the kind of this expression.
MCCodeEmitter * createARMMCCodeEmitter(const MCInstrInfo &MCII, const MCRegisterInfo &MRI, const MCSubtargetInfo &STI, MCContext &Ctx)
#define llvm_unreachable(msg)
const MCExpr * getSubExpr() const
getSubExpr - Get the child of this expression.
enable_if_c< std::numeric_limits< T >::is_integer &&!std::numeric_limits< T >::is_signed, std::size_t >::type 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 bool EvaluateAsPCRel(const MCExpr *Expr)
static uint32_t getBranchTargetOpValue(const MCInst &MI, unsigned OpIdx, unsigned FixupKind, SmallVectorImpl< MCFixup > &Fixups)
unsigned getReg() const
getReg - Returns the register number.
enable_if_c< std::numeric_limits< T >::is_integer &&!std::numeric_limits< T >::is_signed, std::size_t >::type 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...
static int getT2SOImmVal(unsigned Arg)
static unsigned getSOImmValRot(unsigned Imm)
const MCExpr * getExpr() const
static unsigned char getAM5Offset(unsigned AM5Opc)
MCCodeEmitter - Generic instruction encoding interface.
unsigned getSize() const
Return the number of bytes in the encoding of this instruction, or zero if the encoding size cannot b...
MCFixupKind
MCFixupKind - Extensible enumeration to represent the type of a fixup.
static unsigned getSOImmValImm(unsigned Imm)
This file declares a class to represent arbitrary precision floating point values and provide a varie...
static int32_t encodeThumbBLOffset(int32_t offset)
static bool HasConditionalBranch(const MCInst &MI)
Return true if this branch has a non-always predication.
bool isOSDarwin() const
isOSDarwin - Is this a "Darwin" OS (OS X or iOS).
static AddrOpc getAM2Op(unsigned AM2Opc)
static unsigned getAM2Offset(unsigned AM2Opc)
#define LLVM_DELETED_FUNCTION
unsigned getOpcode() const
static AddrOpc getAM3Op(unsigned AM3Opc)
static cl::opt< AlignMode > Align(cl::desc("Load/store alignment support"), cl::Hidden, cl::init(DefaultAlign), cl::values(clEnumValN(DefaultAlign,"arm-default-align","Generate unaligned accesses only on hardware/OS ""combinations that are known to support them"), clEnumValN(StrictAlign,"arm-strict-align","Disallow all unaligned memory accesses"), clEnumValN(NoStrictAlign,"arm-no-strict-align","Allow unaligned memory accesses"), clEnumValEnd))
static int getSOImmVal(unsigned Arg)
unsigned getNumOperands() const
References to labels and assigned expressions.
STATISTIC(MCNumEmitted,"Number of MC instructions emitted.")
static AddrOpc getAM5Op(unsigned AM5Opc)
static ShiftOpc getAM2ShiftOpc(unsigned AM2Opc)
LLVM Value Representation.
static unsigned getSORegOffset(unsigned Op)
static MCFixup Create(uint32_t Offset, const MCExpr *Value, MCFixupKind Kind, SMLoc Loc=SMLoc())
const MCRegisterInfo & MRI
Target specific expression.
const MCOperand & getOperand(unsigned i) const
static ShiftOpc getSORegShOp(unsigned Op)