27#include "llvm/IR/IntrinsicsMips.h"
33#define DEBUG_TYPE "mips-isel"
46void MipsSEDAGToDAGISel::addDSPCtrlRegOperands(
bool IsDef,
MachineInstr &
MI,
49 unsigned Mask =
MI.getOperand(1).getImm();
54 MIB.addReg(Mips::DSPPos, Flag);
57 MIB.addReg(Mips::DSPSCount, Flag);
60 MIB.addReg(Mips::DSPCarry, Flag);
63 MIB.addReg(Mips::DSPOutFlag, Flag);
66 MIB.addReg(Mips::DSPCCond, Flag);
69 MIB.addReg(Mips::DSPEFI, Flag);
74 return Mips::MSACtrlRegClass.getRegister(RegNum);
79 unsigned DstReg = 0, ZeroReg = 0;
82 if ((
MI.getOpcode() == Mips::ADDiu) &&
83 (
MI.getOperand(1).getReg() == Mips::R0) && (
MI.getOperand(2).isImm()) &&
84 (
MI.getOperand(2).getImm() == 0)) {
85 DstReg =
MI.getOperand(0).getReg();
87 }
else if ((
MI.getOpcode() == Mips::DADDiu) &&
88 (
MI.getOperand(1).getReg() == Mips::R0_64) &&
89 (
MI.getOperand(2).isImm()) && (
MI.getOperand(2).getImm() == 0)) {
90 DstReg =
MI.getOperand(0).getReg();
91 ZeroReg = Mips::R0_64;
100 MachineOperand &MO = *
U;
101 unsigned OpNo =
U.getOperandNo();
106 if (
MI->isPHI() ||
MI->isRegTiedToDefOperand(OpNo) ||
MI->isPseudo())
122 MachineInstrBuilder MIB(
MF, &
MI);
147void MipsSEDAGToDAGISel::processFunctionAfterISel(
MachineFunction &MF) {
150 MachineRegisterInfo *MRI = &
MF.getRegInfo();
152 for (
auto &
MBB:
MF) {
153 for (
auto &
MI:
MBB) {
154 switch (
MI.getOpcode()) {
156 addDSPCtrlRegOperands(
false,
MI,
MF);
159 addDSPCtrlRegOperands(
true,
MI,
MF);
161 case Mips::BuildPairF64_64:
162 case Mips::ExtractElementF64_64:
168 case Mips::BuildPairF64:
169 case Mips::ExtractElementF64:
175 if (
MI.getOperand(0).isGlobal() &&
176 MI.getOperand(0).getGlobal()->hasExternalLinkage() &&
177 MI.getOperand(0).getGlobal()->getName() ==
"_mcount")
180 case Mips::JALRPseudo:
181 case Mips::JALR64Pseudo:
182 case Mips::JALR16_MM:
183 if (
MI.getOperand(2).isMCSymbol() &&
184 MI.getOperand(2).getMCSymbol()->getName() ==
"_mcount")
188 if (
MI.getOperand(3).isMCSymbol() &&
189 MI.getOperand(3).getMCSymbol()->getName() ==
"_mcount")
193 replaceUsesWithZeroReg(MRI,
MI);
199void MipsSEDAGToDAGISel::selectAddE(
SDNode *Node,
const SDLoc &
DL)
const {
200 SDValue InGlue =
Node->getOperand(2);
203 EVT VT =
LHS.getValueType();
209 CurDAG->SelectNodeTo(Node, Mips::ADDWC, VT, MVT::Glue,
Ops);
227 SDValue CstOne =
CurDAG->getTargetConstant(1,
DL, MVT::i32);
229 SDValue OuFlag =
CurDAG->getTargetConstant(20,
DL, MVT::i32);
231 SDNode *DSPCtrlField =
CurDAG->getMachineNode(Mips::RDDSP,
DL, MVT::i32,
232 MVT::Glue, CstOne, InGlue);
234 SDNode *Carry =
CurDAG->getMachineNode(
235 Mips::EXT,
DL, MVT::i32, SDValue(DSPCtrlField, 0), OuFlag, CstOne);
237 SDValue
Ops[4] = {SDValue(DSPCtrlField, 0),
238 CurDAG->getTargetConstant(6,
DL, MVT::i32), CstOne,
240 SDNode *DSPCFWithCarry =
CurDAG->getMachineNode(Mips::INS,
DL, MVT::i32,
Ops);
247 SDValue
Zero =
CurDAG->getRegister(Mips::R0, MVT::i32);
249 SDValue InsOps[4] = {
Zero, OuFlag, CstOne, SDValue(DSPCFWithCarry, 0)};
250 SDNode *DSPCtrlFinal =
251 CurDAG->getMachineNode(Mips::INS,
DL, MVT::i32, InsOps);
253 SDNode *WrDSP =
CurDAG->getMachineNode(Mips::WRDSP,
DL, MVT::Glue,
254 SDValue(DSPCtrlFinal, 0), CstOne);
266 Base =
CurDAG->getTargetFrameIndex(FIN->getIndex(), ValTy);
267 Offset =
CurDAG->getTargetConstant(0, SDLoc(Addr), ValTy);
274bool MipsSEDAGToDAGISel::selectAddrFrameIndexOffset(
276 unsigned ShiftAmount = 0)
const {
277 if (
CurDAG->isBaseWithConstantOffset(Addr)) {
279 if (
isIntN(OffsetBits + ShiftAmount, CN->getSExtValue())) {
283 if (FrameIndexSDNode *FIN =
285 Base =
CurDAG->getTargetFrameIndex(FIN->getIndex(), ValTy);
291 if (!
isAligned(Alignment, CN->getZExtValue()))
295 Offset =
CurDAG->getTargetConstant(CN->getZExtValue(), SDLoc(Addr),
306 if (
Base.getOperand(1).getOpcode() == MipsISD::Lo ||
307 Base.getOperand(1).getOpcode() == MipsISD::GPRel) {
308 SDValue Opnd0 =
Base.getOperand(1).getOperand(0);
311 else if (GlobalAddressSDNode *GA =
314 const GlobalValue *GV = GA->getGlobal();
315 int64_t GAOffset = GA->getOffset();
317 GV, SDLoc(Addr), MVT::i32, GAOffset + CN->getZExtValue(),
338 if (Addr.
getOpcode() == MipsISD::Wrapper) {
344 if (!
TM.isPositionIndependent()) {
351 if (selectAddrFrameIndexOffset(Addr,
Base,
Offset, 16))
390 return selectAddrRegImm(Addr,
Base,
Offset) ||
399 if (selectAddrFrameIndexOffset(Addr,
Base,
Offset, 9))
411 if (selectAddrFrameIndexOffset(Addr,
Base,
Offset, 11))
423 if (selectAddrFrameIndexOffset(Addr,
Base,
Offset, 12))
434 if (selectAddrFrameIndexOffset(Addr,
Base,
Offset, 16))
442 return selectAddrRegImm11(Addr,
Base,
Offset) ||
448 return selectAddrRegImm12(Addr,
Base,
Offset) ||
454 return selectAddrRegImm16(Addr,
Base,
Offset) ||
460 if (selectAddrFrameIndexOffset(Addr,
Base,
Offset, 7)) {
465 unsigned CnstOff = CN->getZExtValue();
466 return (CnstOff == (CnstOff & 0x3c));
486 if (selectAddrFrameIndexOffset(Addr,
Base,
Offset, 10))
497 if (selectAddrFrameIndexOffset(Addr,
Base,
Offset, 10, 1))
508 if (selectAddrFrameIndexOffset(Addr,
Base,
Offset, 10, 2))
519 if (selectAddrFrameIndexOffset(Addr,
Base,
Offset, 10, 3))
531 unsigned MinSizeInBits)
const {
540 APInt SplatValue, SplatUndef;
541 unsigned SplatBitSize;
544 if (!
Node->isConstantSplat(SplatValue, SplatUndef, SplatBitSize, HasAnyUndefs,
569bool MipsSEDAGToDAGISel::
571 unsigned ImmBitSize)
const {
573 EVT EltTy =
N->getValueType(0).getVectorElementType();
576 N =
N->getOperand(0);
583 Imm =
CurDAG->getTargetConstant(ImmValue, SDLoc(
N), EltTy);
606 N =
N->getOperand(0);
637 N =
N->getOperand(0);
668 N =
N->getOperand(0);
681bool MipsSEDAGToDAGISel::selectVSplatUimmInvPow2(
SDValue N,
687 N =
N->getOperand(0);
691 int32_t
Log2 = (~ImmValue).exactLogBase2();
703bool MipsSEDAGToDAGISel::selectVSplatImmEq1(
SDValue N)
const {
708 N =
N->getOperand(0);
710 return selectVSplat(
N.getNode(), ImmValue, EltTy.
getSizeInBits()) &&
714bool MipsSEDAGToDAGISel::trySelect(
SDNode *Node) {
715 unsigned Opcode =
Node->getOpcode();
727 MVT VT =
Subtarget->isGP64bit() ? MVT::i64 : MVT::i32;
728 SDValue cond =
Node->getOperand(0);
729 SDValue Hi1 =
Node->getOperand(1);
730 SDValue Lo1 =
Node->getOperand(2);
731 SDValue Hi2 =
Node->getOperand(3);
732 SDValue Lo2 =
Node->getOperand(4);
734 SDValue
ops[] = {cond, Hi1, Lo1, Hi2, Lo2};
735 EVT NodeTys[] = {VT, VT};
737 ? Mips::PseudoD_SELECT_I64
738 : Mips::PseudoD_SELECT_I,
744 selectAddE(Node,
DL);
750 if (
Node->getValueType(0) == MVT::f64 && CN->isPosZero()) {
753 Mips::R0_64, MVT::i64);
755 CurDAG->getMachineNode(Mips::DMTC1,
DL, MVT::f64, Zero));
760 MVT::f64, Zero, Zero));
765 MVT::f64, Zero, Zero));
774 int64_t
Imm = CN->getSExtValue();
775 unsigned Size = CN->getValueSizeInBits(0);
780 MipsAnalyzeImmediate AnalyzeImm;
794 if (Inst->Opc == Mips::LUi64)
795 RegOpnd =
CurDAG->getMachineNode(Inst->Opc,
DL, MVT::i64, ImmOpnd);
797 RegOpnd =
CurDAG->getMachineNode(
798 Inst->Opc,
DL, MVT::i64,
CurDAG->getRegister(Mips::R0_64, MVT::i64),
802 for (++Inst; Inst != Seq.
end(); ++Inst) {
805 RegOpnd =
CurDAG->getMachineNode(Inst->Opc,
DL, MVT::i64,
806 SDValue(RegOpnd, 0), ImmOpnd);
814 const unsigned IntrinsicOpcode =
Node->getConstantOperandVal(1);
815 switch (IntrinsicOpcode) {
819 case Intrinsic::mips_cfcmsa: {
820 SDValue ChainIn =
Node->getOperand(0);
821 SDValue RegIdx =
Node->getOperand(2);
823 getMSACtrlReg(RegIdx), MVT::i32);
827 case Intrinsic::mips_ldr_d:
828 case Intrinsic::mips_ldr_w: {
829 unsigned Op = (IntrinsicOpcode == Intrinsic::mips_ldr_d) ? Mips::LDR_D
833 assert(
Node->getNumOperands() == 4 &&
"Unexpected number of operands.");
834 const SDValue &Chain =
Node->getOperand(0);
843 "Invalid instruction operand.");
846 const ConstantInt *Val =
854 assert(
Node->getValueType(0).is128BitVector());
867 switch (
Node->getConstantOperandVal(0)) {
871 case Intrinsic::mips_move_v:
875 Node->getValueType(0),
876 Node->getOperand(1)));
883 const unsigned IntrinsicOpcode =
Node->getConstantOperandVal(1);
884 switch (IntrinsicOpcode) {
888 case Intrinsic::mips_ctcmsa: {
889 SDValue ChainIn =
Node->getOperand(0);
890 SDValue RegIdx =
Node->getOperand(2);
892 SDValue ChainOut =
CurDAG->getCopyToReg(ChainIn,
DL,
893 getMSACtrlReg(RegIdx),
Value);
897 case Intrinsic::mips_str_d:
898 case Intrinsic::mips_str_w: {
899 unsigned Op = (IntrinsicOpcode == Intrinsic::mips_str_d) ? Mips::STR_D
903 assert(
Node->getNumOperands() == 5 &&
"Unexpected number of operands.");
904 const SDValue &Chain =
Node->getOperand(0);
906 const SDValue &Vec =
Node->getOperand(2);
914 "Invalid instruction operand.");
917 const ConstantInt *Val =
936 MVT ResTy =
Node->getSimpleValueType(0);
937 assert((ResTy == MVT::f64 || ResTy == MVT::f32) &&
938 "Unsupported float type!");
940 if (ResTy == MVT::f64)
941 Opc = (
Subtarget->isFP64bit() ? Mips::FABS_D64 : Mips::FABS_D32);
948 Opc = Mips::FABS_D64_MM;
951 Opc = Mips::FABS_D32_MM;
954 Opc = Mips::FABS_S_MM;
976 if (
Node->getValueType(0) != MVT::i32 &&
Node->getValueType(0) != MVT::i64)
979 if (
Node->getNumOperands() != 4)
986 MVT ResTy =
Node->getSimpleValueType(0);
997 if (ResTy != MVT::i32 && ResTy != MVT::i64)
1000 unsigned Opcode = 0;
1001 if (ResTy == MVT::i32) {
1002 if (Pos +
Size <= 32)
1005 if (Pos +
Size <= 32)
1006 Opcode = Mips::DINS;
1007 else if (Pos < 32 && 1 <
Size)
1008 Opcode = Mips::DINSM;
1010 Opcode = Mips::DINSU;
1015 Node->getOperand(0),
CurDAG->getTargetConstant(Pos,
DL, MVT::i32),
1025 case MipsISD::ThreadPointer: {
1027 unsigned RdhwrOpc, DestReg;
1029 if (PtrVT == MVT::i32) {
1030 RdhwrOpc = Mips::RDHWR;
1033 RdhwrOpc = Mips::RDHWR64;
1034 DestReg = Mips::R3_64;
1038 CurDAG->getMachineNode(RdhwrOpc,
DL,
Node->getValueType(0), MVT::Glue,
1039 CurDAG->getRegister(Mips::HWR29, MVT::i32),
1040 CurDAG->getTargetConstant(0,
DL, MVT::i32));
1041 SDValue Chain =
CurDAG->getCopyToReg(
CurDAG->getEntryNode(),
DL, DestReg,
1042 SDValue(Rdhwr, 0), SDValue(Rdhwr, 1));
1043 SDValue ResNode =
CurDAG->getCopyFromReg(Chain,
DL, DestReg, PtrVT,
1065 APInt SplatValue, SplatUndef;
1066 unsigned SplatBitSize;
1080 switch (SplatBitSize) {
1084 LdiOp = Mips::LDI_B;
1085 ViaVecTy = MVT::v16i8;
1088 LdiOp = Mips::LDI_H;
1089 ViaVecTy = MVT::v8i16;
1092 LdiOp = Mips::LDI_W;
1093 ViaVecTy = MVT::v4i32;
1096 LdiOp = Mips::LDI_D;
1097 ViaVecTy = MVT::v2i64;
1101 SDNode *Res =
nullptr;
1108 SDValue
Imm =
CurDAG->getTargetConstant(SplatValue,
DL,
1111 Res =
CurDAG->getMachineNode(LdiOp,
DL, ViaVecTy,
Imm);
1113 ((
ABI.IsO32() && SplatBitSize < 64) ||
1114 (
ABI.IsN32() ||
ABI.IsN64()))) {
1120 bool Is32BitSplat =
ABI.IsO32() || SplatBitSize < 64;
1121 const unsigned ADDiuOp = Is32BitSplat ? Mips::ADDiu : Mips::DADDiu;
1122 const MVT SplatMVT = Is32BitSplat ? MVT::i32 : MVT::i64;
1124 CurDAG->getRegister(Is32BitSplat ? Mips::R0 : Mips::R0_64, SplatMVT);
1126 const unsigned FILLOp =
1129 : (SplatBitSize == 32 ? Mips::FILL_W
1130 : (SplatBitSize == 64 ? Mips::FILL_D : 0));
1132 assert(FILLOp != 0 &&
"Unknown FILL Op for splat synthesis!");
1133 assert((!
ABI.IsO32() || (FILLOp != Mips::FILL_D)) &&
1134 "Attempting to use fill.d on MIPS32!");
1137 SDValue LoVal =
CurDAG->getTargetConstant(
Lo,
DL, SplatMVT);
1139 Res =
CurDAG->getMachineNode(ADDiuOp,
DL, SplatMVT, ZeroVal, LoVal);
1140 Res =
CurDAG->getMachineNode(FILLOp,
DL, ViaVecTy, SDValue(Res, 0));
1142 }
else if (SplatValue.
isSignedIntN(32) && SplatBitSize == 32) {
1147 SDValue ZeroVal =
CurDAG->getRegister(Mips::R0, MVT::i32);
1149 SDValue LoVal =
CurDAG->getTargetConstant(
Lo,
DL, MVT::i32);
1150 SDValue HiVal =
CurDAG->getTargetConstant(
Hi,
DL, MVT::i32);
1153 Res =
CurDAG->getMachineNode(Mips::LUi,
DL, MVT::i32, HiVal);
1156 Res =
CurDAG->getMachineNode(Mips::ORi,
DL, MVT::i32,
1157 Hi ? SDValue(Res, 0) : ZeroVal, LoVal);
1159 assert((
Hi ||
Lo) &&
"Zero case reached 32 bit case splat synthesis!");
1161 CurDAG->getMachineNode(Mips::FILL_W,
DL, MVT::v4i32, SDValue(Res, 0));
1163 }
else if (SplatValue.
isSignedIntN(32) && SplatBitSize == 64 &&
1164 (
ABI.IsN32() ||
ABI.IsN64())) {
1170 SDValue ZeroVal =
CurDAG->getRegister(Mips::R0, MVT::i32);
1172 SDValue LoVal =
CurDAG->getTargetConstant(
Lo,
DL, MVT::i32);
1173 SDValue HiVal =
CurDAG->getTargetConstant(
Hi,
DL, MVT::i32);
1176 Res =
CurDAG->getMachineNode(Mips::LUi,
DL, MVT::i32, HiVal);
1179 Res =
CurDAG->getMachineNode(Mips::ORi,
DL, MVT::i32,
1180 Hi ? SDValue(Res, 0) : ZeroVal, LoVal);
1182 Res =
CurDAG->getMachineNode(
1183 Mips::SUBREG_TO_REG,
DL, MVT::i64, SDValue(Res, 0),
1184 CurDAG->getTargetConstant(Mips::sub_32,
DL, MVT::i64));
1187 CurDAG->getMachineNode(Mips::FILL_D,
DL, MVT::v2i64, SDValue(Res, 0));
1220 SDValue LoVal =
CurDAG->getTargetConstant(
Lo,
DL, MVT::i32);
1221 SDValue HiVal =
CurDAG->getTargetConstant(
Hi,
DL, MVT::i32);
1222 SDValue HigherVal =
CurDAG->getTargetConstant(Higher,
DL, MVT::i32);
1223 SDValue HighestVal =
CurDAG->getTargetConstant(Highest,
DL, MVT::i32);
1224 SDValue ZeroVal =
CurDAG->getRegister(Mips::R0, MVT::i32);
1243 Res =
CurDAG->getMachineNode(Mips::LUi,
DL, MVT::i32, HiVal);
1246 Res =
CurDAG->getMachineNode(Mips::ORi,
DL, MVT::i32,
1247 Hi ? SDValue(Res, 0) : ZeroVal, LoVal);
1251 HiRes =
CurDAG->getMachineNode(Mips::LUi,
DL, MVT::i32, HighestVal);
1254 HiRes =
CurDAG->getMachineNode(Mips::ORi,
DL, MVT::i32,
1255 Highest ? SDValue(HiRes, 0) : ZeroVal,
1260 Res =
CurDAG->getMachineNode(Mips::FILL_W,
DL, MVT::v4i32,
1261 (
Hi ||
Lo) ? SDValue(Res, 0) : ZeroVal);
1263 Res =
CurDAG->getMachineNode(
1264 Mips::INSERT_W,
DL, MVT::v4i32, SDValue(Res, 0),
1265 (Highest || Higher) ? SDValue(HiRes, 0) : ZeroVal,
1266 CurDAG->getTargetConstant(1,
DL, MVT::i32));
1272 Res =
CurDAG->getMachineNode(
1273 Mips::COPY_TO_REGCLASS,
DL, ViaVecTy, SDValue(Res, 0),
1276 Res =
CurDAG->getMachineNode(
1277 Mips::SPLATI_D,
DL, MVT::v2i64, SDValue(Res, 0),
1278 CurDAG->getTargetConstant(0,
DL, MVT::i32));
1279 }
else if (
ABI.IsN64() ||
ABI.IsN32()) {
1281 SDValue Zero64Val =
CurDAG->getRegister(Mips::R0_64, MVT::i64);
1282 const bool HiResNonZero = Highest || Higher;
1283 const bool ResNonZero =
Hi ||
Lo;
1286 HiRes =
CurDAG->getMachineNode(
1287 Mips::SUBREG_TO_REG,
DL, MVT::i64, SDValue(HiRes, 0),
1288 CurDAG->getTargetConstant(Mips::sub_32,
DL, MVT::i64));
1291 Res =
CurDAG->getMachineNode(
1292 Mips::SUBREG_TO_REG,
DL, MVT::i64, SDValue(Res, 0),
1293 CurDAG->getTargetConstant(Mips::sub_32,
DL, MVT::i64));
1303 IntegerType *Int32Ty =
1305 const ConstantInt *Const32 = ConstantInt::get(Int32Ty, 32);
1306 SDValue
Ops[4] = {HiResNonZero ? SDValue(HiRes, 0) : Zero64Val,
1311 Res =
CurDAG->getMachineNode(Mips::DINSU,
DL, MVT::i64,
Ops);
1312 }
else if (HiResNonZero) {
1313 Res =
CurDAG->getMachineNode(
1314 Mips::DSLL32,
DL, MVT::i64, SDValue(HiRes, 0),
1315 CurDAG->getTargetConstant(0,
DL, MVT::i32));
1318 "Zero splat value handled by non-zero 64bit splat synthesis!");
1320 Res =
CurDAG->getMachineNode(Mips::FILL_D,
DL, MVT::v2i64,
1328 if (ResVecTy != ViaVecTy) {
1336 Res =
CurDAG->getMachineNode(Mips::COPY_TO_REGCLASS,
DL,
1337 ResVecTy, SDValue(Res, 0),
1351bool MipsSEDAGToDAGISel::SelectInlineAsmMemoryOperand(
1353 std::vector<SDValue> &OutOps) {
1356 switch(ConstraintID) {
1363 OutOps.push_back(
Base);
1364 OutOps.push_back(
Offset);
1367 OutOps.push_back(
Op);
1368 OutOps.push_back(
CurDAG->getTargetConstant(0, SDLoc(
Op), MVT::i32));
1377 OutOps.push_back(
Base);
1378 OutOps.push_back(
Offset);
1381 OutOps.push_back(
Op);
1382 OutOps.push_back(
CurDAG->getTargetConstant(0, SDLoc(
Op), MVT::i32));
1390 OutOps.push_back(
Base);
1391 OutOps.push_back(
Offset);
1397 OutOps.push_back(
Base);
1398 OutOps.push_back(
Offset);
1403 OutOps.push_back(
Base);
1404 OutOps.push_back(
Offset);
1408 OutOps.push_back(
Op);
1409 OutOps.push_back(
CurDAG->getTargetConstant(0, SDLoc(
Op), MVT::i32));
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static uint64_t getConstant(const Value *IndexValue)
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]
static bool initGlobalBaseReg(MachineFunction &MF)
Class for arbitrary precision integers.
LLVM_ABI APInt getLoBits(unsigned numBits) const
Compute an APInt containing numBits lowbits from this APInt.
uint64_t getZExtValue() const
Get zero extended value.
unsigned popcount() const
Count the number of bits set.
unsigned getBitWidth() const
Return the number of bits in the APInt.
bool isNegative() const
Determine sign of this APInt.
int32_t exactLogBase2() const
bool isSignedIntN(unsigned N) const
Check if this APInt has an N-bits signed integer value.
bool isShiftedMask() const
Return true if this APInt value contains a non-empty sequence of ones with the remainder zero.
bool isMask(unsigned numBits) const
bool isIntN(unsigned N) const
Check if this APInt has an N-bits unsigned integer value.
APInt lshr(unsigned shiftAmt) const
Logical right-shift function.
Represent the analysis usage information of a pass.
LLVM_ABI bool isConstantSplat(APInt &SplatValue, APInt &SplatUndef, unsigned &SplatBitSize, bool &HasAnyUndefs, unsigned MinSplatBits=0, bool isBigEndian=false) const
Check if this is a constant splat, and if so, find the smallest element size that splats the vector.
FunctionPass class - This class is used to implement most global optimizations.
static LLVM_ABI IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
unsigned getID() const
getID() - Return the register class ID number.
bool contains(MCRegister Reg) const
contains - Return true if the specified register is included in this register class.
Wrapper class representing physical registers. Should be passed by value.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
const MachineInstrBuilder & addUse(Register RegNo, RegState Flags={}, unsigned SubReg=0) const
Add a virtual register use operand.
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
const MachineInstrBuilder & addDef(Register RegNo, RegState Flags={}, unsigned SubReg=0) const
Add a virtual register definition operand.
Representation of each machine instruction.
LLVM_ABI void setReg(Register Reg)
Change the register this operand corresponds to.
MachineInstr * getParent()
getParent - Return the instruction that this operand belongs to.
Register getReg() const
getReg - Returns the register number.
static MachineOperand CreateReg(Register Reg, bool isDef, bool isImp=false, bool isKill=false, bool isDead=false, bool isUndef=false, bool isEarlyClobber=false, unsigned SubReg=0, bool isDebug=false, bool isInternalRead=false, bool isRenamable=false)
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
const TargetRegisterClass * getRegClass(Register Reg) const
Return the register class of the specified virtual register.
defusechain_iterator< true, false, false, true, false > use_iterator
use_iterator/use_begin/use_end - Walk all uses of the specified register.
use_iterator use_begin(Register RegNo) const
static use_iterator use_end()
MipsDAGToDAGISelLegacy(std::unique_ptr< SelectionDAGISel > S)
bool runOnMachineFunction(MachineFunction &MF) override
const MipsSubtarget * Subtarget
Keep a pointer to the MipsSubtarget around so that we can make the right decision when generating cod...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
MipsSEDAGToDAGISelLegacy(MipsTargetMachine &TM, CodeGenOptLevel OL)
bool inMips16Mode() const
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
Represents one node in the SelectionDAG.
uint64_t getAsZExtVal() const
Helper method returns the zero-extended integer value of a ConstantSDNode.
EVT getValueType(unsigned ResNo) const
Return the type of a specified result.
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation.
SDNode * getNode() const
get the SDNode which holds the desired result
SDValue getValue(unsigned R) const
EVT getValueType() const
Return the ValueType of the referenced return value.
const SDValue & getOperand(unsigned i) const
unsigned getOpcode() const
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
const TargetLowering * TLI
const TargetInstrInfo * TII
void ReplaceNode(SDNode *F, SDNode *T)
Replace all uses of F with T, then remove F from the DAG.
const TargetLowering * getTargetLowering() const
virtual MVT getPointerTy(const DataLayout &DL, uint32_t AS=0) const
Return the pointer type for the given address space, defaults to the pointer type from the data layou...
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
@ ADDC
Carry-setting nodes for multiple precision addition and subtraction.
@ ADD
Simple integer binary arithmetic operators.
@ INTRINSIC_VOID
OUTCHAIN = INTRINSIC_VOID(INCHAIN, INTRINSICID, arg1, arg2, ...) This node represents a target intrin...
@ BITCAST
BITCAST - This operator converts between integer, vector and FP values, as if the value was stored to...
@ TargetGlobalAddress
TargetGlobalAddress - Like GlobalAddress, but the DAG does no folding or anything else with this node...
@ TargetConstant
TargetConstant* - Like Constant*, but the DAG does not do any folding, simplification,...
@ INTRINSIC_WO_CHAIN
RESULT = INTRINSIC_WO_CHAIN(INTRINSICID, arg1, arg2, ...) This node represents a target intrinsic fun...
@ ADDE
Carry-using nodes for multiple precision addition and subtraction.
@ INTRINSIC_W_CHAIN
RESULT,OUTCHAIN = INTRINSIC_W_CHAIN(INCHAIN, INTRINSICID, arg1, ...) This node represents a target in...
@ BUILD_VECTOR
BUILD_VECTOR(ELT0, ELT1, ELT2, ELT3,...) - Return a fixed-width vector with the specified,...
constexpr MCPhysReg RA_64
NodeAddr< NodeBase * > Node
This is an optimization pass for GlobalISel generic memory operations.
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
constexpr bool isInt(int64_t x)
Checks if an integer fits into the given bit width.
RegState
Flags to represent properties of register accesses.
@ Implicit
Not emitted register (e.g. carry, or temporary result).
@ Undef
Value of the register doesn't matter.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
bool isAligned(Align Lhs, uint64_t SizeInBytes)
Checks that SizeInBytes is a multiple of the alignment.
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Value
FunctionPass * createMipsSEISelDag(MipsTargetMachine &TM, CodeGenOptLevel OptLevel)
CodeGenOptLevel
Code generation optimization level.
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
DWARFExpression::Operation Op
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
constexpr bool isIntN(unsigned N, int64_t x)
Checks if an signed integer fits into the given (dynamic) bit width.
constexpr int64_t SignExtend64(uint64_t x)
Sign-extend the number in the bottom B bits of X to a 64-bit integer.
unsigned Log2(Align A)
Returns the log2 of the alignment.
MCRegisterClass TargetRegisterClass
Implement std::hash so that hash_code can be used in STL containers.
static constexpr Align fromLog2(unsigned Log2Value)
Returns an alignment of 1 << Log2Value bytes.
TypeSize getSizeInBits() const
Return the size of the specified value type in bits.
MVT getSimpleVT() const
Return the SimpleValueType held in the specified simple EVT.
bool is128BitVector() const
Return true if this is a 128-bit vector type.
EVT getVectorElementType() const
Given a vector type, return the type of each element.