56 #define DEBUG_TYPE "legalizedag" 62 struct FloatSignAsInt {
85 class SelectionDAGLegalize {
97 EVT getSetCCResultType(
EVT VT)
const {
108 LegalizedNodes(LegalizedNodes), UpdatedNodes(UpdatedNodes) {}
111 void LegalizeOp(
SDNode *Node);
116 void LegalizeLoadOps(
SDNode *Node);
117 void LegalizeStoreOps(
SDNode *Node);
137 bool &NeedInvert,
const SDLoc &dl);
141 unsigned NumOps,
bool isSigned,
const SDLoc &dl);
144 SDNode *Node,
bool isSigned);
162 void ExpandDYNAMIC_STACKALLOC(
SDNode *Node,
164 void getSignAsIntValue(FloatSignAsInt &State,
const SDLoc &DL,
166 SDValue modifySignAsInt(
const FloatSignAsInt &State,
const SDLoc &DL,
189 bool ExpandNode(
SDNode *Node);
190 void ConvertNodeToLibcall(
SDNode *Node);
191 void PromoteNode(
SDNode *Node);
197 LegalizedNodes.
erase(N);
204 dbgs() <<
" with: "; New->
dump(&DAG));
207 "Replacing one node with another that produces a different number " 211 UpdatedNodes->
insert(New);
217 dbgs() <<
" with: "; New->
dump(&DAG));
229 for (
unsigned i = 0, e = Old->
getNumValues(); i != e; ++i) {
233 UpdatedNodes->
insert(New[i].getNode());
245 SDValue SelectionDAGLegalize::ShuffleWithNarrowerEltType(
250 unsigned NumEltsGrowth = NumDestElts / NumMaskElts;
252 assert(NumEltsGrowth &&
"Cannot promote to vector type with fewer elts!");
254 if (NumEltsGrowth == 1)
255 return DAG.getVectorShuffle(NVT, dl, N1, N2, Mask);
258 for (
unsigned i = 0; i != NumMaskElts; ++i) {
260 for (
unsigned j = 0; j != NumEltsGrowth; ++j) {
264 NewMask.
push_back(Idx * NumEltsGrowth + j);
267 assert(NewMask.
size() == NumDestElts &&
"Non-integer NumEltsGrowth?");
268 assert(TLI.isShuffleMaskLegal(NewMask, NVT) &&
"Shuffle not legal?");
269 return DAG.getVectorShuffle(NVT, dl, N1, N2, NewMask);
306 TLI.ShouldShrinkFPConstant(OrigVT)) {
316 DAG.getConstantPool(LLVMC, TLI.getPointerTy(DAG.getDataLayout()));
317 unsigned Alignment = cast<ConstantPoolSDNode>(CPIdx)->
getAlignment();
326 OrigVT, dl, DAG.getEntryNode(), CPIdx,
336 TLI.getPointerTy(DAG.getDataLayout()));
337 unsigned Alignment = cast<ConstantPoolSDNode>(CPIdx)->
getAlignment();
339 VT, dl, DAG.getEntryNode(), CPIdx,
348 SDValue SelectionDAGLegalize::PerformInsertVectorEltInMemory(
SDValue Vec,
364 SDValue StackPtr = DAG.CreateStackTemporary(VT);
366 int SPFI = cast<FrameIndexSDNode>(StackPtr.
getNode())->getIndex();
370 DAG.getEntryNode(), dl, Tmp1, StackPtr,
373 SDValue StackPtr2 = TLI.getVectorElementPointer(DAG, StackPtr, VT, Tmp3);
379 DAG.getMachineFunction(), SPFI));
400 for (
unsigned i = 0; i != NumElts; ++i)
401 ShufOps.
push_back(i != InsertPos->getZExtValue() ? i : NumElts);
403 return DAG.getVectorShuffle(Vec.
getValueType(), dl, Vec, ScVec, ShufOps);
406 return PerformInsertVectorEltInMemory(Vec, Val, Idx, dl);
428 bitcastToAPInt().zextOrTrunc(32),
430 return DAG.getStore(Chain, dl, Con, Ptr, ST->
getPointerInfo(), Alignment,
440 Alignment, MMOFlags, AAInfo);
450 if (DAG.getDataLayout().isBigEndian())
453 Lo = DAG.getStore(Chain, dl, Lo, Ptr, ST->
getPointerInfo(), Alignment,
457 Hi = DAG.getStore(Chain, dl, Hi, Ptr,
459 MinAlign(Alignment, 4U), MMOFlags, AAInfo);
468 void SelectionDAGLegalize::LegalizeStoreOps(
SDNode *Node) {
480 if (
SDNode *OptStore = OptimizeFloatStore(ST).getNode()) {
481 ReplaceNode(ST, OptStore);
487 switch (TLI.getOperationAction(
ISD::STORE, VT)) {
496 if (!TLI.allowsMemoryAccess(*DAG.getContext(), DL, MemVT,
AS,
Align)) {
499 ReplaceNode(
SDValue(ST, 0), Result);
507 if (Res && Res !=
SDValue(Node, 0))
508 ReplaceNode(
SDValue(Node, 0), Res);
514 "Can only promote stores to same size type");
518 Alignment, MMOFlags, AAInfo);
519 ReplaceNode(
SDValue(Node, 0), Result);
530 auto &DL = DAG.getDataLayout();
538 Value = DAG.getZeroExtendInReg(Value, dl, StVT);
540 DAG.getTruncStore(Chain, dl, Value, Ptr, ST->
getPointerInfo(), NVT,
541 Alignment, MMOFlags, AAInfo);
542 ReplaceNode(
SDValue(Node, 0), Result);
543 }
else if (StWidth & (StWidth - 1)) {
546 unsigned RoundWidth = 1 <<
Log2_32(StWidth);
547 assert(RoundWidth < StWidth);
548 unsigned ExtraWidth = StWidth - RoundWidth;
549 assert(ExtraWidth < RoundWidth);
550 assert(!(RoundWidth % 8) && !(ExtraWidth % 8) &&
551 "Store size not an integral number of bytes!");
555 unsigned IncrementSize;
557 if (DL.isLittleEndian()) {
560 Lo = DAG.getTruncStore(Chain, dl, Value, Ptr, ST->
getPointerInfo(),
561 RoundVT, Alignment, MMOFlags, AAInfo);
564 IncrementSize = RoundWidth / 8;
566 DAG.getConstant(IncrementSize, dl,
570 DAG.getConstant(RoundWidth, dl,
572 Hi = DAG.getTruncStore(
575 MinAlign(Alignment, IncrementSize), MMOFlags, AAInfo);
582 DAG.getConstant(ExtraWidth, dl,
585 RoundVT, Alignment, MMOFlags, AAInfo);
588 IncrementSize = RoundWidth / 8;
590 DAG.getConstant(IncrementSize, dl,
592 Lo = DAG.getTruncStore(
593 Chain, dl, Value, Ptr,
595 MinAlign(Alignment, IncrementSize), MMOFlags, AAInfo);
600 ReplaceNode(
SDValue(Node, 0), Result);
610 if (!TLI.allowsMemoryAccess(*DAG.getContext(), DL, MemVT,
AS,
Align)) {
612 ReplaceNode(
SDValue(ST, 0), Result);
618 if (Res && Res !=
SDValue(Node, 0))
619 ReplaceNode(
SDValue(Node, 0), Res);
624 "Vector Stores are handled in LegalizeVectorOps");
629 if (TLI.isTypeLegal(StVT)) {
631 Result = DAG.getStore(Chain, dl, Value, Ptr, ST->
getPointerInfo(),
632 Alignment, MMOFlags, AAInfo);
637 TLI.getTypeToTransformTo(*DAG.getContext(), StVT),
639 Result = DAG.getTruncStore(Chain, dl, Value, Ptr, ST->
getPointerInfo(),
640 StVT, Alignment, MMOFlags, AAInfo);
643 ReplaceNode(
SDValue(Node, 0), Result);
649 void SelectionDAGLegalize::LegalizeLoadOps(
SDNode *Node) {
658 LLVM_DEBUG(
dbgs() <<
"Legalizing non-extending load operation\n");
663 switch (TLI.getOperationAction(Node->
getOpcode(), VT)) {
672 if (!TLI.allowsMemoryAccess(*DAG.getContext(), DL, MemVT,
AS,
Align)) {
673 std::tie(RVal, RChain) = TLI.expandUnalignedLoad(LD, DAG);
678 if (
SDValue Res = TLI.LowerOperation(RVal, DAG)) {
685 MVT NVT = TLI.getTypeToPromoteTo(Node->
getOpcode(), VT);
687 "Can only promote loads to same size type");
695 if (RChain.
getNode() != Node) {
696 assert(RVal.
getNode() != Node &&
"Load must be completely replaced");
697 DAG.ReplaceAllUsesOfValueWith(
SDValue(Node, 0), RVal);
698 DAG.ReplaceAllUsesOfValueWith(
SDValue(Node, 1), RChain);
700 UpdatedNodes->insert(RVal.
getNode());
701 UpdatedNodes->insert(RChain.
getNode());
739 DAG.getExtLoad(NewExtType, dl, Node->
getValueType(0), Chain, Ptr,
757 }
else if (SrcWidth & (SrcWidth - 1)) {
760 unsigned RoundWidth = 1 <<
Log2_32(SrcWidth);
761 assert(RoundWidth < SrcWidth);
762 unsigned ExtraWidth = SrcWidth - RoundWidth;
763 assert(ExtraWidth < RoundWidth);
764 assert(!(RoundWidth % 8) && !(ExtraWidth % 8) &&
765 "Load size not an integral number of bytes!");
769 unsigned IncrementSize;
770 auto &DL = DAG.getDataLayout();
772 if (DL.isLittleEndian()) {
780 IncrementSize = RoundWidth / 8;
781 Ptr = DAG.getNode(
ISD::ADD, dl, Ptr.getValueType(), Ptr,
782 DAG.getConstant(IncrementSize, dl,
783 Ptr.getValueType()));
784 Hi = DAG.getExtLoad(ExtType, dl, Node->
getValueType(0), Chain, Ptr,
786 ExtraVT,
MinAlign(Alignment, IncrementSize), MMOFlags,
797 DAG.getConstant(RoundWidth, dl,
798 TLI.getShiftAmountTy(Hi.getValueType(), DL)));
806 Hi = DAG.getExtLoad(ExtType, dl, Node->
getValueType(0), Chain, Ptr,
811 IncrementSize = RoundWidth / 8;
812 Ptr = DAG.getNode(
ISD::ADD, dl, Ptr.getValueType(), Ptr,
813 DAG.getConstant(IncrementSize, dl,
814 Ptr.getValueType()));
817 ExtraVT,
MinAlign(Alignment, IncrementSize), MMOFlags,
828 DAG.getConstant(ExtraWidth, dl,
829 TLI.getShiftAmountTy(Hi.getValueType(), DL)));
837 bool isCustom =
false;
838 switch (TLI.getLoadExtAction(ExtType, Node->
getValueType(0),
860 if (!TLI.allowsMemoryAccess(*DAG.getContext(), DL, MemVT,
AS,
Align)) {
861 std::tie(Value, Chain) = TLI.expandUnalignedLoad(LD, DAG);
872 if (TLI.isTypeLegal(SrcVT) ||
873 TLI.isLoadExtLegal(ExtType, LoadVT, SrcVT)) {
879 SDValue Load = DAG.getExtLoad(MidExtType, dl, LoadVT, Chain, Ptr,
907 "Vector Loads are handled in LegalizeVectorOps");
914 "EXTLOAD should always be supported!");
927 ValRes = DAG.getZeroExtendInReg(Result, dl, SrcVT.getScalarType());
937 if (Chain.getNode() != Node) {
938 assert(Value.
getNode() != Node &&
"Load must be completely replaced");
939 DAG.ReplaceAllUsesOfValueWith(
SDValue(Node, 0), Value);
940 DAG.ReplaceAllUsesOfValueWith(
SDValue(Node, 1), Chain);
942 UpdatedNodes->insert(Value.
getNode());
943 UpdatedNodes->insert(Chain.getNode());
950 void SelectionDAGLegalize::LegalizeOp(
SDNode *Node) {
959 for (
unsigned i = 0, e = Node->
getNumValues(); i != e; ++i)
963 "Unexpected illegal type!");
966 assert((TLI.getTypeAction(*DAG.getContext(),
Op.getValueType()) ==
968 TLI.isTypeLegal(
Op.getValueType()) ||
971 "Unexpected illegal type!");
976 bool SimpleFinishLegalizing =
true;
985 Action = TLI.getOperationAction(Node->
getOpcode(),
989 Action = TLI.getOperationAction(Node->
getOpcode(),
998 Action = TLI.getOperationAction(Node->
getOpcode(),
1003 EVT InnerType = cast<VTSDNode>(Node->
getOperand(1))->getVT();
1004 Action = TLI.getOperationAction(Node->
getOpcode(), InnerType);
1008 Action = TLI.getOperationAction(Node->
getOpcode(),
1019 cast<CondCodeSDNode>(Node->
getOperand(CCOperand))->
get();
1020 Action = TLI.getCondCodeAction(CCCode, OpVT);
1023 Action = TLI.getOperationAction(Node->
getOpcode(),
1026 Action = TLI.getOperationAction(Node->
getOpcode(), OpVT);
1034 SimpleFinishLegalizing =
false;
1041 SimpleFinishLegalizing =
false;
1088 ReplaceNode(Node, NewVal.
getNode());
1114 Action = TLI.getStrictFPOperationAction(Node->
getOpcode(),
1126 if (SimpleFinishLegalizing) {
1147 NewNode = DAG.UpdateNodeOperands(Node, Op0, SAO);
1165 NewNode = DAG.UpdateNodeOperands(Node, Op0, Op1, SAO);
1171 if (NewNode != Node) {
1172 ReplaceNode(Node, NewNode);
1184 if (!(Res.getNode() != Node || Res.getResNo() != 0))
1190 ReplaceNode(
SDValue(Node, 0), Res);
1195 for (
unsigned i = 0, e = Node->
getNumValues(); i != e; ++i)
1198 ReplaceNode(Node, ResultVals.
data());
1204 if (ExpandNode(Node))
1208 ConvertNodeToLibcall(Node);
1229 return LegalizeLoadOps(Node);
1231 return LegalizeStoreOps(Node);
1235 SDValue SelectionDAGLegalize::ExpandExtractFromVectorThroughStack(
SDValue Op) {
1255 if (
StoreSDNode *ST = dyn_cast<StoreSDNode>(User)) {
1284 StackPtr = DAG.CreateStackTemporary(VecVT);
1285 Ch = DAG.getStore(DAG.getEntryNode(), dl, Vec, StackPtr,
1289 StackPtr = TLI.getVectorElementPointer(DAG, StackPtr, VecVT, Idx);
1302 DAG.ReplaceAllUsesOfValueWith(Ch,
SDValue(NewLoad.
getNode(), 1));
1308 NewLoadOperands[0] = Ch;
1310 SDValue(DAG.UpdateNodeOperands(NewLoad.
getNode(), NewLoadOperands), 0);
1314 SDValue SelectionDAGLegalize::ExpandInsertToVectorThroughStack(
SDValue Op) {
1323 EVT VecVT = Vec.getValueType();
1324 SDValue StackPtr = DAG.CreateStackTemporary(VecVT);
1325 int FI = cast<FrameIndexSDNode>(StackPtr.
getNode())->getIndex();
1330 SDValue Ch = DAG.getStore(DAG.getEntryNode(), dl, Vec, StackPtr, PtrInfo);
1333 SDValue SubStackPtr = TLI.getVectorElementPointer(DAG, StackPtr, VecVT, Idx);
1339 return DAG.getLoad(Op.
getValueType(), dl, Ch, StackPtr, PtrInfo);
1342 SDValue SelectionDAGLegalize::ExpandVectorBuildThroughStack(
SDNode* Node) {
1350 SDValue FIPtr = DAG.CreateStackTemporary(VT);
1351 int FI = cast<FrameIndexSDNode>(FIPtr.
getNode())->getIndex();
1363 unsigned Offset = TypeByteSize*i;
1371 Stores.push_back(DAG.getTruncStore(DAG.getEntryNode(), dl,
1375 Stores.push_back(DAG.getStore(DAG.getEntryNode(), dl, Node->
getOperand(i),
1380 if (!Stores.empty())
1383 StoreChain = DAG.getEntryNode();
1386 return DAG.getLoad(VT, dl, StoreChain, FIPtr, PtrInfo);
1392 void SelectionDAGLegalize::getSignAsIntValue(FloatSignAsInt &State,
1397 State.FloatVT = FloatVT;
1400 if (TLI.isTypeLegal(IVT)) {
1401 State.IntValue = DAG.getNode(
ISD::BITCAST, DL, IVT, Value);
1403 State.SignBit = NumBits - 1;
1409 MVT LoadTy = TLI.getRegisterType(*DAG.getContext(),
MVT::i8);
1411 SDValue StackPtr = DAG.CreateStackTemporary(FloatVT, LoadTy);
1412 int FI = cast<FrameIndexSDNode>(StackPtr.
getNode())->getIndex();
1414 State.FloatPtr = StackPtr;
1417 State.Chain = DAG.getStore(DAG.getEntryNode(), DL, Value, State.FloatPtr,
1418 State.FloatPointerInfo);
1425 State.IntPointerInfo = State.FloatPointerInfo;
1430 DAG.getConstant(ByteOffset, DL, StackPtr.
getValueType()));
1435 State.IntPtr = IntPtr;
1436 State.IntValue = DAG.getExtLoad(
ISD::EXTLOAD, DL, LoadTy, State.Chain, IntPtr,
1437 State.IntPointerInfo,
MVT::i8);
1444 SDValue SelectionDAGLegalize::modifySignAsInt(
const FloatSignAsInt &State,
1451 SDValue Chain = DAG.getTruncStore(State.Chain, DL, NewIntValue, State.IntPtr,
1452 State.IntPointerInfo,
MVT::i8);
1453 return DAG.getLoad(State.FloatVT, DL, Chain, State.FloatPtr,
1454 State.FloatPointerInfo);
1457 SDValue SelectionDAGLegalize::ExpandFCOPYSIGN(
SDNode *Node)
const {
1463 FloatSignAsInt SignAsInt;
1464 getSignAsIntValue(SignAsInt, DL, Sign);
1466 EVT IntVT = SignAsInt.IntValue.getValueType();
1467 SDValue SignMask = DAG.getConstant(SignAsInt.SignMask, DL, IntVT);
1473 if (TLI.isOperationLegalOrCustom(
ISD::FABS, FloatVT) &&
1474 TLI.isOperationLegalOrCustom(
ISD::FNEG, FloatVT)) {
1477 SDValue Cond = DAG.getSetCC(DL, getSetCCResultType(IntVT), SignBit,
1479 return DAG.getSelect(DL, FloatVT, Cond, NegValue, AbsValue);
1483 FloatSignAsInt MagAsInt;
1484 getSignAsIntValue(MagAsInt, DL, Mag);
1485 EVT MagVT = MagAsInt.IntValue.getValueType();
1486 SDValue ClearSignMask = DAG.getConstant(~MagAsInt.SignMask, DL, MagVT);
1491 int ShiftAmount = SignAsInt.SignBit - MagAsInt.SignBit;
1492 EVT ShiftVT = IntVT;
1497 if (ShiftAmount > 0) {
1498 SDValue ShiftCnst = DAG.getConstant(ShiftAmount, DL, ShiftVT);
1500 }
else if (ShiftAmount < 0) {
1501 SDValue ShiftCnst = DAG.getConstant(-ShiftAmount, DL, ShiftVT);
1510 return modifySignAsInt(MagAsInt, DL, CopiedSign);
1513 SDValue SelectionDAGLegalize::ExpandFABS(
SDNode *Node)
const {
1520 SDValue Zero = DAG.getConstantFP(0.0, DL, FloatVT);
1525 FloatSignAsInt ValueAsInt;
1526 getSignAsIntValue(ValueAsInt, DL, Value);
1527 EVT IntVT = ValueAsInt.IntValue.getValueType();
1528 SDValue ClearSignMask = DAG.getConstant(~ValueAsInt.SignMask, DL, IntVT);
1531 return modifySignAsInt(ValueAsInt, DL, ClearedSign);
1534 void SelectionDAGLegalize::ExpandDYNAMIC_STACKALLOC(
SDNode* Node,
1536 unsigned SPReg = TLI.getStackPointerRegisterToSaveRestore();
1537 assert(SPReg &&
"Target cannot require DYNAMIC_STACKALLOC expansion and" 1538 " not tell us which reg is the stack pointer!");
1548 Chain = DAG.getCALLSEQ_START(Chain, 0, 0, dl);
1551 SDValue SP = DAG.getCopyFromReg(Chain, dl, SPReg, VT);
1553 unsigned Align = cast<ConstantSDNode>(Tmp3)->getZExtValue();
1554 unsigned StackAlign =
1555 DAG.getSubtarget().getFrameLowering()->getStackAlignment();
1557 if (Align > StackAlign)
1559 DAG.getConstant(-(uint64_t)Align, dl, VT));
1560 Chain = DAG.getCopyToReg(Chain, dl, SPReg, Tmp1);
1562 Tmp2 = DAG.getCALLSEQ_END(Chain, DAG.getIntPtrConstant(0, dl,
true),
1563 DAG.getIntPtrConstant(0, dl,
true),
SDValue(), dl);
1587 bool SelectionDAGLegalize::LegalizeSetCCCondCode(
EVT VT,
SDValue &LHS,
1594 bool NeedSwap =
false;
1595 switch (TLI.getCondCodeAction(CCCode, OpVT)) {
1602 if (TLI.isCondCodeLegalOrCustom(InvCC, OpVT)) {
1604 CC = DAG.getCondCode(InvCC);
1609 if (!TLI.isCondCodeLegalOrCustom(InvCC, OpVT)) {
1615 if (TLI.isCondCodeLegalOrCustom(InvCC, OpVT)) {
1616 CC = DAG.getCondCode(InvCC);
1629 &&
"If SETO is expanded, SETOEQ must be legal!");
1633 &&
"If SETUO is expanded, SETUNE must be legal!");
1673 SetCC1 = DAG.getSetCC(dl, VT, LHS, RHS, CC1);
1674 SetCC2 = DAG.getSetCC(dl, VT, LHS, RHS, CC2);
1677 SetCC1 = DAG.getSetCC(dl, VT, LHS, LHS, CC1);
1678 SetCC2 = DAG.getSetCC(dl, VT, RHS, RHS, CC2);
1680 LHS = DAG.
getNode(Opc, dl, VT, SetCC1, SetCC2);
1696 unsigned SrcAlign = DAG.getDataLayout().getPrefTypeAlignment(
1698 SDValue FIPtr = DAG.CreateStackTemporary(SlotVT, SrcAlign);
1709 unsigned DestAlign = DAG.getDataLayout().getPrefTypeAlignment(DestType);
1715 if (SrcSize > SlotSize)
1716 Store = DAG.getTruncStore(DAG.getEntryNode(), dl, SrcOp, FIPtr, PtrInfo,
1719 assert(SrcSize == SlotSize &&
"Invalid store");
1721 DAG.getStore(DAG.getEntryNode(), dl, SrcOp, FIPtr, PtrInfo, SrcAlign);
1725 if (SlotSize == DestSize)
1726 return DAG.getLoad(DestVT, dl, Store, FIPtr, PtrInfo, DestAlign);
1728 assert(SlotSize < DestSize &&
"Unknown extension!");
1729 return DAG.getExtLoad(
ISD::EXTLOAD, dl, DestVT, Store, FIPtr, PtrInfo, SlotVT,
1733 SDValue SelectionDAGLegalize::ExpandSCALAR_TO_VECTOR(
SDNode *Node) {
1742 SDValue Ch = DAG.getTruncStore(
1743 DAG.getEntryNode(), dl, Node->
getOperand(0), StackPtr,
1768 for (
unsigned i = 0; i < NumElems; ++i) {
1779 while (IntermedVals.
size() > 2) {
1780 NewIntermedVals.
clear();
1781 for (
unsigned i = 0, e = (IntermedVals.
size() & ~1u); i < e; i += 2) {
1788 IntermedVals[i+1].second.
size());
1791 for (
unsigned j = 0, f = IntermedVals[i].
second.size(); j != f;
1796 for (
unsigned j = 0, f = IntermedVals[i+1].
second.size(); j != f;
1798 ShuffleVec[k] = NumElems + j;
1805 IntermedVals[i+1].first,
1810 std::make_pair(Shuffle, std::move(FinalIndices)));
1815 if ((IntermedVals.
size() & 1) != 0)
1818 IntermedVals.
swap(NewIntermedVals);
1822 "Invalid number of intermediate vectors");
1823 SDValue Vec1 = IntermedVals[0].first;
1825 if (IntermedVals.
size() > 1)
1826 Vec2 = IntermedVals[1].
first;
1831 for (
unsigned i = 0, e = IntermedVals[0].
second.size(); i != e; ++i)
1832 ShuffleVec[IntermedVals[0].
second[i]] = i;
1833 for (
unsigned i = 0, e = IntermedVals[1].
second.size(); i != e; ++i)
1834 ShuffleVec[IntermedVals[1].
second[i]] = NumElems + i;
1847 SDValue SelectionDAGLegalize::ExpandBUILD_VECTOR(
SDNode *Node) {
1857 bool isOnlyLowElement =
true;
1858 bool MoreThanTwoValues =
false;
1860 for (
unsigned i = 0; i < NumElems; ++i) {
1865 isOnlyLowElement =
false;
1866 if (!isa<ConstantFPSDNode>(V) && !isa<ConstantSDNode>(V))
1871 }
else if (!Value2.
getNode()) {
1874 }
else if (V != Value1 && V != Value2) {
1875 MoreThanTwoValues =
true;
1880 return DAG.getUNDEF(VT);
1882 if (isOnlyLowElement)
1888 for (
unsigned i = 0, e = NumElems; i != e; ++i) {
1890 dyn_cast<ConstantFPSDNode>(Node->
getOperand(i))) {
1891 CV.
push_back(const_cast<ConstantFP *>(V->getConstantFPValue()));
1893 dyn_cast<ConstantSDNode>(Node->
getOperand(i))) {
1895 CV.
push_back(const_cast<ConstantInt *>(V->getConstantIntValue()));
1912 DAG.getConstantPool(CP, TLI.getPointerTy(DAG.getDataLayout()));
1913 unsigned Alignment = cast<ConstantPoolSDNode>(CPIdx)->
getAlignment();
1915 VT, dl, DAG.getEntryNode(), CPIdx,
1921 for (
unsigned i = 0; i < NumElems; ++i) {
1927 if (TLI.shouldExpandBuildVectorWithShuffles(VT, DefinedValues.
size())) {
1928 if (!MoreThanTwoValues) {
1930 for (
unsigned i = 0; i < NumElems; ++i) {
1934 ShuffleVec[i] = V == Value1 ? 0 : NumElems;
1936 if (TLI.isShuffleMaskLegal(ShuffleVec, Node->
getValueType(0))) {
1943 Vec2 = DAG.getUNDEF(VT);
1946 return DAG.getVectorShuffle(VT, dl, Vec1, Vec2, ShuffleVec);
1956 return ExpandVectorBuildThroughStack(Node);
1966 TargetLowering::ArgListEntry Entry;
1972 Entry.IsSExt = TLI.shouldSignExtendTypeInLibCall(ArgVT, isSigned);
1973 Entry.IsZExt = !TLI.shouldSignExtendTypeInLibCall(ArgVT, isSigned);
1974 Args.push_back(Entry);
1976 SDValue Callee = DAG.getExternalSymbol(TLI.getLibcallName(LC),
1977 TLI.getPointerTy(DAG.getDataLayout()));
1986 SDValue InChain = DAG.getEntryNode();
1991 const Function &
F = DAG.getMachineFunction().getFunction();
1993 TLI.isInTailCallPosition(DAG, Node, TCChain) &&
1999 bool signExtend = TLI.shouldSignExtendTypeInLibCall(RetVT, isSigned);
2004 .setTailCall(isTailCall)
2009 std::pair<SDValue, SDValue>
CallInfo = TLI.LowerCallTo(CLI);
2011 if (!CallInfo.second.getNode()) {
2012 LLVM_DEBUG(
dbgs() <<
"Created tailcall: "; DAG.getRoot().dump());
2014 return DAG.getRoot();
2017 LLVM_DEBUG(
dbgs() <<
"Created libcall: "; CallInfo.first.dump());
2018 return CallInfo.first;
2024 const SDValue *Ops,
unsigned NumOps,
2025 bool isSigned,
const SDLoc &dl) {
2027 Args.reserve(NumOps);
2029 TargetLowering::ArgListEntry Entry;
2030 for (
unsigned i = 0; i != NumOps; ++i) {
2031 Entry.Node = Ops[i];
2035 Args.push_back(Entry);
2037 SDValue Callee = DAG.getExternalSymbol(TLI.getLibcallName(LC),
2038 TLI.getPointerTy(DAG.getDataLayout()));
2045 .setLibCallee(TLI.getLibcallCallingConv(LC), RetTy,
Callee,
2047 .setSExtResult(isSigned)
2051 std::pair<SDValue,SDValue>
CallInfo = TLI.LowerCallTo(CLI);
2053 return CallInfo.first;
2058 std::pair<SDValue, SDValue>
2065 TargetLowering::ArgListEntry Entry;
2073 Args.push_back(Entry);
2075 SDValue Callee = DAG.getExternalSymbol(TLI.getLibcallName(LC),
2076 TLI.getPointerTy(DAG.getDataLayout()));
2085 .setSExtResult(isSigned)
2088 std::pair<SDValue, SDValue>
CallInfo = TLI.LowerCallTo(CLI);
2100 Node = DAG.mutateStrictFPToFP(Node);
2105 case MVT::f32: LC = Call_F32;
break;
2106 case MVT::f64: LC = Call_F64;
break;
2107 case MVT::f80: LC = Call_F80;
break;
2111 return ExpandLibCall(LC, Node,
false);
2114 SDValue SelectionDAGLegalize::ExpandIntLibCall(
SDNode* Node,
bool isSigned,
2123 case MVT::i8: LC = Call_I8;
break;
2124 case MVT::i16: LC = Call_I16;
break;
2125 case MVT::i32: LC = Call_I32;
break;
2126 case MVT::i64: LC = Call_I64;
break;
2129 return ExpandLibCall(LC, Node, isSigned);
2134 SelectionDAGLegalize::ExpandDivRemLibCall(
SDNode *Node,
2142 case MVT::i8: LC= isSigned ? RTLIB::SDIVREM_I8 : RTLIB::UDIVREM_I8;
break;
2143 case MVT::i16: LC= isSigned ? RTLIB::SDIVREM_I16 : RTLIB::UDIVREM_I16;
break;
2144 case MVT::i32: LC= isSigned ? RTLIB::SDIVREM_I32 : RTLIB::UDIVREM_I32;
break;
2145 case MVT::i64: LC= isSigned ? RTLIB::SDIVREM_I64 : RTLIB::UDIVREM_I64;
break;
2146 case MVT::i128: LC= isSigned ? RTLIB::SDIVREM_I128:RTLIB::UDIVREM_I128;
break;
2152 SDValue InChain = DAG.getEntryNode();
2158 TargetLowering::ArgListEntry Entry;
2166 Args.push_back(Entry);
2170 SDValue FIPtr = DAG.CreateStackTemporary(RetVT);
2175 Args.push_back(Entry);
2177 SDValue Callee = DAG.getExternalSymbol(TLI.getLibcallName(LC),
2178 TLI.getPointerTy(DAG.getDataLayout()));
2186 .setSExtResult(isSigned)
2189 std::pair<SDValue, SDValue>
CallInfo = TLI.LowerCallTo(CLI);
2203 case MVT::f32: LC = RTLIB::SINCOS_F32;
break;
2204 case MVT::f64: LC = RTLIB::SINCOS_F64;
break;
2205 case MVT::f80: LC = RTLIB::SINCOS_F80;
break;
2206 case MVT::f128: LC = RTLIB::SINCOS_F128;
break;
2232 SelectionDAGLegalize::ExpandSinCosLibCall(
SDNode *Node,
2237 case MVT::f32: LC = RTLIB::SINCOS_F32;
break;
2238 case MVT::f64: LC = RTLIB::SINCOS_F64;
break;
2239 case MVT::f80: LC = RTLIB::SINCOS_F80;
break;
2240 case MVT::f128: LC = RTLIB::SINCOS_F128;
break;
2247 SDValue InChain = DAG.getEntryNode();
2253 TargetLowering::ArgListEntry Entry;
2258 Entry.IsSExt =
false;
2259 Entry.IsZExt =
false;
2260 Args.push_back(Entry);
2263 SDValue SinPtr = DAG.CreateStackTemporary(RetVT);
2264 Entry.Node = SinPtr;
2266 Entry.IsSExt =
false;
2267 Entry.IsZExt =
false;
2268 Args.push_back(Entry);
2271 SDValue CosPtr = DAG.CreateStackTemporary(RetVT);
2272 Entry.Node = CosPtr;
2274 Entry.IsSExt =
false;
2275 Entry.IsZExt =
false;
2276 Args.push_back(Entry);
2278 SDValue Callee = DAG.getExternalSymbol(TLI.getLibcallName(LC),
2279 TLI.getPointerTy(DAG.getDataLayout()));
2284 TLI.getLibcallCallingConv(LC),
Type::getVoidTy(*DAG.getContext()), Callee,
2287 std::pair<SDValue, SDValue>
CallInfo = TLI.LowerCallTo(CLI);
2299 SDValue SelectionDAGLegalize::ExpandLegalINT_TO_FP(
bool isSigned,
SDValue Op0,
2305 LLVM_DEBUG(
dbgs() <<
"32-bit [signed|unsigned] integer to float/double " 2312 SDValue WordOff = DAG.getConstant(
sizeof(
int), dl,
2317 StackSlot, WordOff);
2318 if (DAG.getDataLayout().isLittleEndian())
2331 SDValue Store1 = DAG.getStore(DAG.getEntryNode(), dl, Op0Mapped,
Lo,
2342 SDValue Bias = DAG.getConstantFP(isSigned ?
2356 DAG.getIntPtrConstant(0, dl));
2362 assert(!isSigned &&
"Legalize cannot Expand SINT_TO_FP for i64 yet");
2373 DAG.getConstant(UINT64_C(0x4330000000000000), dl,
MVT::i64);
2375 DAG.getConstantFP(
BitsToDouble(UINT64_C(0x4530000000100000)), dl,
2378 DAG.getConstant(UINT64_C(0x4530000000000000), dl,
MVT::i64);
2382 DAG.getConstant(32, dl,
MVT::i64));
2400 SDValue ShiftConst = DAG.getConstant(
2401 1, dl, TLI.getShiftAmountTy(Op0.
getValueType(), DAG.getDataLayout()));
2416 return DAG.getSelect(dl,
MVT::f32, SignBitTest, Slow, Fast);
2422 DAG.getConstant(UINT64_C(0xfffffffffffff800), dl,
MVT::i64));
2424 DAG.getConstant(UINT64_C(0x800), dl,
MVT::i64));
2426 DAG.getConstant(UINT64_C(0x7ff), dl,
MVT::i64));
2428 DAG.getConstant(UINT64_C(0), dl,
MVT::i64),
2432 DAG.getConstant(UINT64_C(0x0020000000000000), dl,
2436 EVT SHVT = TLI.getShiftAmountTy(Sel2.
getValueType(), DAG.getDataLayout());
2439 DAG.getConstant(32, dl, SHVT));
2443 DAG.getConstantFP(
BitsToDouble(UINT64_C(0x41f0000000000000)), dl,
2450 DAG.getIntPtrConstant(0, dl));
2459 SDValue Zero = DAG.getIntPtrConstant(0, dl),
2460 Four = DAG.getIntPtrConstant(4, dl);
2462 SignSet, Four, Zero);
2470 case MVT::i8 : FF = 0x43800000ULL;
break;
2471 case MVT::i16: FF = 0x47800000ULL;
break;
2472 case MVT::i32: FF = 0x4F800000ULL;
break;
2473 case MVT::i64: FF = 0x5F800000ULL;
break;
2475 if (DAG.getDataLayout().isLittleEndian())
2481 DAG.getConstantPool(FudgeFactor, TLI.getPointerTy(DAG.getDataLayout()));
2482 unsigned Alignment = cast<ConstantPoolSDNode>(CPIdx)->
getAlignment();
2484 Alignment = std::min(Alignment, 4u);
2487 FudgeInReg = DAG.getLoad(
2488 MVT::f32, dl, DAG.getEntryNode(), CPIdx,
2509 SDValue SelectionDAGLegalize::PromoteLegalINT_TO_FP(
SDValue LegalOp,
EVT DestVT,
2515 unsigned OpToUse = 0;
2527 if (isSigned)
continue;
2540 return DAG.getNode(OpToUse, dl, DestVT,
2542 dl, NewInTy, LegalOp));
2550 SDValue SelectionDAGLegalize::PromoteLegalFP_TO_INT(
SDValue LegalOp,
EVT DestVT,
2554 EVT NewOutTy = DestVT;
2556 unsigned OpToUse = 0;
2571 if (!isSigned && TLI.isOperationLegalOrCustom(
ISD::FP_TO_UINT, NewOutTy)) {
2590 EVT SHVT = TLI.getShiftAmountTy(VT, DAG.getDataLayout());
2600 APInt MaskHi4(Sz, 0), MaskHi2(Sz, 0), MaskHi1(Sz, 0);
2601 APInt MaskLo4(Sz, 0), MaskLo2(Sz, 0), MaskLo1(Sz, 0);
2602 for (
unsigned J = 0; J != Sz; J += 8) {
2603 MaskHi4 = MaskHi4 | (0xF0ull << J);
2604 MaskLo4 = MaskLo4 | (0x0Full << J);
2605 MaskHi2 = MaskHi2 | (0xCCull << J);
2606 MaskLo2 = MaskLo2 | (0x33ull << J);
2607 MaskHi1 = MaskHi1 | (0xAAull << J);
2608 MaskLo1 = MaskLo1 | (0x55ull << J);
2612 Tmp = (Sz > 8 ? DAG.getNode(
ISD::BSWAP, dl, VT, Op) :
Op);
2615 Tmp2 = DAG.
getNode(
ISD::AND, dl, VT, Tmp, DAG.getConstant(MaskHi4, dl, VT));
2616 Tmp3 = DAG.
getNode(
ISD::AND, dl, VT, Tmp, DAG.getConstant(MaskLo4, dl, VT));
2617 Tmp2 = DAG.
getNode(
ISD::SRL, dl, VT, Tmp2, DAG.getConstant(4, dl, VT));
2618 Tmp3 = DAG.
getNode(
ISD::SHL, dl, VT, Tmp3, DAG.getConstant(4, dl, VT));
2622 Tmp2 = DAG.
getNode(
ISD::AND, dl, VT, Tmp, DAG.getConstant(MaskHi2, dl, VT));
2623 Tmp3 = DAG.
getNode(
ISD::AND, dl, VT, Tmp, DAG.getConstant(MaskLo2, dl, VT));
2624 Tmp2 = DAG.
getNode(
ISD::SRL, dl, VT, Tmp2, DAG.getConstant(2, dl, VT));
2625 Tmp3 = DAG.
getNode(
ISD::SHL, dl, VT, Tmp3, DAG.getConstant(2, dl, VT));
2629 Tmp2 = DAG.
getNode(
ISD::AND, dl, VT, Tmp, DAG.getConstant(MaskHi1, dl, VT));
2630 Tmp3 = DAG.
getNode(
ISD::AND, dl, VT, Tmp, DAG.getConstant(MaskLo1, dl, VT));
2631 Tmp2 = DAG.
getNode(
ISD::SRL, dl, VT, Tmp2, DAG.getConstant(1, dl, VT));
2632 Tmp3 = DAG.
getNode(
ISD::SHL, dl, VT, Tmp3, DAG.getConstant(1, dl, VT));
2637 Tmp = DAG.getConstant(0, dl, VT);
2638 for (
unsigned I = 0, J = Sz-1;
I < Sz; ++
I, --J) {
2648 Tmp2 = DAG.
getNode(
ISD::AND, dl, VT, Tmp2, DAG.getConstant(Shift, dl, VT));
2658 EVT SHVT = TLI.getShiftAmountTy(VT, DAG.getDataLayout());
2659 SDValue Tmp1, Tmp2, Tmp3, Tmp4, Tmp5, Tmp6, Tmp7, Tmp8;
2663 Tmp2 = DAG.
getNode(
ISD::SHL, dl, VT, Op, DAG.getConstant(8, dl, SHVT));
2664 Tmp1 = DAG.
getNode(
ISD::SRL, dl, VT, Op, DAG.getConstant(8, dl, SHVT));
2665 return DAG.getNode(
ISD::OR, dl, VT, Tmp1, Tmp2);
2667 Tmp4 = DAG.
getNode(
ISD::SHL, dl, VT, Op, DAG.getConstant(24, dl, SHVT));
2668 Tmp3 = DAG.
getNode(
ISD::SHL, dl, VT, Op, DAG.getConstant(8, dl, SHVT));
2669 Tmp2 = DAG.
getNode(
ISD::SRL, dl, VT, Op, DAG.getConstant(8, dl, SHVT));
2670 Tmp1 = DAG.
getNode(
ISD::SRL, dl, VT, Op, DAG.getConstant(24, dl, SHVT));
2672 DAG.getConstant(0xFF0000, dl, VT));
2673 Tmp2 = DAG.
getNode(
ISD::AND, dl, VT, Tmp2, DAG.getConstant(0xFF00, dl, VT));
2676 return DAG.getNode(
ISD::OR, dl, VT, Tmp4, Tmp2);
2678 Tmp8 = DAG.
getNode(
ISD::SHL, dl, VT, Op, DAG.getConstant(56, dl, SHVT));
2679 Tmp7 = DAG.
getNode(
ISD::SHL, dl, VT, Op, DAG.getConstant(40, dl, SHVT));
2680 Tmp6 = DAG.
getNode(
ISD::SHL, dl, VT, Op, DAG.getConstant(24, dl, SHVT));
2681 Tmp5 = DAG.
getNode(
ISD::SHL, dl, VT, Op, DAG.getConstant(8, dl, SHVT));
2682 Tmp4 = DAG.
getNode(
ISD::SRL, dl, VT, Op, DAG.getConstant(8, dl, SHVT));
2683 Tmp3 = DAG.
getNode(
ISD::SRL, dl, VT, Op, DAG.getConstant(24, dl, SHVT));
2684 Tmp2 = DAG.
getNode(
ISD::SRL, dl, VT, Op, DAG.getConstant(40, dl, SHVT));
2685 Tmp1 = DAG.
getNode(
ISD::SRL, dl, VT, Op, DAG.getConstant(56, dl, SHVT));
2687 DAG.getConstant(255ULL<<48, dl, VT));
2689 DAG.getConstant(255ULL<<40, dl, VT));
2691 DAG.getConstant(255ULL<<32, dl, VT));
2693 DAG.getConstant(255ULL<<24, dl, VT));
2695 DAG.getConstant(255ULL<<16, dl, VT));
2697 DAG.getConstant(255ULL<<8 , dl, VT));
2704 return DAG.getNode(
ISD::OR, dl, VT, Tmp8, Tmp4);
2709 SDValue SelectionDAGLegalize::ExpandBitCount(
unsigned Opc,
SDValue Op,
2715 EVT ShVT = TLI.getShiftAmountTy(VT, DAG.getDataLayout());
2719 "CTPOP not implemented for this type.");
2737 DAG.getConstant(1, dl, ShVT)),
2741 DAG.getNode(
ISD::AND, dl, VT, Op, Mask33),
2744 DAG.getConstant(2, dl, ShVT)),
2750 DAG.getConstant(4, dl, ShVT))),
2754 DAG.getNode(
ISD::MUL, dl, VT, Op, Mask01),
2755 DAG.getConstant(Len - 8, dl, ShVT));
2767 EVT SetCCVT = getSetCCResultType(VT);
2769 SDValue Zero = DAG.getConstant(0, dl, VT);
2772 DAG.getConstant(Len, dl, VT),
CTLZ);
2784 EVT ShVT = TLI.getShiftAmountTy(VT, DAG.getDataLayout());
2785 for (
unsigned i = 0; (1U << i) <= (Len / 2); ++i) {
2786 SDValue Tmp3 = DAG.getConstant(1ULL << i, dl, ShVT);
2790 Op = DAG.getNOT(dl, Op, VT);
2801 EVT SetCCVT = getSetCCResultType(VT);
2803 SDValue Zero = DAG.getConstant(0, dl, VT);
2806 DAG.getConstant(Len, dl, VT),
CTTZ);
2814 DAG.getNOT(dl, Op, VT),
2816 DAG.getConstant(1, dl, VT)));
2818 if (!TLI.isOperationLegalOrCustom(
ISD::CTPOP, VT) &&
2819 TLI.isOperationLegalOrCustom(
ISD::CTLZ, VT))
2820 return DAG.getNode(
ISD::SUB, dl, VT,
2823 return DAG.getNode(
ISD::CTPOP, dl, VT, Tmp3);
2828 bool SelectionDAGLegalize::ExpandNode(
SDNode *Node) {
2832 SDValue Tmp1, Tmp2, Tmp3, Tmp4;
2856 TLI.getPointerTy(DAG.getDataLayout()));
2864 DAG.getConstant(0, dl, TLI.getPointerTy(DAG.getDataLayout())));
2898 SDValue Swap = DAG.getAtomicCmpSwap(
2901 cast<AtomicSDNode>(Node)->getMemOperand());
2909 cast<AtomicSDNode>(Node)->getMemoryVT(),
2912 cast<AtomicSDNode>(Node)->getMemOperand());
2921 SDValue Res = DAG.getAtomicCmpSwap(
2924 Node->
getOperand(3), cast<MemSDNode>(Node)->getMemOperand());
2930 EVT AtomicType = cast<AtomicSDNode>(Node)->getMemoryVT();
2932 switch (TLI.getExtendForAtomicOps()) {
2943 RHS = DAG.getZeroExtendInReg(Node->
getOperand(2), dl, AtomicType);
2947 LHS = DAG.getZeroExtendInReg(Res, dl, AtomicType);
2948 RHS = DAG.getZeroExtendInReg(Node->
getOperand(2), dl, AtomicType);
2963 ExpandDYNAMIC_STACKALLOC(Node, Results);
2972 Results.
push_back(DAG.getConstant(0, dl, VT));
2975 Results.
push_back(DAG.getConstantFP(0, dl, VT));
3003 SDValue One = DAG.getConstant(1, dl, VT);
3005 SDValue Zero = DAG.getConstant(0, dl, VT);
3013 EVT ShiftAmountTy = TLI.getShiftAmountTy(VT, DAG.getDataLayout());
3016 SDValue ShiftCst = DAG.getConstant(BitsDiff, dl, ShiftAmountTy);
3031 Tmp1 = EmitStackConvert(Node->
getOperand(0), ExtraVT,
3043 if (TLI.expandFP_TO_SINT(Node, Tmp1, DAG))
3050 APFloat apf(DAG.EVTToAPFloatSemantics(VT),
3054 Tmp1 = DAG.getConstantFP(apf, dl, VT);
3055 Tmp2 = DAG.getSetCC(dl, getSetCCResultType(VT),
3064 DAG.getConstant(x, dl, NVT));
3065 Tmp1 = DAG.getSelect(dl, NVT, Tmp2, True, False);
3070 Results.
push_back(DAG.expandVAArg(Node));
3071 Results.
push_back(Results[0].getValue(1));
3074 Results.
push_back(DAG.expandVACopy(Node));
3082 Tmp1 = ExpandExtractFromVectorThroughStack(
SDValue(Node, 0));
3092 Results.
push_back(ExpandVectorBuildThroughStack(Node));
3095 Results.
push_back(ExpandSCALAR_TO_VECTOR(Node));
3104 ArrayRef<int> Mask = cast<ShuffleVectorSDNode>(Node)->getMask();
3110 if (!TLI.isTypeLegal(EltVT)) {
3111 EVT NewEltVT = TLI.getTypeToTransformTo(*DAG.getContext(), EltVT);
3116 if (NewEltVT.
bitsLT(EltVT)) {
3132 unsigned int factor =
3140 for (
unsigned fi = 0; fi < factor; ++fi)
3144 for (
unsigned fi = 0; fi < factor; ++fi)
3155 for (
unsigned i = 0; i != NumElems; ++i) {
3160 unsigned Idx = Mask[i];
3164 DAG.getConstant(Idx, dl, TLI.getVectorIdxTy(DAG.getDataLayout()))));
3168 DAG.getConstant(Idx - NumElems, dl,
3169 TLI.getVectorIdxTy(DAG.getDataLayout()))));
3172 Tmp1 = DAG.getBuildVector(VT, dl, Ops);
3180 if (cast<ConstantSDNode>(Node->
getOperand(1))->getZExtValue()) {
3184 TLI.getShiftAmountTy(
3186 DAG.getDataLayout())));
3199 if (
unsigned SP = TLI.getStackPointerRegisterToSaveRestore()) {
3202 Results.
push_back(Results[0].getValue(1));
3211 if (
unsigned SP = TLI.getStackPointerRegisterToSaveRestore()) {
3220 Results.
push_back(Results[0].getValue(0));
3223 Results.
push_back(ExpandFCOPYSIGN(Node));
3227 Tmp1 = DAG.getConstantFP(-0.0, dl, Node->
getValueType(0));
3251 Tmp1 = DAG.getSelectCC(dl, Tmp1, Tmp2, Tmp1, Tmp2, Pred);
3264 SDVTList VTs = DAG.getVTList(VT, VT);
3288 if (!TLI.useSoftFloat() &&
TM.Options.UnsafeFPMath) {
3296 DAG.getIntPtrConstant(0, dl));
3307 Results.
push_back(ExpandConstantFP(CFP,
true));
3317 if (TLI.isOperationLegalOrCustom(
ISD::FADD, VT) &&
3318 TLI.isOperationLegalOrCustom(
ISD::FNEG, VT)) {
3329 TLI.isOperationLegalOrCustom(
ISD::XOR, VT) &&
3330 "Don't know how to expand this subtraction!");
3334 Tmp1 = DAG.getNode(
ISD::ADD, dl, VT, Tmp1, DAG.getConstant(1, dl, VT));
3346 if (TLI.isOperationLegalOrCustom(DivRemOpc, VT)) {
3347 SDVTList VTs = DAG.getVTList(VT, VT);
3348 Tmp1 = DAG.
getNode(DivRemOpc, dl, VTs, Tmp2, Tmp3).getValue(1);
3350 }
else if (TLI.isOperationLegalOrCustom(DivOpc, VT)) {
3352 Tmp1 = DAG.
getNode(DivOpc, dl, VT, Tmp2, Tmp3);
3364 if (TLI.isOperationLegalOrCustom(DivRemOpc, VT)) {
3365 SDVTList VTs = DAG.getVTList(VT, VT);
3374 unsigned ExpandOpcode =
3377 SDVTList VTs = DAG.getVTList(VT, VT);
3389 unsigned MULHOpcode =
3392 if (TLI.isOperationLegalOrCustom(MULHOpcode, VT)) {
3394 Results.
push_back(DAG.getNode(MULHOpcode, dl, VT, LHS, RHS));
3400 assert(TLI.isTypeLegal(HalfType));
3401 if (TLI.expandMUL_LOHI(Node->
getOpcode(), VT, Node, LHS, RHS, Halves,
3404 for (
unsigned i = 0; i < 2; ++i) {
3407 SDValue Shift = DAG.getConstant(
3408 HalfType.getScalarSizeInBits(), dl,
3409 TLI.getShiftAmountTy(HalfType, DAG.getDataLayout()));
3419 SDVTList VTs = DAG.getVTList(VT, VT);
3425 bool HasSMUL_LOHI = TLI.isOperationLegalOrCustom(
ISD::SMUL_LOHI, VT);
3426 bool HasUMUL_LOHI = TLI.isOperationLegalOrCustom(
ISD::UMUL_LOHI, VT);
3427 bool HasMULHS = TLI.isOperationLegalOrCustom(
ISD::MULHS, VT);
3428 bool HasMULHU = TLI.isOperationLegalOrCustom(
ISD::MULHU, VT);
3429 unsigned OpToUse = 0;
3430 if (HasSMUL_LOHI && !HasMULHS) {
3432 }
else if (HasUMUL_LOHI && !HasMULHU) {
3434 }
else if (HasSMUL_LOHI) {
3436 }
else if (HasUMUL_LOHI) {
3449 TLI.isOperationLegalOrCustom(
ISD::SHL, VT) &&
3450 TLI.isOperationLegalOrCustom(
ISD::OR, VT) &&
3451 TLI.expandMUL(Node, Lo, Hi, HalfType, DAG,
3457 TLI.getShiftAmountTy(HalfType, DAG.getDataLayout()));
3486 SDValue SignsMatch = DAG.getSetCC(dl, OType, LHSSign, RHSSign,
3494 Results.
push_back(DAG.getBoolExtOrTrunc(Cmp, dl, ResultType, ResultType));
3504 if (TLI.isOperationLegalOrCustom(OpcCarry, Node->
getValueType(0))) {
3507 { LHS, RHS, CarryIn });
3520 SDValue SetCC = DAG.getSetCC(dl, SetCCType, Sum, LHS, CC);
3522 Results.
push_back(DAG.getBoolExtOrTrunc(SetCC, dl, ResultType, ResultType));
3533 static const unsigned Ops[2][3] =
3537 if (TLI.isOperationLegalOrCustom(Ops[isSigned][0], VT)) {
3539 TopHalf = DAG.
getNode(Ops[isSigned][0], dl, VT, LHS, RHS);
3540 }
else if (TLI.isOperationLegalOrCustom(Ops[isSigned][1], VT)) {
3541 BottomHalf = DAG.
getNode(Ops[isSigned][1], dl, DAG.getVTList(VT, VT), LHS,
3544 }
else if (TLI.isTypeLegal(WideVT)) {
3545 LHS = DAG.
getNode(Ops[isSigned][2], dl, WideVT, LHS);
3546 RHS = DAG.
getNode(Ops[isSigned][2], dl, WideVT, RHS);
3549 DAG.getIntPtrConstant(0, dl));
3551 DAG.getIntPtrConstant(1, dl));
3559 LC = RTLIB::MUL_I16;
3561 LC = RTLIB::MUL_I32;
3563 LC = RTLIB::MUL_I64;
3565 LC = RTLIB::MUL_I128;
3566 assert(LC != RTLIB::UNKNOWN_LIBCALL &&
"Cannot expand this operation!");
3576 DAG.getConstant(LoSize - 1, dl,
3577 TLI.getPointerTy(DAG.getDataLayout())));
3580 DAG.getConstant(LoSize - 1, dl,
3581 TLI.getPointerTy(DAG.getDataLayout())));
3583 HiLHS = DAG.getConstant(0, dl, VT);
3584 HiRHS = DAG.getConstant(0, dl, VT);
3592 if(DAG.getDataLayout().isLittleEndian()) {
3598 Ret = ExpandLibCall(LC, WideVT, Args, 4, isSigned, dl);
3601 Ret = ExpandLibCall(LC, WideVT, Args, 4, isSigned, dl);
3604 "Ret value is a collection of constituent nodes holding result.");
3610 Tmp1 = DAG.getConstant(
3612 TLI.getShiftAmountTy(BottomHalf.
getValueType(), DAG.getDataLayout()));
3614 TopHalf = DAG.getSetCC(dl, getSetCCResultType(VT), TopHalf, Tmp1,
3617 TopHalf = DAG.getSetCC(dl, getSetCCResultType(VT), TopHalf,
3627 "Unexpected result type for S/UMULO legalization");
3640 TLI.getShiftAmountTy(PairTy, DAG.getDataLayout())));
3651 cast<CondCodeSDNode>(Tmp1.
getOperand(2))->
get());
3653 Tmp1 = DAG.getSelectCC(dl, Tmp1,
3665 EVT PTy = TLI.getPointerTy(TD);
3667 unsigned EntrySize =
3668 DAG.getMachineFunction().getJumpTableInfo()->getEntrySize(TD);
3689 if (TLI.isJumpTableRelative()) {
3694 TLI.getPICJumpTableRelocBase(Table, DAG));
3697 Tmp1 = TLI.expandIndirectJTBranch(dl, LD.getValue(1), Addr, DAG);
3716 cast<ConstantSDNode>(Tmp2.
getOperand(1))->getZExtValue() == 1))
3732 bool Legalized = LegalizeSetCCCondCode(Node->
getValueType(0), Tmp1, Tmp2,
3733 Tmp3, NeedInvert, dl);
3745 Tmp1 = DAG.getLogicalNOT(dl, Tmp1, Tmp1->
getValueType(0));
3765 DAG.getConstant(TrueValue, dl, VT),
3766 DAG.getConstant(0, dl, VT),
3785 "Cannot expand ISD::SELECT_CC when ISD::SELECT also needs to be " 3788 TLI.getSetCCResultType(DAG.getDataLayout(), *DAG.getContext(), CmpVT);
3790 Results.
push_back(DAG.getSelect(dl, VT, Cond, Tmp3, Tmp4));
3795 bool Legalized =
false;
3804 Tmp1 = DAG.getSelectCC(dl, Tmp1, Tmp2, Tmp4, Tmp3, InvCC);
3813 Tmp1 = DAG.getSelectCC(dl, Tmp2, Tmp1, Tmp4, Tmp3, SwapInvCC);
3818 Legalized = LegalizeSetCCCondCode(
3819 getSetCCResultType(Tmp1.
getValueType()), Tmp1, Tmp2, CC, NeedInvert,
3822 assert(Legalized &&
"Can't legalize SELECT_CC with legal condition!");
3833 Tmp1, Tmp2, Tmp3, Tmp4, CC);
3838 Tmp2, Tmp3, Tmp4, CC);
3850 bool Legalized = LegalizeSetCCCondCode(getSetCCResultType(
3851 Tmp2.
getValueType()), Tmp2, Tmp3, Tmp4, NeedInvert, dl);
3853 assert(Legalized &&
"Can't legalize BR_CC with legal condition!");
3875 Results.
push_back(ExpandBUILD_VECTOR(Node));
3887 for (
unsigned Idx = 0; Idx < NumElem; Idx++) {
3890 DAG.getConstant(Idx, dl, TLI.getVectorIdxTy(DAG.getDataLayout())));
3893 DAG.getConstant(Idx, dl, TLI.getVectorIdxTy(DAG.getDataLayout())));
3899 ReplaceNode(
SDValue(Node, 0), Result);
3909 "The result and the operand types of rotate should match");
3910 EVT ShVT = Op1.getValueType();
3915 if (TLI.isOperationLegal(RevRot, ResVT)) {
3917 Results.
push_back(DAG.getNode(RevRot, dl, ResVT, Op0, Sub));
3926 "Expecting the type bitwidth to be a power of 2");
3930 Width, DAG.getConstant(1, dl, ShVT));
3936 DAG.getNode(ShOpc, dl, ResVT, Op0, And0),
3937 DAG.getNode(HsOpc, dl, ResVT, Op0, And1));
3956 if (Results.
empty()) {
3962 ReplaceNode(Node, Results.
data());
3966 void SelectionDAGLegalize::ConvertNodeToLibcall(
SDNode *Node) {
3971 bool CanUseFiniteLibCall =
TM.Options.NoInfsFPMath &&
TM.Options.NoNaNsFPMath;
3984 DAG.getExternalSymbol(
"__sync_synchronize",
3985 TLI.getPointerTy(DAG.getDataLayout())),
3988 std::pair<SDValue, SDValue> CallResult = TLI.LowerCallTo(CLI);
4011 assert(LC != RTLIB::UNKNOWN_LIBCALL &&
"Unexpected atomic op or value type!");
4013 std::pair<SDValue, SDValue> Tmp = ExpandChainLibCall(LC, Node,
false);
4025 DAG.getExternalSymbol(
4026 "abort", TLI.getPointerTy(DAG.getDataLayout())),
4028 std::pair<SDValue, SDValue> CallResult = TLI.LowerCallTo(CLI);
4034 Results.
push_back(ExpandFPLibCall(Node, RTLIB::FMIN_F32, RTLIB::FMIN_F64,
4035 RTLIB::FMIN_F80, RTLIB::FMIN_F128,
4036 RTLIB::FMIN_PPCF128));
4039 Results.
push_back(ExpandFPLibCall(Node, RTLIB::FMAX_F32, RTLIB::FMAX_F64,
4040 RTLIB::FMAX_F80, RTLIB::FMAX_F128,
4041 RTLIB::FMAX_PPCF128));
4045 Results.
push_back(ExpandFPLibCall(Node, RTLIB::SQRT_F32, RTLIB::SQRT_F64,
4046 RTLIB::SQRT_F80, RTLIB::SQRT_F128,
4047 RTLIB::SQRT_PPCF128));
4051 Results.
push_back(ExpandFPLibCall(Node, RTLIB::SIN_F32, RTLIB::SIN_F64,
4052 RTLIB::SIN_F80, RTLIB::SIN_F128,
4053 RTLIB::SIN_PPCF128));
4057 Results.
push_back(ExpandFPLibCall(Node, RTLIB::COS_F32, RTLIB::COS_F64,
4058 RTLIB::COS_F80, RTLIB::COS_F128,
4059 RTLIB::COS_PPCF128));
4063 ExpandSinCosLibCall(Node, Results);
4067 if (CanUseFiniteLibCall && DAG.getLibInfo().has(LibFunc_log_finite))
4068 Results.
push_back(ExpandFPLibCall(Node, RTLIB::LOG_FINITE_F32,
4069 RTLIB::LOG_FINITE_F64,
4070 RTLIB::LOG_FINITE_F80,
4071 RTLIB::LOG_FINITE_F128,
4072 RTLIB::LOG_FINITE_PPCF128));
4074 Results.
push_back(ExpandFPLibCall(Node, RTLIB::LOG_F32, RTLIB::LOG_F64,
4075 RTLIB::LOG_F80, RTLIB::LOG_F128,
4076 RTLIB::LOG_PPCF128));
4080 if (CanUseFiniteLibCall && DAG.getLibInfo().has(LibFunc_log2_finite))
4081 Results.
push_back(ExpandFPLibCall(Node, RTLIB::LOG2_FINITE_F32,
4082 RTLIB::LOG2_FINITE_F64,
4083 RTLIB::LOG2_FINITE_F80,
4084 RTLIB::LOG2_FINITE_F128,
4085 RTLIB::LOG2_FINITE_PPCF128));
4087 Results.
push_back(ExpandFPLibCall(Node, RTLIB::LOG2_F32, RTLIB::LOG2_F64,
4088 RTLIB::LOG2_F80, RTLIB::LOG2_F128,
4089 RTLIB::LOG2_PPCF128));
4093 if (CanUseFiniteLibCall && DAG.getLibInfo().has(LibFunc_log10_finite))
4094 Results.
push_back(ExpandFPLibCall(Node, RTLIB::LOG10_FINITE_F32,
4095 RTLIB::LOG10_FINITE_F64,
4096 RTLIB::LOG10_FINITE_F80,
4097 RTLIB::LOG10_FINITE_F128,
4098 RTLIB::LOG10_FINITE_PPCF128));
4100 Results.
push_back(ExpandFPLibCall(Node, RTLIB::LOG10_F32, RTLIB::LOG10_F64,
4101 RTLIB::LOG10_F80, RTLIB::LOG10_F128,
4102 RTLIB::LOG10_PPCF128));
4106 if (CanUseFiniteLibCall && DAG.getLibInfo().has(LibFunc_exp_finite))
4107 Results.
push_back(ExpandFPLibCall(Node, RTLIB::EXP_FINITE_F32,
4108 RTLIB::EXP_FINITE_F64,
4109 RTLIB::EXP_FINITE_F80,
4110 RTLIB::EXP_FINITE_F128,
4111 RTLIB::EXP_FINITE_PPCF128));
4113 Results.
push_back(ExpandFPLibCall(Node, RTLIB::EXP_F32, RTLIB::EXP_F64,
4114 RTLIB::EXP_F80, RTLIB::EXP_F128,
4115 RTLIB::EXP_PPCF128));
4119 if (CanUseFiniteLibCall && DAG.getLibInfo().has(LibFunc_exp2_finite))
4120 Results.
push_back(ExpandFPLibCall(Node, RTLIB::EXP2_FINITE_F32,
4121 RTLIB::EXP2_FINITE_F64,
4122 RTLIB::EXP2_FINITE_F80,
4123 RTLIB::EXP2_FINITE_F128,
4124 RTLIB::EXP2_FINITE_PPCF128));
4126 Results.
push_back(ExpandFPLibCall(Node, RTLIB::EXP2_F32, RTLIB::EXP2_F64,
4127 RTLIB::EXP2_F80, RTLIB::EXP2_F128,
4128 RTLIB::EXP2_PPCF128));
4131 Results.
push_back(ExpandFPLibCall(Node, RTLIB::TRUNC_F32, RTLIB::TRUNC_F64,
4132 RTLIB::TRUNC_F80, RTLIB::TRUNC_F128,
4133 RTLIB::TRUNC_PPCF128));
4136 Results.
push_back(ExpandFPLibCall(Node, RTLIB::FLOOR_F32, RTLIB::FLOOR_F64,
4137 RTLIB::FLOOR_F80, RTLIB::FLOOR_F128,
4138 RTLIB::FLOOR_PPCF128));
4141 Results.
push_back(ExpandFPLibCall(Node, RTLIB::CEIL_F32, RTLIB::CEIL_F64,
4142 RTLIB::CEIL_F80, RTLIB::CEIL_F128,
4143 RTLIB::CEIL_PPCF128));
4147 Results.
push_back(ExpandFPLibCall(Node, RTLIB::RINT_F32, RTLIB::RINT_F64,
4148 RTLIB::RINT_F80, RTLIB::RINT_F128,
4149 RTLIB::RINT_PPCF128));
4153 Results.
push_back(ExpandFPLibCall(Node, RTLIB::NEARBYINT_F32,
4154 RTLIB::NEARBYINT_F64,
4155 RTLIB::NEARBYINT_F80,
4156 RTLIB::NEARBYINT_F128,
4157 RTLIB::NEARBYINT_PPCF128));
4160 Results.
push_back(ExpandFPLibCall(Node, RTLIB::ROUND_F32,
4164 RTLIB::ROUND_PPCF128));
4168 Results.
push_back(ExpandFPLibCall(Node, RTLIB::POWI_F32, RTLIB::POWI_F64,
4169 RTLIB::POWI_F80, RTLIB::POWI_F128,
4170 RTLIB::POWI_PPCF128));
4174 if (CanUseFiniteLibCall && DAG.getLibInfo().has(LibFunc_pow_finite))
4175 Results.
push_back(ExpandFPLibCall(Node, RTLIB::POW_FINITE_F32,
4176 RTLIB::POW_FINITE_F64,
4177 RTLIB::POW_FINITE_F80,
4178 RTLIB::POW_FINITE_F128,
4179 RTLIB::POW_FINITE_PPCF128));
4181 Results.
push_back(ExpandFPLibCall(Node, RTLIB::POW_F32, RTLIB::POW_F64,
4182 RTLIB::POW_F80, RTLIB::POW_F128,
4183 RTLIB::POW_PPCF128));
4186 Results.
push_back(ExpandFPLibCall(Node, RTLIB::DIV_F32, RTLIB::DIV_F64,
4187 RTLIB::DIV_F80, RTLIB::DIV_F128,
4188 RTLIB::DIV_PPCF128));
4191 Results.
push_back(ExpandFPLibCall(Node, RTLIB::REM_F32, RTLIB::REM_F64,
4192 RTLIB::REM_F80, RTLIB::REM_F128,
4193 RTLIB::REM_PPCF128));
4197 Results.
push_back(ExpandFPLibCall(Node, RTLIB::FMA_F32, RTLIB::FMA_F64,
4198 RTLIB::FMA_F80, RTLIB::FMA_F128,
4199 RTLIB::FMA_PPCF128));
4202 Results.
push_back(ExpandFPLibCall(Node, RTLIB::ADD_F32, RTLIB::ADD_F64,
4203 RTLIB::ADD_F80, RTLIB::ADD_F128,
4204 RTLIB::ADD_PPCF128));
4207 Results.
push_back(ExpandFPLibCall(Node, RTLIB::MUL_F32, RTLIB::MUL_F64,
4208 RTLIB::MUL_F80, RTLIB::MUL_F128,
4209 RTLIB::MUL_PPCF128));
4213 Results.
push_back(ExpandLibCall(RTLIB::FPEXT_F16_F32, Node,
false));
4219 assert(LC != RTLIB::UNKNOWN_LIBCALL &&
"Unable to expand fp_to_fp16");
4220 Results.
push_back(ExpandLibCall(LC, Node,
false));
4224 Results.
push_back(ExpandFPLibCall(Node, RTLIB::SUB_F32, RTLIB::SUB_F64,
4225 RTLIB::SUB_F80, RTLIB::SUB_F128,
4226 RTLIB::SUB_PPCF128));
4229 Results.
push_back(ExpandIntLibCall(Node,
true,
4231 RTLIB::SREM_I16, RTLIB::SREM_I32,
4232 RTLIB::SREM_I64, RTLIB::SREM_I128));
4235 Results.
push_back(ExpandIntLibCall(Node,
false,
4237 RTLIB::UREM_I16, RTLIB::UREM_I32,
4238 RTLIB::UREM_I64, RTLIB::UREM_I128));
4241 Results.
push_back(ExpandIntLibCall(Node,
true,
4243 RTLIB::SDIV_I16, RTLIB::SDIV_I32,
4244 RTLIB::SDIV_I64, RTLIB::SDIV_I128));
4247 Results.
push_back(ExpandIntLibCall(Node,
false,
4249 RTLIB::UDIV_I16, RTLIB::UDIV_I32,
4250 RTLIB::UDIV_I64, RTLIB::UDIV_I128));
4255 ExpandDivRemLibCall(Node, Results);
4258 Results.
push_back(ExpandIntLibCall(Node,
false,
4260 RTLIB::MUL_I16, RTLIB::MUL_I32,
4261 RTLIB::MUL_I64, RTLIB::MUL_I128));
4266 if (!Results.
empty()) {
4267 LLVM_DEBUG(
dbgs() <<
"Successfully converted node to libcall\n");
4268 ReplaceNode(Node, Results.
data());
4276 MVT EltVT,
MVT NewEltVT) {
4283 void SelectionDAGLegalize::PromoteNode(
SDNode *Node) {
4296 MVT NVT = TLI.getTypeToPromoteTo(Node->
getOpcode(), OVT);
4314 DAG.getConstant(TopBit, dl, NVT));
4323 DAG.getConstant(NVT.getSizeInBits() -
4330 unsigned DiffBits = NVT.getSizeInBits() - OVT.
getSizeInBits();
4335 DAG.getConstant(DiffBits, dl,
4336 TLI.getShiftAmountTy(NVT, DAG.getDataLayout())));
4362 &&
"VAARG promotion is supported only for vectors or integer types");
4367 Tmp1 = DAG.getVAArg(NVT, dl, Chain, Ptr, Node->
getOperand(2),
4371 Tmp2 = DAG.
getNode(TruncOp, dl, OVT, Tmp1);
4375 DAG.ReplaceAllUsesOfValueWith(
SDValue(Node, 0), Tmp2);
4376 DAG.ReplaceAllUsesOfValueWith(
SDValue(Node, 1), Chain);
4378 UpdatedNodes->insert(Tmp2.
getNode());
4379 UpdatedNodes->insert(Chain.
getNode());
4392 unsigned ExtOp, TruncOp;
4419 Results.
push_back(DAG.getNode(TruncOp, dl, OVT, Tmp1));
4431 auto &DL = DAG.getDataLayout();
4435 DAG.getConstant(OriginalSize, dl, TLI.getScalarShiftAmountTy(DL, NVT)));
4441 unsigned ExtOp, TruncOp;
4458 Tmp1 = DAG.getSelect(dl, NVT, Tmp1, Tmp2, Tmp3);
4463 DAG.getIntPtrConstant(0, dl));
4468 ArrayRef<int> Mask = cast<ShuffleVectorSDNode>(Node)->getMask();
4475 Tmp1 = ShuffleWithNarrowerEltType(NVT, OVT, dl, Tmp1, Tmp2, Mask);
4482 if (NVT.isInteger()) {
4484 cast<CondCodeSDNode>(Node->
getOperand(2))->
get();
4495 if (NVT.isInteger()) {
4497 cast<CondCodeSDNode>(Node->
getOperand(1))->
get();
4520 Tmp3, DAG.getIntPtrConstant(0, dl)));
4528 DAG.getNode(Node->
getOpcode(), dl, NVT, Tmp1, Tmp2, Tmp3),
4529 DAG.getIntPtrConstant(0, dl)));
4544 Tmp3, DAG.getIntPtrConstant(isTrunc, dl)));
4564 Tmp2 = DAG.getNode(Node->
getOpcode(), dl, NVT, Tmp1);
4566 Tmp2, DAG.getIntPtrConstant(0, dl)));
4579 "Invalid promote type for build_vector");
4612 "Invalid promote type for extract_vector_elt");
4616 unsigned NewEltsPerOldElt = MidVT.getVectorNumElements();
4621 SDValue Factor = DAG.getConstant(NewEltsPerOldElt, SL, IdxVT);
4627 for (
unsigned I = 0;
I < NewEltsPerOldElt; ++
I) {
4628 SDValue IdxOffset = DAG.getConstant(
I, SL, IdxVT);
4636 SDValue NewVec = DAG.getBuildVector(MidVT, SL, NewOps);
4658 "Invalid promote type for insert_vector_elt");
4662 unsigned NewEltsPerOldElt = MidVT.getVectorNumElements();
4669 SDValue Factor = DAG.getConstant(NewEltsPerOldElt,
SDLoc(), IdxVT);
4676 for (
unsigned I = 0;
I < NewEltsPerOldElt; ++
I) {
4677 SDValue IdxOffset = DAG.getConstant(
I, SL, IdxVT);
4681 CastVal, IdxOffset);
4684 NewVec, Elt, InEltIdx);
4721 if (!Results.
empty()) {
4723 ReplaceNode(Node, Results.
data());
4730 AssignTopologicalOrder();
4741 SelectionDAGLegalize
Legalizer(*
this, LegalizedNodes);
4748 bool AnyLegalized =
false;
4749 for (
auto NI = allnodes_end(); NI != allnodes_begin();) {
4753 if (N->
use_empty() && N != getRoot().getNode()) {
4759 if (LegalizedNodes.
insert(N).second) {
4760 AnyLegalized =
true;
4761 Legalizer.LegalizeOp(N);
4763 if (N->
use_empty() && N != getRoot().getNode()) {
4781 SelectionDAGLegalize
Legalizer(*
this, LegalizedNodes, &UpdatedNodes);
4785 LegalizedNodes.
insert(N);
4786 Legalizer.LegalizeOp(N);
4788 return LegalizedNodes.
count(N);
bool LegalizeOp(SDNode *N, SmallSetVector< SDNode *, 16 > &UpdatedNodes)
Transforms a SelectionDAG node and any operands to it into a node that is compatible with the target ...
ADJUST_TRAMPOLINE - This corresponds to the adjust_trampoline intrinsic.
static Constant * getFPTrunc(Constant *C, Type *Ty, bool OnlyIfReduced=false)
BITCAST - This operator converts between integer, vector and FP values, as if the value was stored to...
X = FP_ROUND(Y, TRUNC) - Rounding 'Y' from a larger floating point type down to the precision of the ...
void push_back(const T &Elt)
BUILTIN_OP_END - This must be the last enum value in this list.
A parsed version of the target data layout string in and methods for querying it. ...
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
FMINNUM/FMAXNUM - Perform floating-point minimum or maximum on two values.
EVT getValueType() const
Return the ValueType of the referenced return value.
bool isInteger() const
Return true if this is an integer or a vector integer type.
static bool isConstant(const MachineInstr &MI)
opStatus convertFromAPInt(const APInt &Input, bool IsSigned, roundingMode RM)
static MachinePointerInfo getJumpTable(MachineFunction &MF)
Return a MachinePointerInfo record that refers to a jump table entry.
Constrained versions of libm-equivalent floating point intrinsics.
EXTRACT_ELEMENT - This is used to get the lower or upper (determined by a Constant, which is required to be operand #1) half of the integer or float value specified as operand #0.
static APInt getAllOnesValue(unsigned numBits)
Get the all-ones value.
unsigned getOpcode() const
Return the SelectionDAG opcode value for this node.
bool isIndexed() const
Return true if this is a pre/post inc/dec load/store.
C - The default llvm calling convention, compatible with C.
NodeType getExtForLoadExtType(bool IsFP, LoadExtType)
EXTRACT_SUBVECTOR(VECTOR, IDX) - Returns a subvector from VECTOR (an vector value) starting with the ...
BR_CC - Conditional branch.
Compute iterated dominance frontiers using a linear time algorithm.
static MVT getVectorVT(MVT VT, unsigned NumElements)
VECTOR_SHUFFLE(VEC1, VEC2) - Returns a vector, of the same type as VEC1/VEC2.
EVT getScalarType() const
If this is a vector type, return the element type, otherwise return this.
bool isVector() const
Return true if this is a vector value type.
CallLoweringInfo & setIsPostTypeLegalization(bool Value=true)
Libcall getSYNC(unsigned Opc, MVT VT)
Return the SYNC_FETCH_AND_* value for the given opcode and type, or UNKNOWN_LIBCALL if there is none...
const SDValue & getBasePtr() const
EVT getValueType(unsigned ResNo) const
Return the type of a specified result.
const SDValue & getValue() const
STACKRESTORE has two operands, an input chain and a pointer to restore to it returns an output chain...
SDVTList getVTList() const
MVT getSimpleVT() const
Return the SimpleValueType held in the specified simple EVT.
Libcall
RTLIB::Libcall enum - This enum defines all of the runtime library calls the backend can emit...
AAMDNodes getAAInfo() const
Returns the AA info that describes the dereference.
RESULT, BOOL = [SU]ADDO(LHS, RHS) - Overflow-aware nodes for addition.
unsigned getVectorNumElements() const
const SDValue & getChain() const
Function Alias Analysis Results
static MVT getPromotedVectorElementType(const TargetLowering &TLI, MVT EltVT, MVT NewEltVT)
unsigned getAlignment() const
Val, Success, OUTCHAIN = ATOMIC_CMP_SWAP_WITH_SUCCESS(INCHAIN, ptr, cmp, swap) N.b.
APInt trunc(unsigned width) const
Truncate to new width.
Constrained versions of the binary floating point operators.
MVT getSimpleValueType(unsigned ResNo) const
Return the type of a specified result as a simple type.
bool isInteger() const
Return true if this is an integer or a vector integer type.
CallLoweringInfo & setDebugLoc(const SDLoc &dl)
static IntegerType * getInt64Ty(LLVMContext &C)
[US]{MIN/MAX} - Binary minimum or maximum or signed or unsigned integers.
const SDNodeFlags getFlags() const
SDNode * getNode() const
get the SDNode which holds the desired result
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
void reserve(size_type N)
bool isByteSized() const
Return true if the bit size is a multiple of 8.
MachineMemOperand * getMemOperand() const
Return a MachineMemOperand object describing the memory reference performed by operation.
INSERT_SUBVECTOR(VECTOR1, VECTOR2, IDX) - Returns a vector with VECTOR2 inserted into VECTOR1 at the ...
unsigned getValueSizeInBits() const
Returns the size of the value in bits.
OUTCHAIN = ATOMIC_FENCE(INCHAIN, ordering, scope) This corresponds to the fence instruction.
Select with condition operator - This selects between a true value and a false value (ops #2 and #3) ...
std::pair< MCSymbol *, MachineModuleInfoImpl::StubValueTy > PairTy
Libcall getFPROUND(EVT OpVT, EVT RetVT)
getFPROUND - Return the FPROUND_*_* value for the given types, or UNKNOWN_LIBCALL if there is none...
const ConstantFP * getConstantFPValue() const
RESULT,OUTCHAIN = INTRINSIC_W_CHAIN(INCHAIN, INTRINSICID, arg1, ...) This node represents a target in...
bool isTruncatingStore() const
Return true if the op does a truncation before store.
static bool hasPredecessorHelper(const SDNode *N, SmallPtrSetImpl< const SDNode *> &Visited, SmallVectorImpl< const SDNode *> &Worklist, unsigned int MaxSteps=0, bool TopologicalPrune=false)
Returns true if N is a predecessor of any node in Worklist.
unsigned getAddressSpace() const
Return the address space for the associated pointer.
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
OUTCHAIN = EH_SJLJ_LONGJMP(INCHAIN, buffer) This corresponds to the eh.sjlj.longjmp intrinsic...
SDIVREM/UDIVREM - Divide two integers and produce both a quotient and remainder result.
bool isFloatingPoint() const
Return true if this is a FP or a vector FP type.
SHL_PARTS/SRA_PARTS/SRL_PARTS - These operators are used for expanded integer shift operations...
static uint32_t getAlignment(const MCSectionCOFF &Sec)
Shift and rotation operations.
Type * getTypeForEVT(LLVMContext &Context) const
This method returns an LLVM type corresponding to the specified EVT.
PointerType * getPointerTo(unsigned AddrSpace=0) const
Return a pointer to the current type.
CallLoweringInfo & setChain(SDValue InChain)
BUILD_PAIR - This is the opposite of EXTRACT_ELEMENT in some ways.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
op_iterator op_end() const
ISD::LoadExtType getExtensionType() const
Return whether this is a plain node, or one of the varieties of value-extending loads.
FLT_ROUNDS_ - Returns current rounding mode: -1 Undefined 0 Round to 0 1 Round to nearest 2 Round to ...
CALLSEQ_START/CALLSEQ_END - These operators mark the beginning and end of a call sequence, and carry arbitrary information that target might want to know.
EH_DWARF_CFA - This node represents the pointer to the DWARF Canonical Frame Address (CFA)...
Val, OUTCHAIN = ATOMIC_SWAP(INCHAIN, ptr, amt) Val, OUTCHAIN = ATOMIC_LOAD_[OpName](INCHAIN, ptr, amt) For double-word atomic operations: ValLo, ValHi, OUTCHAIN = ATOMIC_SWAP(INCHAIN, ptr, amtLo, amtHi) ValLo, ValHi, OUTCHAIN = ATOMIC_LOAD_[OpName](INCHAIN, ptr, amtLo, amtHi) These correspond to the atomicrmw instruction.
const DataLayout & getDataLayout() const
FRAMEADDR, RETURNADDR - These nodes represent llvm.frameaddress and llvm.returnaddress on the DAG...
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
This file implements a class to represent arbitrary precision integral constant values and operations...
This represents a list of ValueType's that has been intern'd by a SelectionDAG.
STACKSAVE - STACKSAVE has one operand, an input chain.
FRAME_TO_ARGS_OFFSET - This node represents offset from frame pointer to first (possible) on-stack ar...
unsigned getSizeInBits() const
unsigned getScalarSizeInBits() const
unsigned getSizeInBits() const
Return the size of the specified value type in bits.
[SU]INT_TO_FP - These operators convert integers (whose interpreted sign depends on the first letter)...
bool insert(const value_type &X)
Insert a new element into the SetVector.
OUTCHAIN = EH_SJLJ_SETUP_DISPATCH(INCHAIN) The target initializes the dispatch table here...
falkor hwpf fix Falkor HW Prefetch Fix Late Phase
const TargetMachine & getTarget() const
Simple integer binary arithmetic operators.
bool bitsLT(MVT VT) const
Return true if this has less bits than VT.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
CallLoweringInfo & setZExtResult(bool Value=true)
SDValue getUNDEF(EVT VT)
Return an UNDEF node. UNDEF does not have a useful SDLoc.
CondCode
ISD::CondCode enum - These are ordered carefully to make the bitfields below work out...
op_iterator op_begin() const
TargetConstant* - Like Constant*, but the DAG does not do any folding, simplification, or lowering of the constant.
READCYCLECOUNTER - This corresponds to the readcyclecounter intrinsic.
static bool useSinCos(SDNode *Node)
Only issue sincos libcall if both sin and cos are needed.
bool isSignedIntSetCC(CondCode Code)
Return true if this is a setcc instruction that performs a signed comparison when used with integer o...
amdgpu Simplify well known AMD library false Value * Callee
RESULT = INTRINSIC_WO_CHAIN(INTRINSICID, arg1, arg2, ...) This node represents a target intrinsic fun...
MVT getVectorElementType() const
UNDEF - An undefined node.
This class is used to represent ISD::STORE nodes.
FP_TO_[US]INT - Convert a floating point value to a signed or unsigned integer.
BUILD_VECTOR(ELT0, ELT1, ELT2, ELT3,...) - Return a vector with the specified, possibly variable...
MVT getSimpleValueType() const
Return the simple ValueType of the referenced return value.
bool bitsGT(EVT VT) const
Return true if this has more bits than VT.
bool isVoidTy() const
Return true if this is 'void'.
constexpr uint64_t MinAlign(uint64_t A, uint64_t B)
A and B are either alignments or offsets.
unsigned getNumValues() const
Return the number of values defined/returned by this operator.
const SDValue & getBasePtr() const
bool bitsGE(EVT VT) const
Return true if this has no less bits than VT.
SDValue getVectorShuffle(EVT VT, const SDLoc &dl, SDValue N1, SDValue N2, ArrayRef< int > Mask)
Return an ISD::VECTOR_SHUFFLE node.
Type * getReturnType() const
Returns the type of the ret val.
OUTCHAIN = INTRINSIC_VOID(INCHAIN, INTRINSICID, arg1, arg2, ...) This node represents a target intrin...
READ_REGISTER, WRITE_REGISTER - This node represents llvm.register on the DAG, which implements the n...
uint64_t getZExtValue() const
Return the constant as a 64-bit unsigned integer value after it has been zero extended as appropriate...
void Legalize()
This transforms the SelectionDAG into a SelectionDAG that is compatible with the target instruction s...
use_iterator use_begin() const
Provide iteration support to walk over all uses of an SDNode.
constexpr bool isPowerOf2_32(uint32_t Value)
Return true if the argument is a power of two > 0.
The instances of the Type class are immutable: once they are created, they are never changed...
void swap(SmallVectorImpl &RHS)
Simple binary floating point operators.
PowerPC Reduce CR logical Operation
unsigned getVectorNumElements() const
Given a vector type, return the number of elements it contains.
unsigned getScalarSizeInBits() const
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This is an important base class in LLVM.
VAEND, VASTART - VAEND and VASTART have three operands: an input chain, pointer, and a SRCVALUE...
iterator_range< value_op_iterator > op_values() const
const SDValue & getOperand(unsigned Num) const
LoadExtType
LoadExtType enum - This enum defines the three variants of LOADEXT (load with extension).
INSERT_VECTOR_ELT(VECTOR, VAL, IDX) - Returns VECTOR with the element at IDX replaced with VAL...
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
This file contains the declarations for the subclasses of Constant, which represent the different fla...
ConstantFP - Floating Point Values [float, double].
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
static APInt getOneBitSet(unsigned numBits, unsigned BitNo)
Return an APInt with exactly one bit set in the result.
This file declares a class to represent arbitrary precision floating point values and provide a varie...
static Type * getVoidTy(LLVMContext &C)
This class provides iterator support for SDUse operands that use a specific SDNode.
INIT_TRAMPOLINE - This corresponds to the init_trampoline intrinsic.
void ReplaceAllUsesWith(SDValue From, SDValue To)
Modify anything using 'From' to use 'To' instead.
TRAP - Trapping instruction.
AssertSext, AssertZext - These nodes record if a register contains a value that has already been zero...
DEBUGTRAP - Trap intended to get the attention of a debugger.
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
CondCode getSetCCSwappedOperands(CondCode Operation)
Return the operation corresponding to (Y op X) when given the operation for (X op Y)...
std::pair< NoneType, bool > insert(const T &V)
insert - Insert an element into the set if it isn't already there.
VAARG - VAARG has four operands: an input chain, a pointer, a SRCVALUE, and the alignment.
static bool isValueValidForType(EVT VT, const APFloat &Val)
Bit counting operators with an undefined result for zero inputs.
Val, OUTCHAIN = ATOMIC_CMP_SWAP(INCHAIN, ptr, cmp, swap) For double-word atomic operations: ValLo...
X = FP_EXTEND(Y) - Extend a smaller FP type into a larger FP type.
std::vector< ArgListEntry > ArgListTy
static UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
This structure contains all information that is necessary for lowering calls.
This class contains a discriminated union of information about pointers in memory operands...
unsigned getNumOperands() const
Return the number of values used by this operation.
Fast - This calling convention attempts to make calls as fast as possible (e.g.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
APInt lshr(unsigned shiftAmt) const
Logical right-shift function.
EH_LABEL - Represents a label in mid basic block used to track locations needed for debug and excepti...
const APFloat & getValueAPF() const
LegalizeAction
This enum indicates whether operations are valid for a target, and if not, what action should be used...
bool use_empty() const
Return true if there are no uses of this node.
static APInt getSignMask(unsigned BitWidth)
Get the SignMask for a specific bit width.
TokenFactor - This node takes multiple tokens as input and produces a single token result...
void dump() const
Dump this node, for debugging.
const TargetLowering & getTargetLoweringInfo() const
A SetVector that performs no allocations if smaller than a certain size.
unsigned getStoreSizeInBits() const
Return the number of bits overwritten by a store of the specified value type.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
This is the shared class of boolean and integer constants.
bool erase(PtrType Ptr)
erase - If the set contains the specified pointer, remove it and return true, otherwise return false...
EXTRACT_VECTOR_ELT(VECTOR, IDX) - Returns a single element from VECTOR identified by the (potentially...
EVT getVectorElementType() const
Given a vector type, return the type of each element.
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
X = FP_ROUND_INREG(Y, VT) - This operator takes an FP register, and rounds it to a floating point val...
static APInt getSplat(unsigned NewLen, const APInt &V)
Return a value containing V broadcasted over NewLen bits.
BRCOND - Conditional branch.
A collection of metadata nodes that might be associated with a memory access used by the alias-analys...
Byte Swap and Counting operators.
FP16_TO_FP, FP_TO_FP16 - These operators are used to perform promotions and truncation for half-preci...
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
CallLoweringInfo & setSExtResult(bool Value=true)
static Constant * get(Type *Ty, uint64_t V, bool isSigned=false)
If Ty is a vector type, return a Constant with a splat of the given value.
Represents one node in the SelectionDAG.
CondCode getSetCCInverse(CondCode Operation, bool isInteger)
Return the operation corresponding to !(X op Y), where 'op' is a valid SetCC operation.
double BitsToDouble(uint64_t Bits)
This function takes a 64-bit integer and returns the bit equivalent double.
MVT getScalarType() const
If this is a vector, return the element type, otherwise return this.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
MachinePointerInfo getWithOffset(int64_t O) const
unsigned Log2_32(uint32_t Value)
Return the floor log base 2 of the specified value, -1 if the value is zero.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
static EVT getVectorVT(LLVMContext &Context, EVT VT, unsigned NumElements, bool IsScalable=false)
Returns the EVT that represents a vector NumElements in length, where each element is of type VT...
EVT getMemoryVT() const
Return the type of the in-memory value.
bool isTypeLegal(EVT VT) const
Return true if the target has native support for the specified value type.
Class for arbitrary precision integers.
Select(COND, TRUEVAL, FALSEVAL).
bool bitsLT(EVT VT) const
Return true if this has less bits than VT.
static use_iterator use_end()
ZERO_EXTEND - Used for integer types, zeroing the new bits.
ANY_EXTEND - Used for integer types. The high bits are undefined.
FCOPYSIGN(X, Y) - Return the value of X with the sign of Y.
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
Flags
Flags values. These may be or'd together.
GET_DYNAMIC_AREA_OFFSET - get offset from native SP to the address of the most recent dynamic alloca...
static MachinePointerInfo getFixedStack(MachineFunction &MF, int FI, int64_t Offset=0)
Return a MachinePointerInfo record that refers to the specified FrameIndex.
BR_JT - Jumptable branch.
VACOPY - VACOPY has 5 operands: an input chain, a destination pointer, a source pointer, a SRCVALUE for the destination, and a SRCVALUE for the source.
These are IR-level optimization flags that may be propagated to SDNodes.
bool isVector() const
Return true if this is a vector value type.
const SDValue & getValue() const
Bitwise operators - logical and, logical or, logical xor.
pointer data()
Return a pointer to the vector's buffer, even if empty().
SMUL_LOHI/UMUL_LOHI - Multiply two integers of type iN, producing a signed/unsigned value of type i[2...
LLVM_NODISCARD bool empty() const
SIGN_EXTEND_INREG - This operator atomically performs a SHL/SRA pair to sign extend a small value in ...
LOAD and STORE have token chains as their first operand, then the same operands as an LLVM load/store...
virtual EVT getSetCCResultType(const DataLayout &DL, LLVMContext &Context, EVT VT) const
Return the ValueType of the result of SETCC operations.
static bool isSigned(Value *V)
Can the given value generate sign bits.
const ConstantInt * getConstantIntValue() const
Flags getFlags() const
Return the raw flags of the source value,.
unsigned getOpcode() const
FSINCOS - Compute both fsin and fcos as a single operation.
SDValue getValue(unsigned R) const
static MachinePointerInfo getConstantPool(MachineFunction &MF)
Return a MachinePointerInfo record that refers to the constant pool.
RESULT, OUTCHAIN = EH_SJLJ_SETJMP(INCHAIN, buffer) This corresponds to the eh.sjlj.setjmp intrinsic.
bool reachesChainWithoutSideEffects(SDValue Dest, unsigned Depth=2) const
Return true if this operand (which must be a chain) reaches the specified operand without crossing an...
OUTCHAIN = EH_RETURN(INCHAIN, OFFSET, HANDLER) - This node represents 'eh_return' gcc dwarf builtin...
const MachinePointerInfo & getPointerInfo() const
CONCAT_VECTORS(VECTOR0, VECTOR1, ...) - Given a number of values of vector type with the same length ...
This class is used to form a handle around another node that is persistent and is updated across invo...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static bool isSinCosLibcallAvailable(SDNode *Node, const TargetLowering &TLI)
Return true if sincos libcall is available.
LLVM Value Representation.
uint64_t getConstantOperandVal(unsigned Num) const
Helper method returns the integer value of a ConstantSDNode operand.
FMA - Perform a * b + c with no intermediate rounding step.
static bool ExpandBVWithShuffles(SDNode *Node, SelectionDAG &DAG, const TargetLowering &TLI, SDValue &Res)
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
EVT changeTypeToInteger()
Return the type converted to an equivalently sized integer or vector with integer element type...
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.
PREFETCH - This corresponds to a prefetch intrinsic.
Primary interface to the complete machine description for the target machine.
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
const APFloat & getValueAPF() const
FMAD - Perform a * b + c, while getting the same result as the separately rounded operations...
SetCC operator - This evaluates to a true value iff the condition is true.
APInt bitcastToAPInt() const
bool bitsEq(EVT VT) const
Return true if this has the same number of bits as VT.
MERGE_VALUES - This node takes multiple discrete operands and returns them all as its individual resu...
virtual bool isShuffleMaskLegal(ArrayRef< int >, EVT) const
Targets can use this to indicate that they only support some VECTOR_SHUFFLE operations, those with specific masks.
bool isStrictFPOpcode()
Test if this node is a strict floating point pseudo-op.
static APInt getNullValue(unsigned numBits)
Get the '0' value.
const SDValue & getOperand(unsigned i) const
OUTCHAIN = ATOMIC_STORE(INCHAIN, ptr, val) This corresponds to "store atomic" instruction.
TRUNCATE - Completely drop the high bits.
bool hasPredecessor(const SDNode *N) const
Return true if N is a predecessor of this node.
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation...
FNEG, FABS, FSQRT, FSIN, FCOS, FPOWI, FPOW, FLOG, FLOG2, FLOG10, FEXP, FEXP2, FCEIL, FTRUNC, FRINT, FNEARBYINT, FROUND, FFLOOR - Perform various unary floating point operations.
static EVT getIntegerVT(LLVMContext &Context, unsigned BitWidth)
Returns the EVT that represents an integer with the given number of bits.
Val, OUTCHAIN = ATOMIC_LOAD(INCHAIN, ptr) This corresponds to "load atomic" instruction.
LLVMContext * getContext() const
SCALAR_TO_VECTOR(VAL) - This represents the operation of loading a scalar value into element 0 of the...
static Constant * get(ArrayRef< Constant *> V)
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
CallLoweringInfo & setLibCallee(CallingConv::ID CC, Type *ResultType, SDValue Target, ArgListTy &&ArgsList)
Carry-using nodes for multiple precision addition and subtraction.
EVT getHalfSizedIntegerVT(LLVMContext &Context) const
Finds the smallest simple value type that is greater than or equal to half the width of this EVT...
This file describes how to lower LLVM code to machine code.
const char * getLibcallName(RTLIB::Libcall Call) const
Get the libcall routine name for the specified libcall.
MULHU/MULHS - Multiply high - Multiply two integers of type iN, producing an unsigned/signed value of...
This class is used to represent ISD::LOAD nodes.
DYNAMIC_STACKALLOC - Allocate some number of bytes on the stack aligned to a specified boundary...