28#include "llvm/IR/IntrinsicsMips.h"
35#define DEBUG_TYPE "mips-isel"
48void MipsSEDAGToDAGISel::addDSPCtrlRegOperands(
bool IsDef,
MachineInstr &
MI,
51 unsigned Mask =
MI.getOperand(1).getImm();
56 MIB.addReg(Mips::DSPPos, Flag);
59 MIB.addReg(Mips::DSPSCount, Flag);
62 MIB.addReg(Mips::DSPCarry, Flag);
65 MIB.addReg(Mips::DSPOutFlag, Flag);
68 MIB.addReg(Mips::DSPCCond, Flag);
71 MIB.addReg(Mips::DSPEFI, Flag);
76 return Mips::MSACtrlRegClass.getRegister(RegNum);
81 unsigned DstReg = 0, ZeroReg = 0;
84 if ((
MI.getOpcode() == Mips::ADDiu) &&
85 (
MI.getOperand(1).getReg() == Mips::R0) && (
MI.getOperand(2).isImm()) &&
86 (
MI.getOperand(2).getImm() == 0)) {
87 DstReg =
MI.getOperand(0).getReg();
89 }
else if ((
MI.getOpcode() == Mips::DADDiu) &&
90 (
MI.getOperand(1).getReg() == Mips::R0_64) &&
91 (
MI.getOperand(2).isImm()) && (
MI.getOperand(2).getImm() == 0)) {
92 DstReg =
MI.getOperand(0).getReg();
93 ZeroReg = Mips::R0_64;
102 MachineOperand &MO = *
U;
103 unsigned OpNo =
U.getOperandNo();
108 if (
MI->isPHI() ||
MI->isRegTiedToDefOperand(OpNo) ||
MI->isPseudo())
124 MachineInstrBuilder MIB(
MF, &
MI);
149void MipsSEDAGToDAGISel::processFunctionAfterISel(
MachineFunction &MF) {
152 MachineRegisterInfo *
MRI = &
MF.getRegInfo();
154 for (
auto &
MBB:
MF) {
155 for (
auto &
MI:
MBB) {
156 switch (
MI.getOpcode()) {
158 addDSPCtrlRegOperands(
false,
MI,
MF);
161 addDSPCtrlRegOperands(
true,
MI,
MF);
163 case Mips::BuildPairF64_64:
164 case Mips::ExtractElementF64_64:
170 case Mips::BuildPairF64:
171 case Mips::ExtractElementF64:
177 if (
MI.getOperand(0).isGlobal() &&
178 MI.getOperand(0).getGlobal()->hasExternalLinkage() &&
179 MI.getOperand(0).getGlobal()->getName() ==
"_mcount")
182 case Mips::JALRPseudo:
183 case Mips::JALR64Pseudo:
184 case Mips::JALR16_MM:
185 if (
MI.getOperand(2).isMCSymbol() &&
186 MI.getOperand(2).getMCSymbol()->getName() ==
"_mcount")
190 if (
MI.getOperand(3).isMCSymbol() &&
191 MI.getOperand(3).getMCSymbol()->getName() ==
"_mcount")
195 replaceUsesWithZeroReg(
MRI,
MI);
201void MipsSEDAGToDAGISel::selectAddE(
SDNode *Node,
const SDLoc &
DL)
const {
202 SDValue InGlue =
Node->getOperand(2);
205 EVT VT =
LHS.getValueType();
211 CurDAG->SelectNodeTo(Node, Mips::ADDWC, VT, MVT::Glue,
Ops);
229 SDValue CstOne =
CurDAG->getTargetConstant(1,
DL, MVT::i32);
231 SDValue OuFlag =
CurDAG->getTargetConstant(20,
DL, MVT::i32);
233 SDNode *DSPCtrlField =
CurDAG->getMachineNode(Mips::RDDSP,
DL, MVT::i32,
234 MVT::Glue, CstOne, InGlue);
236 SDNode *Carry =
CurDAG->getMachineNode(
237 Mips::EXT,
DL, MVT::i32, SDValue(DSPCtrlField, 0), OuFlag, CstOne);
239 SDValue
Ops[4] = {SDValue(DSPCtrlField, 0),
240 CurDAG->getTargetConstant(6,
DL, MVT::i32), CstOne,
242 SDNode *DSPCFWithCarry =
CurDAG->getMachineNode(Mips::INS,
DL, MVT::i32,
Ops);
249 SDValue
Zero =
CurDAG->getRegister(Mips::R0, MVT::i32);
251 SDValue InsOps[4] = {
Zero, OuFlag, CstOne, SDValue(DSPCFWithCarry, 0)};
252 SDNode *DSPCtrlFinal =
253 CurDAG->getMachineNode(Mips::INS,
DL, MVT::i32, InsOps);
255 SDNode *WrDSP =
CurDAG->getMachineNode(Mips::WRDSP,
DL, MVT::Glue,
256 SDValue(DSPCtrlFinal, 0), CstOne);
268 Base =
CurDAG->getTargetFrameIndex(FIN->getIndex(), ValTy);
269 Offset =
CurDAG->getTargetConstant(0, SDLoc(Addr), ValTy);
276bool MipsSEDAGToDAGISel::selectAddrFrameIndexOffset(
278 unsigned ShiftAmount = 0)
const {
279 if (
CurDAG->isBaseWithConstantOffset(Addr)) {
281 if (
isIntN(OffsetBits + ShiftAmount, CN->getSExtValue())) {
285 if (FrameIndexSDNode *FIN =
287 Base =
CurDAG->getTargetFrameIndex(FIN->getIndex(), ValTy);
293 if (!
isAligned(Alignment, CN->getZExtValue()))
297 Offset =
CurDAG->getTargetConstant(CN->getZExtValue(), SDLoc(Addr),
308 if (
Base.getOperand(1).getOpcode() == MipsISD::Lo ||
309 Base.getOperand(1).getOpcode() == MipsISD::GPRel) {
310 SDValue Opnd0 =
Base.getOperand(1).getOperand(0);
313 else if (GlobalAddressSDNode *GA =
316 const GlobalValue *GV = GA->getGlobal();
317 int64_t GAOffset = GA->getOffset();
319 GV, SDLoc(Addr), MVT::i32, GAOffset + CN->getZExtValue(),
340 if (Addr.
getOpcode() == MipsISD::Wrapper) {
346 if (!
TM.isPositionIndependent()) {
353 if (selectAddrFrameIndexOffset(Addr,
Base,
Offset, 16))
392 return selectAddrRegImm(Addr,
Base,
Offset) ||
401 if (selectAddrFrameIndexOffset(Addr,
Base,
Offset, 9))
413 if (selectAddrFrameIndexOffset(Addr,
Base,
Offset, 11))
425 if (selectAddrFrameIndexOffset(Addr,
Base,
Offset, 12))
436 if (selectAddrFrameIndexOffset(Addr,
Base,
Offset, 16))
444 return selectAddrRegImm11(Addr,
Base,
Offset) ||
450 return selectAddrRegImm12(Addr,
Base,
Offset) ||
456 return selectAddrRegImm16(Addr,
Base,
Offset) ||
462 if (selectAddrFrameIndexOffset(Addr,
Base,
Offset, 7)) {
467 unsigned CnstOff = CN->getZExtValue();
468 return (CnstOff == (CnstOff & 0x3c));
488 if (selectAddrFrameIndexOffset(Addr,
Base,
Offset, 10))
499 if (selectAddrFrameIndexOffset(Addr,
Base,
Offset, 10, 1))
510 if (selectAddrFrameIndexOffset(Addr,
Base,
Offset, 10, 2))
521 if (selectAddrFrameIndexOffset(Addr,
Base,
Offset, 10, 3))
533 unsigned MinSizeInBits)
const {
542 APInt SplatValue, SplatUndef;
543 unsigned SplatBitSize;
546 if (!
Node->isConstantSplat(SplatValue, SplatUndef, SplatBitSize, HasAnyUndefs,
571bool MipsSEDAGToDAGISel::
573 unsigned ImmBitSize)
const {
575 EVT EltTy =
N->getValueType(0).getVectorElementType();
578 N =
N->getOperand(0);
585 Imm =
CurDAG->getTargetConstant(ImmValue, SDLoc(
N), EltTy);
608 N =
N->getOperand(0);
639 N =
N->getOperand(0);
670 N =
N->getOperand(0);
683bool MipsSEDAGToDAGISel::selectVSplatUimmInvPow2(
SDValue N,
689 N =
N->getOperand(0);
693 int32_t
Log2 = (~ImmValue).exactLogBase2();
705bool MipsSEDAGToDAGISel::selectVSplatImmEq1(
SDValue N)
const {
710 N =
N->getOperand(0);
712 return selectVSplat(
N.getNode(), ImmValue, EltTy.
getSizeInBits()) &&
716bool MipsSEDAGToDAGISel::trySelect(
SDNode *Node) {
717 unsigned Opcode =
Node->getOpcode();
729 MVT VT =
Subtarget->isGP64bit() ? MVT::i64 : MVT::i32;
730 SDValue cond =
Node->getOperand(0);
731 SDValue Hi1 =
Node->getOperand(1);
732 SDValue Lo1 =
Node->getOperand(2);
733 SDValue Hi2 =
Node->getOperand(3);
734 SDValue Lo2 =
Node->getOperand(4);
736 SDValue
ops[] = {cond, Hi1, Lo1, Hi2, Lo2};
737 EVT NodeTys[] = {VT, VT};
739 ? Mips::PseudoD_SELECT_I64
740 : Mips::PseudoD_SELECT_I,
746 selectAddE(Node,
DL);
752 if (
Node->getValueType(0) == MVT::f64 && CN->isPosZero()) {
755 Mips::R0_64, MVT::i64);
757 CurDAG->getMachineNode(Mips::DMTC1,
DL, MVT::f64, Zero));
762 MVT::f64, Zero, Zero));
767 MVT::f64, Zero, Zero));
776 int64_t
Imm = CN->getSExtValue();
777 unsigned Size = CN->getValueSizeInBits(0);
782 MipsAnalyzeImmediate AnalyzeImm;
796 if (Inst->Opc == Mips::LUi64)
797 RegOpnd =
CurDAG->getMachineNode(Inst->Opc,
DL, MVT::i64, ImmOpnd);
799 RegOpnd =
CurDAG->getMachineNode(
800 Inst->Opc,
DL, MVT::i64,
CurDAG->getRegister(Mips::R0_64, MVT::i64),
804 for (++Inst; Inst != Seq.
end(); ++Inst) {
807 RegOpnd =
CurDAG->getMachineNode(Inst->Opc,
DL, MVT::i64,
808 SDValue(RegOpnd, 0), ImmOpnd);
816 const unsigned IntrinsicOpcode =
Node->getConstantOperandVal(1);
817 switch (IntrinsicOpcode) {
821 case Intrinsic::mips_cfcmsa: {
822 SDValue ChainIn =
Node->getOperand(0);
823 SDValue RegIdx =
Node->getOperand(2);
825 getMSACtrlReg(RegIdx), MVT::i32);
829 case Intrinsic::mips_ldr_d:
830 case Intrinsic::mips_ldr_w: {
831 unsigned Op = (IntrinsicOpcode == Intrinsic::mips_ldr_d) ? Mips::LDR_D
835 assert(
Node->getNumOperands() == 4 &&
"Unexpected number of operands.");
836 const SDValue &Chain =
Node->getOperand(0);
845 "Invalid instruction operand.");
848 const ConstantInt *Val =
856 assert(
Node->getValueType(0).is128BitVector());
869 switch (
Node->getConstantOperandVal(0)) {
873 case Intrinsic::mips_move_v:
877 Node->getValueType(0),
878 Node->getOperand(1)));
885 const unsigned IntrinsicOpcode =
Node->getConstantOperandVal(1);
886 switch (IntrinsicOpcode) {
890 case Intrinsic::mips_ctcmsa: {
891 SDValue ChainIn =
Node->getOperand(0);
892 SDValue RegIdx =
Node->getOperand(2);
894 SDValue ChainOut =
CurDAG->getCopyToReg(ChainIn,
DL,
895 getMSACtrlReg(RegIdx),
Value);
899 case Intrinsic::mips_str_d:
900 case Intrinsic::mips_str_w: {
901 unsigned Op = (IntrinsicOpcode == Intrinsic::mips_str_d) ? Mips::STR_D
905 assert(
Node->getNumOperands() == 5 &&
"Unexpected number of operands.");
906 const SDValue &Chain =
Node->getOperand(0);
908 const SDValue &Vec =
Node->getOperand(2);
916 "Invalid instruction operand.");
919 const ConstantInt *Val =
938 MVT ResTy =
Node->getSimpleValueType(0);
939 assert((ResTy == MVT::f64 || ResTy == MVT::f32) &&
940 "Unsupported float type!");
942 if (ResTy == MVT::f64)
943 Opc = (
Subtarget->isFP64bit() ? Mips::FABS_D64 : Mips::FABS_D32);
950 Opc = Mips::FABS_D64_MM;
953 Opc = Mips::FABS_D32_MM;
956 Opc = Mips::FABS_S_MM;
978 if (
Node->getValueType(0) != MVT::i32 &&
Node->getValueType(0) != MVT::i64)
981 if (
Node->getNumOperands() != 4)
988 MVT ResTy =
Node->getSimpleValueType(0);
999 if (ResTy != MVT::i32 && ResTy != MVT::i64)
1002 unsigned Opcode = 0;
1003 if (ResTy == MVT::i32) {
1004 if (Pos +
Size <= 32)
1007 if (Pos +
Size <= 32)
1008 Opcode = Mips::DINS;
1009 else if (Pos < 32 && 1 <
Size)
1010 Opcode = Mips::DINSM;
1012 Opcode = Mips::DINSU;
1017 Node->getOperand(0),
CurDAG->getTargetConstant(Pos,
DL, MVT::i32),
1027 case MipsISD::ThreadPointer: {
1029 unsigned RdhwrOpc, DestReg;
1031 if (PtrVT == MVT::i32) {
1032 RdhwrOpc = Mips::RDHWR;
1035 RdhwrOpc = Mips::RDHWR64;
1036 DestReg = Mips::R3_64;
1040 CurDAG->getMachineNode(RdhwrOpc,
DL,
Node->getValueType(0), MVT::Glue,
1041 CurDAG->getRegister(Mips::HWR29, MVT::i32),
1042 CurDAG->getTargetConstant(0,
DL, MVT::i32));
1043 SDValue Chain =
CurDAG->getCopyToReg(
CurDAG->getEntryNode(),
DL, DestReg,
1044 SDValue(Rdhwr, 0), SDValue(Rdhwr, 1));
1045 SDValue ResNode =
CurDAG->getCopyFromReg(Chain,
DL, DestReg, PtrVT,
1067 APInt SplatValue, SplatUndef;
1068 unsigned SplatBitSize;
1082 switch (SplatBitSize) {
1086 LdiOp = Mips::LDI_B;
1087 ViaVecTy = MVT::v16i8;
1090 LdiOp = Mips::LDI_H;
1091 ViaVecTy = MVT::v8i16;
1094 LdiOp = Mips::LDI_W;
1095 ViaVecTy = MVT::v4i32;
1098 LdiOp = Mips::LDI_D;
1099 ViaVecTy = MVT::v2i64;
1103 SDNode *Res =
nullptr;
1110 SDValue
Imm =
CurDAG->getTargetConstant(SplatValue,
DL,
1113 Res =
CurDAG->getMachineNode(LdiOp,
DL, ViaVecTy,
Imm);
1115 ((
ABI.IsO32() && SplatBitSize < 64) ||
1116 (
ABI.IsN32() ||
ABI.IsN64()))) {
1122 bool Is32BitSplat =
ABI.IsO32() || SplatBitSize < 64;
1123 const unsigned ADDiuOp = Is32BitSplat ? Mips::ADDiu : Mips::DADDiu;
1124 const MVT SplatMVT = Is32BitSplat ? MVT::i32 : MVT::i64;
1126 CurDAG->getRegister(Is32BitSplat ? Mips::R0 : Mips::R0_64, SplatMVT);
1128 const unsigned FILLOp =
1131 : (SplatBitSize == 32 ? Mips::FILL_W
1132 : (SplatBitSize == 64 ? Mips::FILL_D : 0));
1134 assert(FILLOp != 0 &&
"Unknown FILL Op for splat synthesis!");
1135 assert((!
ABI.IsO32() || (FILLOp != Mips::FILL_D)) &&
1136 "Attempting to use fill.d on MIPS32!");
1139 SDValue LoVal =
CurDAG->getTargetConstant(
Lo,
DL, SplatMVT);
1141 Res =
CurDAG->getMachineNode(ADDiuOp,
DL, SplatMVT, ZeroVal, LoVal);
1142 Res =
CurDAG->getMachineNode(FILLOp,
DL, ViaVecTy, SDValue(Res, 0));
1144 }
else if (SplatValue.
isSignedIntN(32) && SplatBitSize == 32) {
1149 SDValue ZeroVal =
CurDAG->getRegister(Mips::R0, MVT::i32);
1151 SDValue LoVal =
CurDAG->getTargetConstant(
Lo,
DL, MVT::i32);
1152 SDValue HiVal =
CurDAG->getTargetConstant(
Hi,
DL, MVT::i32);
1155 Res =
CurDAG->getMachineNode(Mips::LUi,
DL, MVT::i32, HiVal);
1158 Res =
CurDAG->getMachineNode(Mips::ORi,
DL, MVT::i32,
1159 Hi ? SDValue(Res, 0) : ZeroVal, LoVal);
1161 assert((
Hi ||
Lo) &&
"Zero case reached 32 bit case splat synthesis!");
1163 CurDAG->getMachineNode(Mips::FILL_W,
DL, MVT::v4i32, SDValue(Res, 0));
1165 }
else if (SplatValue.
isSignedIntN(32) && SplatBitSize == 64 &&
1166 (
ABI.IsN32() ||
ABI.IsN64())) {
1172 SDValue ZeroVal =
CurDAG->getRegister(Mips::R0, MVT::i32);
1174 SDValue LoVal =
CurDAG->getTargetConstant(
Lo,
DL, MVT::i32);
1175 SDValue HiVal =
CurDAG->getTargetConstant(
Hi,
DL, MVT::i32);
1178 Res =
CurDAG->getMachineNode(Mips::LUi,
DL, MVT::i32, HiVal);
1181 Res =
CurDAG->getMachineNode(Mips::ORi,
DL, MVT::i32,
1182 Hi ? SDValue(Res, 0) : ZeroVal, LoVal);
1184 Res =
CurDAG->getMachineNode(
1185 Mips::SUBREG_TO_REG,
DL, MVT::i64, SDValue(Res, 0),
1186 CurDAG->getTargetConstant(Mips::sub_32,
DL, MVT::i64));
1189 CurDAG->getMachineNode(Mips::FILL_D,
DL, MVT::v2i64, SDValue(Res, 0));
1222 SDValue LoVal =
CurDAG->getTargetConstant(
Lo,
DL, MVT::i32);
1223 SDValue HiVal =
CurDAG->getTargetConstant(
Hi,
DL, MVT::i32);
1224 SDValue HigherVal =
CurDAG->getTargetConstant(Higher,
DL, MVT::i32);
1225 SDValue HighestVal =
CurDAG->getTargetConstant(Highest,
DL, MVT::i32);
1226 SDValue ZeroVal =
CurDAG->getRegister(Mips::R0, MVT::i32);
1245 Res =
CurDAG->getMachineNode(Mips::LUi,
DL, MVT::i32, HiVal);
1248 Res =
CurDAG->getMachineNode(Mips::ORi,
DL, MVT::i32,
1249 Hi ? SDValue(Res, 0) : ZeroVal, LoVal);
1253 HiRes =
CurDAG->getMachineNode(Mips::LUi,
DL, MVT::i32, HighestVal);
1256 HiRes =
CurDAG->getMachineNode(Mips::ORi,
DL, MVT::i32,
1257 Highest ? SDValue(HiRes, 0) : ZeroVal,
1262 Res =
CurDAG->getMachineNode(Mips::FILL_W,
DL, MVT::v4i32,
1263 (
Hi ||
Lo) ? SDValue(Res, 0) : ZeroVal);
1265 Res =
CurDAG->getMachineNode(
1266 Mips::INSERT_W,
DL, MVT::v4i32, SDValue(Res, 0),
1267 (Highest || Higher) ? SDValue(HiRes, 0) : ZeroVal,
1268 CurDAG->getTargetConstant(1,
DL, MVT::i32));
1274 Res =
CurDAG->getMachineNode(
1275 Mips::COPY_TO_REGCLASS,
DL, ViaVecTy, SDValue(Res, 0),
1278 Res =
CurDAG->getMachineNode(
1279 Mips::SPLATI_D,
DL, MVT::v2i64, SDValue(Res, 0),
1280 CurDAG->getTargetConstant(0,
DL, MVT::i32));
1281 }
else if (
ABI.IsN64() ||
ABI.IsN32()) {
1283 SDValue Zero64Val =
CurDAG->getRegister(Mips::R0_64, MVT::i64);
1284 const bool HiResNonZero = Highest || Higher;
1285 const bool ResNonZero =
Hi ||
Lo;
1288 HiRes =
CurDAG->getMachineNode(
1289 Mips::SUBREG_TO_REG,
DL, MVT::i64, SDValue(HiRes, 0),
1290 CurDAG->getTargetConstant(Mips::sub_32,
DL, MVT::i64));
1293 Res =
CurDAG->getMachineNode(
1294 Mips::SUBREG_TO_REG,
DL, MVT::i64, SDValue(Res, 0),
1295 CurDAG->getTargetConstant(Mips::sub_32,
DL, MVT::i64));
1305 IntegerType *Int32Ty =
1307 const ConstantInt *Const32 = ConstantInt::get(Int32Ty, 32);
1308 SDValue
Ops[4] = {HiResNonZero ? SDValue(HiRes, 0) : Zero64Val,
1313 Res =
CurDAG->getMachineNode(Mips::DINSU,
DL, MVT::i64,
Ops);
1314 }
else if (HiResNonZero) {
1315 Res =
CurDAG->getMachineNode(
1316 Mips::DSLL32,
DL, MVT::i64, SDValue(HiRes, 0),
1317 CurDAG->getTargetConstant(0,
DL, MVT::i32));
1320 "Zero splat value handled by non-zero 64bit splat synthesis!");
1322 Res =
CurDAG->getMachineNode(Mips::FILL_D,
DL, MVT::v2i64,
1330 if (ResVecTy != ViaVecTy) {
1338 Res =
CurDAG->getMachineNode(Mips::COPY_TO_REGCLASS,
DL,
1339 ResVecTy, SDValue(Res, 0),
1353bool MipsSEDAGToDAGISel::SelectInlineAsmMemoryOperand(
1355 std::vector<SDValue> &OutOps) {
1358 switch(ConstraintID) {
1365 OutOps.push_back(
Base);
1366 OutOps.push_back(
Offset);
1369 OutOps.push_back(
Op);
1370 OutOps.push_back(
CurDAG->getTargetConstant(0, SDLoc(
Op), MVT::i32));
1379 OutOps.push_back(
Base);
1380 OutOps.push_back(
Offset);
1383 OutOps.push_back(
Op);
1384 OutOps.push_back(
CurDAG->getTargetConstant(0, SDLoc(
Op), MVT::i32));
1392 OutOps.push_back(
Base);
1393 OutOps.push_back(
Offset);
1399 OutOps.push_back(
Base);
1400 OutOps.push_back(
Offset);
1405 OutOps.push_back(
Base);
1406 OutOps.push_back(
Offset);
1410 OutOps.push_back(
Op);
1411 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[]
MachineRegisterInfo & MRI
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)
MipsSEISelDAGPass(MipsTargetMachine &TM, CodeGenOptLevel OptLevel)
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.
SelectionDAGISelPass(std::unique_ptr< SelectionDAGISel > Selector)
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.
FunctionPass * createMipsSEISelDAGLegacyPass(MipsTargetMachine &TM, CodeGenOptLevel OptLevel)
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
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.