llvm.org GIT mirror llvm / d752e0f
Added invariant field to the DAG.getLoad method and changed all calls. When this field is true it means that the load is from constant (runt-time or compile-time) and so can be hoisted from loops or moved around other memory accesses git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144100 91177308-0d34-0410-b5e6-96231b3b80d8 Pete Cooper 8 years ago
26 changed file(s) with 253 addition(s) and 202 deletion(s). Raw diff Collapse all Expand all
9494 MOVolatile = 4,
9595 /// The memory access is non-temporal.
9696 MONonTemporal = 8,
97 /// The memory access is invariant.
98 MOInvariant = 16,
9799 // This is the number of bits we need to represent flags.
98 MOMaxBits = 4
100 MOMaxBits = 5
99101 };
100102
101103 /// MachineMemOperand - Construct an MachineMemOperand object with the
140142 bool isStore() const { return Flags & MOStore; }
141143 bool isVolatile() const { return Flags & MOVolatile; }
142144 bool isNonTemporal() const { return Flags & MONonTemporal; }
145 bool isInvariant() const { return Flags & MOInvariant; }
143146
144147 /// refineAlignment - Update this MachineMemOperand to reflect the alignment
145148 /// of MMO, if it has a greater alignment. This must only be used when the
649649 ///
650650 SDValue getLoad(EVT VT, DebugLoc dl, SDValue Chain, SDValue Ptr,
651651 MachinePointerInfo PtrInfo, bool isVolatile,
652 bool isNonTemporal, unsigned Alignment,
652 bool isNonTemporal, bool isInvariant, unsigned Alignment,
653653 const MDNode *TBAAInfo = 0);
654654 SDValue getExtLoad(ISD::LoadExtType ExtType, DebugLoc dl, EVT VT,
655655 SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo,
662662 EVT VT, DebugLoc dl,
663663 SDValue Chain, SDValue Ptr, SDValue Offset,
664664 MachinePointerInfo PtrInfo, EVT MemVT,
665 bool isVolatile, bool isNonTemporal, unsigned Alignment,
666 const MDNode *TBAAInfo = 0);
665 bool isVolatile, bool isNonTemporal, bool isInvariant,
666 unsigned Alignment, const MDNode *TBAAInfo = 0);
667667 SDValue getLoad(ISD::MemIndexedMode AM, ISD::LoadExtType ExtType,
668668 EVT VT, DebugLoc dl,
669669 SDValue Chain, SDValue Ptr, SDValue Offset,
916916 // with MachineMemOperand information.
917917 bool isVolatile() const { return (SubclassData >> 5) & 1; }
918918 bool isNonTemporal() const { return (SubclassData >> 6) & 1; }
919 bool isInvariant() const { return (SubclassData >> 7) & 1; }
919920
920921 AtomicOrdering getOrdering() const {
921 return AtomicOrdering((SubclassData >> 7) & 15);
922 return AtomicOrdering((SubclassData >> 8) & 15);
922923 }
923924 SynchronizationScope getSynchScope() const {
924 return SynchronizationScope((SubclassData >> 11) & 1);
925 return SynchronizationScope((SubclassData >> 12) & 1);
925926 }
926927
927928 /// Returns the SrcValue and offset that describes the location of the access
992993 "Ordering may not require more than 4 bits!");
993994 assert((SynchScope & 1) == SynchScope &&
994995 "SynchScope may not require more than 1 bit!");
995 SubclassData |= Ordering << 7;
996 SubclassData |= SynchScope << 11;
996 SubclassData |= Ordering << 8;
997 SubclassData |= SynchScope << 12;
997998 assert(getOrdering() == Ordering && "Ordering encoding error!");
998999 assert(getSynchScope() == SynchScope && "Synch-scope encoding error!");
9991000
12521252 E = memoperands_end(); I != E; ++I) {
12531253 if ((*I)->isVolatile()) return false;
12541254 if ((*I)->isStore()) return false;
1255 if ((*I)->isInvariant()) return true;
12551256
12561257 if (const Value *V = (*I)->getValue()) {
12571258 // A load from a constant PseudoSourceValue is invariant.
47014701 if (ExtType == ISD::NON_EXTLOAD)
47024702 Load = DAG.getLoad(VT, N0.getDebugLoc(), LN0->getChain(), NewPtr,
47034703 LN0->getPointerInfo().getWithOffset(PtrOff),
4704 LN0->isVolatile(), LN0->isNonTemporal(), NewAlign);
4704 LN0->isVolatile(), LN0->isNonTemporal(),
4705 LN0->isInvariant(), NewAlign);
47054706 else
47064707 Load = DAG.getExtLoad(ExtType, N0.getDebugLoc(), VT, LN0->getChain(),NewPtr,
47074708 LN0->getPointerInfo().getWithOffset(PtrOff),
49304931 (!LegalOperations || TLI.isOperationLegal(ISD::LOAD, VT)))
49314932 return DAG.getLoad(VT, N->getDebugLoc(), LD1->getChain(),
49324933 LD1->getBasePtr(), LD1->getPointerInfo(),
4933 false, false, Align);
4934 false, false, false, Align);
49344935 }
49354936
49364937 return SDValue();
50005001 SDValue Load = DAG.getLoad(VT, N->getDebugLoc(), LN0->getChain(),
50015002 LN0->getBasePtr(), LN0->getPointerInfo(),
50025003 LN0->isVolatile(), LN0->isNonTemporal(),
5003 OrigAlign);
5004 LN0->isInvariant(), OrigAlign);
50045005 AddToWorkList(N);
50055006 CombineTo(N0.getNode(),
50065007 DAG.getNode(ISD::BITCAST, N0.getDebugLoc(),
62186219 ReplLoad = DAG.getLoad(N->getValueType(0), LD->getDebugLoc(),
62196220 BetterChain, Ptr, LD->getPointerInfo(),
62206221 LD->isVolatile(), LD->isNonTemporal(),
6221 LD->getAlignment());
6222 LD->isInvariant(), LD->getAlignment());
62226223 } else {
62236224 ReplLoad = DAG.getExtLoad(LD->getExtensionType(), LD->getDebugLoc(),
62246225 LD->getValueType(0),
64826483 LD->getChain(), NewPtr,
64836484 LD->getPointerInfo().getWithOffset(PtrOff),
64846485 LD->isVolatile(), LD->isNonTemporal(),
6485 NewAlign);
6486 LD->isInvariant(), NewAlign);
64866487 SDValue NewVal = DAG.getNode(Opc, Value.getDebugLoc(), NewVT, NewLD,
64876488 DAG.getConstant(NewImm, NewVT));
64886489 SDValue NewST = DAG.getStore(Chain, N->getDebugLoc(),
65426543 SDValue NewLD = DAG.getLoad(IntVT, Value.getDebugLoc(),
65436544 LD->getChain(), LD->getBasePtr(),
65446545 LD->getPointerInfo(),
6545 false, false, LDAlign);
6546 false, false, false, LDAlign);
65466547
65476548 SDValue NewST = DAG.getStore(NewLD.getValue(1), N->getDebugLoc(),
65486549 NewLD, ST->getBasePtr(),
69276928
69286929 return DAG.getLoad(LVT, N->getDebugLoc(), LN0->getChain(), NewPtr,
69296930 LN0->getPointerInfo().getWithOffset(PtrOff),
6930 LN0->isVolatile(), LN0->isNonTemporal(), Align);
6931 LN0->isVolatile(), LN0->isNonTemporal(),
6932 LN0->isInvariant(), Align);
69316933 }
69326934
69336935 return SDValue();
74967498 // FIXME: Discards pointer info.
74977499 LLD->getChain(), Addr, MachinePointerInfo(),
74987500 LLD->isVolatile(), LLD->isNonTemporal(),
7499 LLD->getAlignment());
7501 LLD->isInvariant(), LLD->getAlignment());
75007502 } else {
75017503 Load = DAG.getExtLoad(LLD->getExtensionType() == ISD::EXTLOAD ?
75027504 RLD->getExtensionType() : LLD->getExtensionType(),
76127614 AddToWorkList(CPIdx.getNode());
76137615 return DAG.getLoad(TV->getValueType(0), DL, DAG.getEntryNode(), CPIdx,
76147616 MachinePointerInfo::getConstantPool(), false,
7615 false, Alignment);
7617 false, false, Alignment);
76167618
76177619 }
76187620 }
258258 }
259259 SDValue Result =
260260 DAG.getLoad(OrigVT, dl, DAG.getEntryNode(), CPIdx,
261 MachinePointerInfo::getConstantPool(), false, false,
261 MachinePointerInfo::getConstantPool(), false, false, false,
262262 Alignment);
263263 return Result;
264264 }
314314 // Load one integer register's worth from the stack slot.
315315 SDValue Load = DAG.getLoad(RegVT, dl, Store, StackPtr,
316316 MachinePointerInfo(),
317 false, false, 0);
317 false, false, false, 0);
318318 // Store it to the final location. Remember the store.
319319 Stores.push_back(DAG.getStore(Load.getValue(1), dl, Load, Ptr,
320320 ST->getPointerInfo().getWithOffset(Offset),
402402 // then bitconvert to floating point or vector.
403403 SDValue newLoad = DAG.getLoad(intVT, dl, Chain, Ptr, LD->getPointerInfo(),
404404 LD->isVolatile(),
405 LD->isNonTemporal(), LD->getAlignment());
405 LD->isNonTemporal(),
406 LD->isInvariant(), LD->getAlignment());
406407 SDValue Result = DAG.getNode(ISD::BITCAST, dl, LoadedVT, newLoad);
407408 if (VT.isFloatingPoint() && LoadedVT != VT)
408409 Result = DAG.getNode(ISD::FP_EXTEND, dl, VT, Result);
433434 SDValue Load = DAG.getLoad(RegVT, dl, Chain, Ptr,
434435 LD->getPointerInfo().getWithOffset(Offset),
435436 LD->isVolatile(), LD->isNonTemporal(),
437 LD->isInvariant(),
436438 MinAlign(LD->getAlignment(), Offset));
437439 // Follow the load with a store to the stack slot. Remember the store.
438440 Stores.push_back(DAG.getStore(Load.getValue(1), dl, Load, StackPtr,
569571 false, false, 0);
570572 // Load the updated vector.
571573 return DAG.getLoad(VT, dl, Ch, StackPtr,
572 MachinePointerInfo::getFixedStack(SPFI), false, false, 0);
574 MachinePointerInfo::getFixedStack(SPFI), false, false,
575 false, 0);
573576 }
574577
575578
910913
911914 Tmp1 = DAG.getLoad(NVT, dl, Tmp1, Tmp2, LD->getPointerInfo(),
912915 LD->isVolatile(), LD->isNonTemporal(),
913 LD->getAlignment());
916 LD->isInvariant(), LD->getAlignment());
914917 Tmp3 = DAG.getNode(ISD::BITCAST, dl, VT, Tmp1);
915918 Tmp4 = Tmp1.getValue(1);
916919 break;
10851088 SDValue Load = DAG.getLoad(SrcVT, dl, Tmp1, Tmp2,
10861089 LD->getPointerInfo(),
10871090 LD->isVolatile(), LD->isNonTemporal(),
1088 LD->getAlignment());
1091 LD->isInvariant(), LD->getAlignment());
10891092 unsigned ExtendOp;
10901093 switch (ExtType) {
10911094 case ISD::EXTLOAD:
13351338
13361339 if (Op.getValueType().isVector())
13371340 return DAG.getLoad(Op.getValueType(), dl, Ch, StackPtr,MachinePointerInfo(),
1338 false, false, 0);
1341 false, false, false, 0);
13391342 return DAG.getExtLoad(ISD::EXTLOAD, dl, Op.getValueType(), Ch, StackPtr,
13401343 MachinePointerInfo(),
13411344 Vec.getValueType().getVectorElementType(),
13831386
13841387 // Finally, load the updated vector.
13851388 return DAG.getLoad(Op.getValueType(), dl, Ch, StackPtr, PtrInfo,
1386 false, false, 0);
1389 false, false, false, 0);
13871390 }
13881391
13891392 SDValue SelectionDAGLegalize::ExpandVectorBuildThroughStack(SDNode* Node) {
14331436 StoreChain = DAG.getEntryNode();
14341437
14351438 // Result is a load from the stack slot.
1436 return DAG.getLoad(VT, dl, StoreChain, FIPtr, PtrInfo, false, false, 0);
1439 return DAG.getLoad(VT, dl, StoreChain, FIPtr, PtrInfo,
1440 false, false, false, 0);
14371441 }
14381442
14391443 SDValue SelectionDAGLegalize::ExpandFCOPYSIGN(SDNode* Node) {
14621466 assert(FloatVT.isByteSized() && "Unsupported floating point type!");
14631467 // Load out a legal integer with the same sign bit as the float.
14641468 SignBit = DAG.getLoad(LoadTy, dl, Ch, StackPtr, MachinePointerInfo(),
1465 false, false, 0);
1469 false, false, false, 0);
14661470 } else { // Little endian
14671471 SDValue LoadPtr = StackPtr;
14681472 // The float may be wider than the integer we are going to load. Advance
14731477 LoadPtr, DAG.getIntPtrConstant(ByteOffset));
14741478 // Load a legal integer containing the sign bit.
14751479 SignBit = DAG.getLoad(LoadTy, dl, Ch, LoadPtr, MachinePointerInfo(),
1476 false, false, 0);
1480 false, false, false, 0);
14771481 // Move the sign bit to the top bit of the loaded integer.
14781482 unsigned BitShift = LoadTy.getSizeInBits() -
14791483 (FloatVT.getSizeInBits() - 8 * ByteOffset);
16151619 // Result is a load from the stack slot.
16161620 if (SlotSize == DestSize)
16171621 return DAG.getLoad(DestVT, dl, Store, FIPtr, PtrInfo,
1618 false, false, DestAlign);
1622 false, false, false, DestAlign);
16191623
16201624 assert(SlotSize < DestSize && "Unknown extension!");
16211625 return DAG.getExtLoad(ISD::EXTLOAD, dl, DestVT, Store, FIPtr,
16381642 false, false, 0);
16391643 return DAG.getLoad(Node->getValueType(0), dl, Ch, StackPtr,
16401644 MachinePointerInfo::getFixedStack(SPFI),
1641 false, false, 0);
1645 false, false, false, 0);
16421646 }
16431647
16441648
17121716 unsigned Alignment = cast(CPIdx)->getAlignment();
17131717 return DAG.getLoad(VT, dl, DAG.getEntryNode(), CPIdx,
17141718 MachinePointerInfo::getConstantPool(),
1715 false, false, Alignment);
1719 false, false, false, Alignment);
17161720 }
17171721
17181722 if (!MoreThanTwoValues) {
19741978
19751979 // Remainder is loaded back from the stack frame.
19761980 SDValue Rem = DAG.getLoad(RetVT, dl, CallInfo.second, FIPtr,
1977 MachinePointerInfo(), false, false, 0);
1981 MachinePointerInfo(), false, false, false, 0);
19781982 Results.push_back(CallInfo.first);
19791983 Results.push_back(Rem);
19801984 }
20232027 false, false, 0);
20242028 // load the constructed double
20252029 SDValue Load = DAG.getLoad(MVT::f64, dl, Store2, StackSlot,
2026 MachinePointerInfo(), false, false, 0);
2030 MachinePointerInfo(), false, false, false, 0);
20272031 // FP constant to bias correct the final result
20282032 SDValue Bias = DAG.getConstantFP(isSigned ?
20292033 BitsToDouble(0x4330000080000000ULL) :
21632167 if (DestVT == MVT::f32)
21642168 FudgeInReg = DAG.getLoad(MVT::f32, dl, DAG.getEntryNode(), CPIdx,
21652169 MachinePointerInfo::getConstantPool(),
2166 false, false, Alignment);
2170 false, false, false, Alignment);
21672171 else {
21682172 SDValue Load = DAG.getExtLoad(ISD::EXTLOAD, dl, DestVT,
21692173 DAG.getEntryNode(), CPIdx,
27022706 unsigned Align = Node->getConstantOperandVal(3);
27032707
27042708 SDValue VAListLoad = DAG.getLoad(TLI.getPointerTy(), dl, Tmp1, Tmp2,
2705 MachinePointerInfo(V), false, false, 0);
2709 MachinePointerInfo(V),
2710 false, false, false, 0);
27062711 SDValue VAList = VAListLoad;
27072712
27082713 if (Align > TLI.getMinStackArgumentAlignment()) {
27272732 MachinePointerInfo(V), false, false, 0);
27282733 // Load the actual argument out of the pointer VAList
27292734 Results.push_back(DAG.getLoad(VT, dl, Tmp3, VAList, MachinePointerInfo(),
2730 false, false, 0));
2735 false, false, false, 0));
27312736 Results.push_back(Results[0].getValue(1));
27322737 break;
27332738 }
27382743 const Value *VS = cast(Node->getOperand(4))->getValue();
27392744 Tmp1 = DAG.getLoad(TLI.getPointerTy(), dl, Node->getOperand(0),
27402745 Node->getOperand(2), MachinePointerInfo(VS),
2741 false, false, 0);
2746 false, false, false, 0);
27422747 Tmp1 = DAG.getStore(Tmp1.getValue(1), dl, Tmp1, Node->getOperand(1),
27432748 MachinePointerInfo(VD), false, false, 0);
27442749 Results.push_back(Tmp1);
478478 if (L->getExtensionType() == ISD::NON_EXTLOAD) {
479479 NewL = DAG.getLoad(L->getAddressingMode(), L->getExtensionType(),
480480 NVT, dl, L->getChain(), L->getBasePtr(), L->getOffset(),
481 L->getPointerInfo(), NVT,
482 L->isVolatile(), L->isNonTemporal(), L->getAlignment());
481 L->getPointerInfo(), NVT, L->isVolatile(),
482 L->isNonTemporal(), false, L->getAlignment());
483483 // Legalized the chain result - switch anything that used the old chain to
484484 // use the new one.
485485 ReplaceValueWith(SDValue(N, 1), NewL.getValue(1));
491491 L->getMemoryVT(), dl, L->getChain(),
492492 L->getBasePtr(), L->getOffset(), L->getPointerInfo(),
493493 L->getMemoryVT(), L->isVolatile(),
494 L->isNonTemporal(), L->getAlignment());
494 L->isNonTemporal(), false, L->getAlignment());
495495 // Legalized the chain result - switch anything that used the old chain to
496496 // use the new one.
497497 ReplaceValueWith(SDValue(N, 1), NewL.getValue(1));
17771777 unsigned Alignment = N->getAlignment();
17781778 bool isVolatile = N->isVolatile();
17791779 bool isNonTemporal = N->isNonTemporal();
1780 bool isInvariant = N->isInvariant();
17801781 DebugLoc dl = N->getDebugLoc();
17811782
17821783 assert(NVT.isByteSized() && "Expanded type not byte sized!");
18071808 } else if (TLI.isLittleEndian()) {
18081809 // Little-endian - low bits are at low addresses.
18091810 Lo = DAG.getLoad(NVT, dl, Ch, Ptr, N->getPointerInfo(),
1810 isVolatile, isNonTemporal, Alignment);
1811 isVolatile, isNonTemporal, isInvariant, Alignment);
18111812
18121813 unsigned ExcessBits =
18131814 N->getMemoryVT().getSizeInBits() - NVT.getSizeInBits();
23092310
23102311 SplitInteger(CallInfo.first, Lo, Hi);
23112312 SDValue Temp2 = DAG.getLoad(PtrVT, dl, CallInfo.second, Temp,
2312 MachinePointerInfo(), false, false, 0);
2313 MachinePointerInfo(), false, false, false, 0);
23132314 SDValue Ofl = DAG.getSetCC(dl, N->getValueType(1), Temp2,
23142315 DAG.getConstant(0, PtrVT),
23152316 ISD::SETNE);
888888 MachinePointerInfo(), false, false, 0);
889889 // Result is a load from the stack slot.
890890 return DAG.getLoad(DestVT, dl, Store, StackPtr, MachinePointerInfo(),
891 false, false, 0);
891 false, false, false, 0);
892892 }
893893
894894 /// CustomLowerNode - Replace the node's results with custom code provided
129129 false, false, 0);
130130
131131 // Load the first half from the stack slot.
132 Lo = DAG.getLoad(NOutVT, dl, Store, StackPtr, PtrInfo, false, false, 0);
132 Lo = DAG.getLoad(NOutVT, dl, Store, StackPtr, PtrInfo,
133 false, false, false, 0);
133134
134135 // Increment the pointer to the other half.
135136 unsigned IncrementSize = NOutVT.getSizeInBits() / 8;
139140 // Load the second half from the stack slot.
140141 Hi = DAG.getLoad(NOutVT, dl, Store, StackPtr,
141142 PtrInfo.getWithOffset(IncrementSize), false,
142 false, MinAlign(Alignment, IncrementSize));
143 false, false, MinAlign(Alignment, IncrementSize));
143144
144145 // Handle endianness of the load.
145146 if (TLI.isBigEndian())
211212 unsigned Alignment = LD->getAlignment();
212213 bool isVolatile = LD->isVolatile();
213214 bool isNonTemporal = LD->isNonTemporal();
215 bool isInvariant = LD->isInvariant();
214216
215217 assert(NVT.isByteSized() && "Expanded type not byte sized!");
216218
217219 Lo = DAG.getLoad(NVT, dl, Chain, Ptr, LD->getPointerInfo(),
218 isVolatile, isNonTemporal, Alignment);
220 isVolatile, isNonTemporal, isInvariant, Alignment);
219221
220222 // Increment the pointer to the other half.
221223 unsigned IncrementSize = NVT.getSizeInBits() / 8;
223225 DAG.getIntPtrConstant(IncrementSize));
224226 Hi = DAG.getLoad(NVT, dl, Chain, Ptr,
225227 LD->getPointerInfo().getWithOffset(IncrementSize),
226 isVolatile, isNonTemporal,
228 isVolatile, isNonTemporal, isInvariant,
227229 MinAlign(Alignment, IncrementSize));
228230
229231 // Build a factor node to remember that this load is independent of the
193193 N->getPointerInfo(),
194194 N->getMemoryVT().getVectorElementType(),
195195 N->isVolatile(), N->isNonTemporal(),
196 N->getOriginalAlignment());
196 N->isInvariant(), N->getOriginalAlignment());
197197
198198 // Legalized the chain result - switch anything that used the old chain to
199199 // use the new one.
676676
677677 // Load the Lo part from the stack slot.
678678 Lo = DAG.getLoad(Lo.getValueType(), dl, Store, StackPtr, MachinePointerInfo(),
679 false, false, 0);
679 false, false, false, 0);
680680
681681 // Increment the pointer to the other part.
682682 unsigned IncrementSize = Lo.getValueType().getSizeInBits() / 8;
685685
686686 // Load the Hi part from the stack slot.
687687 Hi = DAG.getLoad(Hi.getValueType(), dl, Store, StackPtr, MachinePointerInfo(),
688 false, false, MinAlign(Alignment, IncrementSize));
688 false, false, false, MinAlign(Alignment, IncrementSize));
689689 }
690690
691691 void DAGTypeLegalizer::SplitVecRes_SCALAR_TO_VECTOR(SDNode *N, SDValue &Lo,
712712 unsigned Alignment = LD->getOriginalAlignment();
713713 bool isVolatile = LD->isVolatile();
714714 bool isNonTemporal = LD->isNonTemporal();
715 bool isInvariant = LD->isInvariant();
715716
716717 EVT LoMemVT, HiMemVT;
717718 GetSplitDestVTs(MemoryVT, LoMemVT, HiMemVT);
718719
719720 Lo = DAG.getLoad(ISD::UNINDEXED, ExtType, LoVT, dl, Ch, Ptr, Offset,
720721 LD->getPointerInfo(), LoMemVT, isVolatile, isNonTemporal,
721 Alignment);
722 isInvariant, Alignment);
722723
723724 unsigned IncrementSize = LoMemVT.getSizeInBits()/8;
724725 Ptr = DAG.getNode(ISD::ADD, dl, Ptr.getValueType(), Ptr,
725726 DAG.getIntPtrConstant(IncrementSize));
726727 Hi = DAG.getLoad(ISD::UNINDEXED, ExtType, HiVT, dl, Ch, Ptr, Offset,
727728 LD->getPointerInfo().getWithOffset(IncrementSize),
728 HiMemVT, isVolatile, isNonTemporal, Alignment);
729 HiMemVT, isVolatile, isNonTemporal, isInvariant, Alignment);
729730
730731 // Build a factor node to remember that this load is independent of the
731732 // other one.
22752276 unsigned Align = LD->getAlignment();
22762277 bool isVolatile = LD->isVolatile();
22772278 bool isNonTemporal = LD->isNonTemporal();
2279 bool isInvariant = LD->isInvariant();
22782280
22792281 int LdWidth = LdVT.getSizeInBits();
22802282 int WidthDiff = WidenWidth - LdWidth; // Difference
22842286 EVT NewVT = FindMemType(DAG, TLI, LdWidth, WidenVT, LdAlign, WidthDiff);
22852287 int NewVTWidth = NewVT.getSizeInBits();
22862288 SDValue LdOp = DAG.getLoad(NewVT, dl, Chain, BasePtr, LD->getPointerInfo(),
2287 isVolatile, isNonTemporal, Align);
2289 isVolatile, isNonTemporal, isInvariant, Align);
22882290 LdChain.push_back(LdOp.getValue(1));
22892291
22902292 // Check if we can load the element with one instruction
23312333 SDValue LdOp = DAG.getLoad(NewVT, dl, Chain, BasePtr,
23322334 LD->getPointerInfo().getWithOffset(Offset),
23332335 isVolatile,
2334 isNonTemporal, MinAlign(Align, Increment));
2336 isNonTemporal, isInvariant,
2337 MinAlign(Align, Increment));
23352338 LdChain.push_back(LdOp.getValue(1));
23362339 LdOps.push_back(LdOp);
23372340
474474 ///
475475 static inline unsigned
476476 encodeMemSDNodeFlags(int ConvType, ISD::MemIndexedMode AM, bool isVolatile,
477 bool isNonTemporal) {
477 bool isNonTemporal, bool isInvariant) {
478478 assert((ConvType & 3) == ConvType &&
479479 "ConvType may not require more than 2 bits!");
480480 assert((AM & 7) == AM &&
482482 return ConvType |
483483 (AM << 2) |
484484 (isVolatile << 5) |
485 (isNonTemporal << 6);
485 (isNonTemporal << 6) |
486 (isInvariant << 7);
486487 }
487488
488489 //===----------------------------------------------------------------------===//
35673568 Value = DAG.getLoad(VT, dl, Chain,
35683569 getMemBasePlusOffset(Src, SrcOff, DAG),
35693570 SrcPtrInfo.getWithOffset(SrcOff), isVol,
3570 false, SrcAlign);
3571 false, false, SrcAlign);
35713572 LoadValues.push_back(Value);
35723573 LoadChains.push_back(Value.getValue(1));
35733574 SrcOff += VTSize;
41434144 EVT VT, DebugLoc dl, SDValue Chain,
41444145 SDValue Ptr, SDValue Offset,
41454146 MachinePointerInfo PtrInfo, EVT MemVT,
4146 bool isVolatile, bool isNonTemporal,
4147 bool isVolatile, bool isNonTemporal, bool isInvariant,
41474148 unsigned Alignment, const MDNode *TBAAInfo) {
41484149 assert(Chain.getValueType() == MVT::Other &&
41494150 "Invalid chain type");
41554156 Flags |= MachineMemOperand::MOVolatile;
41564157 if (isNonTemporal)
41574158 Flags |= MachineMemOperand::MONonTemporal;
4159 if (isInvariant)
4160 Flags |= MachineMemOperand::MOInvariant;
41584161
41594162 // If we don't have a PtrInfo, infer the trivial frame index case to simplify
41604163 // clients.
42014204 AddNodeIDNode(ID, ISD::LOAD, VTs, Ops, 3);
42024205 ID.AddInteger(MemVT.getRawBits());
42034206 ID.AddInteger(encodeMemSDNodeFlags(ExtType, AM, MMO->isVolatile(),
4204 MMO->isNonTemporal()));
4207 MMO->isNonTemporal(),
4208 MMO->isInvariant()));
42054209 void *IP = 0;
42064210 if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) {
42074211 cast(E)->refineAlignment(MMO);
42184222 SDValue Chain, SDValue Ptr,
42194223 MachinePointerInfo PtrInfo,
42204224 bool isVolatile, bool isNonTemporal,
4221 unsigned Alignment, const MDNode *TBAAInfo) {
4225 bool isInvariant, unsigned Alignment,
4226 const MDNode *TBAAInfo) {
42224227 SDValue Undef = getUNDEF(Ptr.getValueType());
42234228 return getLoad(ISD::UNINDEXED, ISD::NON_EXTLOAD, VT, dl, Chain, Ptr, Undef,
4224 PtrInfo, VT, isVolatile, isNonTemporal, Alignment, TBAAInfo);
4229 PtrInfo, VT, isVolatile, isNonTemporal, isInvariant, Alignment,
4230 TBAAInfo);
42254231 }
42264232
42274233 SDValue SelectionDAG::getExtLoad(ISD::LoadExtType ExtType, DebugLoc dl, EVT VT,
42314237 unsigned Alignment, const MDNode *TBAAInfo) {
42324238 SDValue Undef = getUNDEF(Ptr.getValueType());
42334239 return getLoad(ISD::UNINDEXED, ExtType, VT, dl, Chain, Ptr, Undef,
4234 PtrInfo, MemVT, isVolatile, isNonTemporal, Alignment,
4240 PtrInfo, MemVT, isVolatile, isNonTemporal, false, Alignment,
42354241 TBAAInfo);
42364242 }
42374243
42444250 "Load is already a indexed load!");
42454251 return getLoad(AM, LD->getExtensionType(), OrigLoad.getValueType(), dl,
42464252 LD->getChain(), Base, Offset, LD->getPointerInfo(),
4247 LD->getMemoryVT(),
4248 LD->isVolatile(), LD->isNonTemporal(), LD->getAlignment());
4253 LD->getMemoryVT(), LD->isVolatile(), LD->isNonTemporal(),
4254 false, LD->getAlignment());
42494255 }
42504256
42514257 SDValue SelectionDAG::getStore(SDValue Chain, DebugLoc dl, SDValue Val,
42874293 AddNodeIDNode(ID, ISD::STORE, VTs, Ops, 4);
42884294 ID.AddInteger(VT.getRawBits());
42894295 ID.AddInteger(encodeMemSDNodeFlags(false, ISD::UNINDEXED, MMO->isVolatile(),
4290 MMO->isNonTemporal()));
4296 MMO->isNonTemporal(), MMO->isInvariant()));
42914297 void *IP = 0;
42924298 if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) {
42934299 cast(E)->refineAlignment(MMO);
43544360 AddNodeIDNode(ID, ISD::STORE, VTs, Ops, 4);
43554361 ID.AddInteger(SVT.getRawBits());
43564362 ID.AddInteger(encodeMemSDNodeFlags(true, ISD::UNINDEXED, MMO->isVolatile(),
4357 MMO->isNonTemporal()));
4363 MMO->isNonTemporal(), MMO->isInvariant()));
43584364 void *IP = 0;
43594365 if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) {
43604366 cast(E)->refineAlignment(MMO);
56785684 MachineMemOperand *mmo)
56795685 : SDNode(Opc, dl, VTs), MemoryVT(memvt), MMO(mmo) {
56805686 SubclassData = encodeMemSDNodeFlags(0, ISD::UNINDEXED, MMO->isVolatile(),
5681 MMO->isNonTemporal());
5687 MMO->isNonTemporal(), MMO->isInvariant());
56825688 assert(isVolatile() == MMO->isVolatile() && "Volatile encoding error!");
56835689 assert(isNonTemporal() == MMO->isNonTemporal() &&
56845690 "Non-temporal encoding error!");
56915697 : SDNode(Opc, dl, VTs, Ops, NumOps),
56925698 MemoryVT(memvt), MMO(mmo) {
56935699 SubclassData = encodeMemSDNodeFlags(0, ISD::UNINDEXED, MMO->isVolatile(),
5694 MMO->isNonTemporal());
5700 MMO->isNonTemporal(), MMO->isInvariant());
56955701 assert(isVolatile() == MMO->isVolatile() && "Volatile encoding error!");
56965702 assert(memvt.getStoreSize() == MMO->getSize() && "Size mismatch!");
56975703 }
31743174
31753175 bool isVolatile = I.isVolatile();
31763176 bool isNonTemporal = I.getMetadata("nontemporal") != 0;
3177 bool isInvariant = I.getMetadata("invariant.load") != 0;
31773178 unsigned Alignment = I.getAlignment();
31783179 const MDNode *TBAAInfo = I.getMetadata(LLVMContext::MD_tbaa);
31793180
32233224 DAG.getConstant(Offsets[i], PtrVT));
32243225 SDValue L = DAG.getLoad(ValueVTs[i], getCurDebugLoc(), Root,
32253226 A, MachinePointerInfo(SV, Offsets[i]), isVolatile,
3226 isNonTemporal, Alignment, TBAAInfo);
3227 isNonTemporal, isInvariant, Alignment, TBAAInfo);
32273228
32283229 Values[i] = L;
32293230 Chains[ChainI] = L.getValue(1);
52635264 SDValue L = DAG.getLoad(Outs[i].VT, getCurDebugLoc(), Result.second,
52645265 Add,
52655266 MachinePointerInfo::getFixedStack(DemoteStackIdx, Offsets[i]),
5266 false, false, 1);
5267 false, false, false, 1);
52675268 Values[i] = L;
52685269 Chains[i] = L.getValue(1);
52695270 }
53745375 SDValue LoadVal = Builder.DAG.getLoad(LoadVT, Builder.getCurDebugLoc(), Root,
53755376 Ptr, MachinePointerInfo(PtrVal),
53765377 false /*volatile*/,
5377 false /*nontemporal*/, 1 /* align=1 */);
5378 false /*nontemporal*/,
5379 false /*isinvariant*/, 1 /* align=1 */);
53785380
53795381 if (!ConstantMemory)
53805382 Builder.PendingLoads.push_back(LoadVal.getValue(1));
20592059 unsigned NewAlign = MinAlign(Lod->getAlignment(), bestOffset);
20602060 SDValue NewLoad = DAG.getLoad(newVT, dl, Lod->getChain(), Ptr,
20612061 Lod->getPointerInfo().getWithOffset(bestOffset),
2062 false, false, NewAlign);
2062 false, false, false, NewAlign);
20632063 return DAG.getSetCC(dl, VT,
20642064 DAG.getNode(ISD::AND, dl, newVT, NewLoad,
20652065 DAG.getConstant(bestMask.trunc(bestWidth),
13381338 SDValue AddArg = DAG.getNode(ISD::ADD, dl, PtrVT, Arg, Const);
13391339 SDValue Load = DAG.getLoad(PtrVT, dl, Chain, AddArg,
13401340 MachinePointerInfo(),
1341 false, false, 0);
1341 false, false, false, 0);
13421342 MemOpChains.push_back(Load.getValue(1));
13431343 RegsToPass.push_back(std::make_pair(j, Load));
13441344 }
14311431 Callee = DAG.getLoad(getPointerTy(), dl,
14321432 DAG.getEntryNode(), CPAddr,
14331433 MachinePointerInfo::getConstantPool(),
1434 false, false, 0);
1434 false, false, false, 0);
14351435 } else if (ExternalSymbolSDNode *S=dyn_cast(Callee)) {
14361436 const char *Sym = S->getSymbol();
14371437
14461446 Callee = DAG.getLoad(getPointerTy(), dl,
14471447 DAG.getEntryNode(), CPAddr,
14481448 MachinePointerInfo::getConstantPool(),
1449 false, false, 0);
1449 false, false, false, 0);
14501450 }
14511451 } else if (GlobalAddressSDNode *G = dyn_cast(Callee)) {
14521452 const GlobalValue *GV = G->getGlobal();
14671467 Callee = DAG.getLoad(getPointerTy(), dl,
14681468 DAG.getEntryNode(), CPAddr,
14691469 MachinePointerInfo::getConstantPool(),
1470 false, false, 0);
1470 false, false, false, 0);
14711471 SDValue PICLabel = DAG.getConstant(ARMPCLabelIndex, MVT::i32);
14721472 Callee = DAG.getNode(ARMISD::PIC_ADD, dl,
14731473 getPointerTy(), Callee, PICLabel);
14961496 Callee = DAG.getLoad(getPointerTy(), dl,
14971497 DAG.getEntryNode(), CPAddr,
14981498 MachinePointerInfo::getConstantPool(),
1499 false, false, 0);
1499 false, false, false, 0);
15001500 SDValue PICLabel = DAG.getConstant(ARMPCLabelIndex, MVT::i32);
15011501 Callee = DAG.getNode(ARMISD::PIC_ADD, dl,
15021502 getPointerTy(), Callee, PICLabel);
19671967 CPAddr = DAG.getNode(ARMISD::Wrapper, DL, PtrVT, CPAddr);
19681968 SDValue Result = DAG.getLoad(PtrVT, DL, DAG.getEntryNode(), CPAddr,
19691969 MachinePointerInfo::getConstantPool(),
1970 false, false, 0);
1970 false, false, false, 0);
19711971 if (RelocM == Reloc::Static)
19721972 return Result;
19731973 SDValue PICLabel = DAG.getConstant(ARMPCLabelIndex, MVT::i32);
19911991 Argument = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, Argument);
19921992 Argument = DAG.getLoad(PtrVT, dl, DAG.getEntryNode(), Argument,
19931993 MachinePointerInfo::getConstantPool(),
1994 false, false, 0);
1994 false, false, false, 0);
19951995 SDValue Chain = Argument.getValue(1);
19961996
19971997 SDValue PICLabel = DAG.getConstant(ARMPCLabelIndex, MVT::i32);
20392039 Offset = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, Offset);
20402040 Offset = DAG.getLoad(PtrVT, dl, Chain, Offset,
20412041 MachinePointerInfo::getConstantPool(),
2042 false, false, 0);
2042 false, false, false, 0);
20432043 Chain = Offset.getValue(1);
20442044
20452045 SDValue PICLabel = DAG.getConstant(ARMPCLabelIndex, MVT::i32);
20472047
20482048 Offset = DAG.getLoad(PtrVT, dl, Chain, Offset,
20492049 MachinePointerInfo::getConstantPool(),
2050 false, false, 0);
2050 false, false, false, 0);
20512051 } else {
20522052 // local exec model
20532053 ARMConstantPoolValue *CPV =
20562056 Offset = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, Offset);
20572057 Offset = DAG.getLoad(PtrVT, dl, Chain, Offset,
20582058 MachinePointerInfo::getConstantPool(),
2059 false, false, 0);
2059 false, false, false, 0);
20602060 }
20612061
20622062 // The address of the thread local variable is the add of the thread
20942094 SDValue Result = DAG.getLoad(PtrVT, dl, DAG.getEntryNode(),
20952095 CPAddr,
20962096 MachinePointerInfo::getConstantPool(),
2097 false, false, 0);
2097 false, false, false, 0);
20982098 SDValue Chain = Result.getValue(1);
20992099 SDValue GOT = DAG.getGLOBAL_OFFSET_TABLE(PtrVT);
21002100 Result = DAG.getNode(ISD::ADD, dl, PtrVT, Result, GOT);
21012101 if (!UseGOTOFF)
21022102 Result = DAG.getLoad(PtrVT, dl, Chain, Result,
2103 MachinePointerInfo::getGOT(), false, false, 0);
2103 MachinePointerInfo::getGOT(),
2104 false, false, false, 0);
21042105 return Result;
21052106 }
21062107
21172118 CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr);
21182119 return DAG.getLoad(PtrVT, dl, DAG.getEntryNode(), CPAddr,
21192120 MachinePointerInfo::getConstantPool(),
2120 false, false, 0);
2121 false, false, false, 0);
21212122 }
21222123 }
21232124
21452146 DAG.getTargetGlobalAddress(GV, dl, PtrVT));
21462147 if (Subtarget->GVIsIndirectSymbol(GV, RelocM))
21472148 Result = DAG.getLoad(PtrVT, dl, DAG.getEntryNode(), Result,
2148 MachinePointerInfo::getGOT(), false, false, 0);
2149 MachinePointerInfo::getGOT(),
2150 false, false, false, 0);
21492151 return Result;
21502152 }
21512153
21652167
21662168 SDValue Result = DAG.getLoad(PtrVT, dl, DAG.getEntryNode(), CPAddr,
21672169 MachinePointerInfo::getConstantPool(),
2168 false, false, 0);
2170 false, false, false, 0);
21692171 SDValue Chain = Result.getValue(1);
21702172
21712173 if (RelocM == Reloc::PIC_) {
21752177
21762178 if (Subtarget->GVIsIndirectSymbol(GV, RelocM))
21772179 Result = DAG.getLoad(PtrVT, dl, Chain, Result, MachinePointerInfo::getGOT(),
2178 false, false, 0);
2180 false, false, false, 0);
21792181
21802182 return Result;
21812183 }
21972199 CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr);
21982200 SDValue Result = DAG.getLoad(PtrVT, dl, DAG.getEntryNode(), CPAddr,
21992201 MachinePointerInfo::getConstantPool(),
2200 false, false, 0);
2202 false, false, false, 0);
22012203 SDValue PICLabel = DAG.getConstant(ARMPCLabelIndex, MVT::i32);
22022204 return DAG.getNode(ARMISD::PIC_ADD, dl, PtrVT, Result, PICLabel);
22032205 }
22552257 SDValue Result =
22562258 DAG.getLoad(PtrVT, dl, DAG.getEntryNode(), CPAddr,
22572259 MachinePointerInfo::getConstantPool(),
2258 false, false, 0);
2260 false, false, false, 0);
22592261
22602262 if (RelocM == Reloc::PIC_) {
22612263 SDValue PICLabel = DAG.getConstant(ARMPCLabelIndex, MVT::i32);
23872389 SDValue FIN = DAG.getFrameIndex(FI, getPointerTy());
23882390 ArgValue2 = DAG.getLoad(MVT::i32, dl, Root, FIN,
23892391 MachinePointerInfo::getFixedStack(FI),
2390 false, false, 0);
2392 false, false, false, 0);
23912393 } else {
23922394 Reg = MF.addLiveIn(NextVA.getLocReg(), RC);
23932395 ArgValue2 = DAG.getCopyFromReg(Root, dl, Reg, MVT::i32);
25232525 SDValue FIN = DAG.getFrameIndex(FI, getPointerTy());
25242526 ArgValue2 = DAG.getLoad(MVT::f64, dl, Chain, FIN,
25252527 MachinePointerInfo::getFixedStack(FI),
2526 false, false, 0);
2528 false, false, false, 0);
25272529 } else {
25282530 ArgValue2 = GetF64FormalArgument(VA, ArgLocs[++i],
25292531 Chain, DAG, dl);
26142616 SDValue FIN = DAG.getFrameIndex(FI, getPointerTy());
26152617 InVals.push_back(DAG.getLoad(VA.getValVT(), dl, Chain, FIN,
26162618 MachinePointerInfo::getFixedStack(FI),
2617 false, false, 0));
2619 false, false, false, 0));
26182620 }
26192621 lastInsIndex = index;
26202622 }
28492851 return DAG.getLoad(MVT::i32, Op.getDebugLoc(),
28502852 Ld->getChain(), Ld->getBasePtr(), Ld->getPointerInfo(),
28512853 Ld->isVolatile(), Ld->isNonTemporal(),
2852 Ld->getAlignment());
2854 Ld->isInvariant(), Ld->getAlignment());
28532855
28542856 llvm_unreachable("Unknown VFP cmp argument!");
28552857 }
28682870 Ld->getChain(), Ptr,
28692871 Ld->getPointerInfo(),
28702872 Ld->isVolatile(), Ld->isNonTemporal(),
2871 Ld->getAlignment());
2873 Ld->isInvariant(), Ld->getAlignment());
28722874
28732875 EVT PtrType = Ptr.getValueType();
28742876 unsigned NewAlign = MinAlign(Ld->getAlignment(), 4);
28782880 Ld->getChain(), NewPtr,
28792881 Ld->getPointerInfo().getWithOffset(4),
28802882 Ld->isVolatile(), Ld->isNonTemporal(),
2881 NewAlign);
2883 Ld->isInvariant(), NewAlign);
28822884 return;
28832885 }
28842886
30023004 if (getTargetMachine().getRelocationModel() == Reloc::PIC_) {
30033005 Addr = DAG.getLoad((EVT)MVT::i32, dl, Chain, Addr,
30043006 MachinePointerInfo::getJumpTable(),
3005 false, false, 0);
3007 false, false, false, 0);
30063008 Chain = Addr.getValue(1);
30073009 Addr = DAG.getNode(ISD::ADD, dl, PTy, Addr, Table);
30083010 return DAG.getNode(ARMISD::BR_JT, dl, MVT::Other, Chain, Addr, JTI, UId);
30093011 } else {
30103012 Addr = DAG.getLoad(PTy, dl, Chain, Addr,
3011 MachinePointerInfo::getJumpTable(), false, false, 0);
3013 MachinePointerInfo::getJumpTable(),
3014 false, false, false, 0);
30123015 Chain = Addr.getValue(1);
30133016 return DAG.getNode(ARMISD::BR_JT, dl, MVT::Other, Chain, Addr, JTI, UId);
30143017 }
31783181 SDValue Offset = DAG.getConstant(4, MVT::i32);
31793182 return DAG.getLoad(VT, dl, DAG.getEntryNode(),
31803183 DAG.getNode(ISD::ADD, dl, VT, FrameAddr, Offset),
3181 MachinePointerInfo(), false, false, 0);
3184 MachinePointerInfo(), false, false, false, 0);
31823185 }
31833186
31843187 // Return LR, which contains the return address. Mark it an implicit live-in.
31993202 while (Depth--)
32003203 FrameAddr = DAG.getLoad(VT, dl, DAG.getEntryNode(), FrameAddr,
32013204 MachinePointerInfo(),
3202 false, false, 0);
3205 false, false, false, 0);
32033206 return FrameAddr;
32043207 }
32053208
45944597 if (LoadSDNode *LD = dyn_cast(N))
45954598 return DAG.getLoad(LD->getMemoryVT(), N->getDebugLoc(), LD->getChain(),
45964599 LD->getBasePtr(), LD->getPointerInfo(), LD->isVolatile(),
4597 LD->isNonTemporal(), LD->getAlignment());
4600 LD->isNonTemporal(), LD->isInvariant(),
4601 LD->getAlignment());
45984602 // Otherwise, the value must be a BUILD_VECTOR. For v2i64, it will
45994603 // have been legalized as a BITCAST from v4i32.
46004604 if (N->getOpcode() == ISD::BITCAST) {
70667070 SDValue BasePtr = LD->getBasePtr();
70677071 SDValue NewLD1 = DAG.getLoad(MVT::i32, DL, LD->getChain(), BasePtr,
70687072 LD->getPointerInfo(), LD->isVolatile(),
7069 LD->isNonTemporal(), LD->getAlignment());
7073 LD->isNonTemporal(), LD->isInvariant(),
7074 LD->getAlignment());
70707075
70717076 SDValue OffsetPtr = DAG.getNode(ISD::ADD, DL, MVT::i32, BasePtr,
70727077 DAG.getConstant(4, MVT::i32));
70737078 SDValue NewLD2 = DAG.getLoad(MVT::i32, DL, NewLD1.getValue(1), OffsetPtr,
70747079 LD->getPointerInfo(), LD->isVolatile(),
7075 LD->isNonTemporal(),
7080 LD->isNonTemporal(), LD->isInvariant(),
70767081 std::min(4U, LD->getAlignment() / 2));
70777082
70787083 DAG.ReplaceAllUsesOfValueWith(SDValue(LD, 1), NewLD2.getValue(1));
6666 DAG.getNode(ISD::ADD, dl, MVT::i32, Src,
6767 DAG.getConstant(SrcOff, MVT::i32)),
6868 SrcPtrInfo.getWithOffset(SrcOff), isVolatile,
69 false, 0);
69 false, false, 0);
7070 TFOps[i] = Loads[i].getValue(1);
7171 SrcOff += VTSize;
7272 }
104104 Loads[i] = DAG.getLoad(VT, dl, Chain,
105105 DAG.getNode(ISD::ADD, dl, MVT::i32, Src,
106106 DAG.getConstant(SrcOff, MVT::i32)),
107 SrcPtrInfo.getWithOffset(SrcOff), false, false, 0);
107 SrcPtrInfo.getWithOffset(SrcOff),
108 false, false, false, 0);
108109 TFOps[i] = Loads[i].getValue(1);
109110 ++i;
110111 SrcOff += VTSize;
215215 HandleSDNode Dummy(CurDAG->getLoad(vecVT, dl,
216216 CurDAG->getEntryNode(), CGPoolOffset,
217217 MachinePointerInfo::getConstantPool(),
218 false, false, Alignment));
218 false, false, false, Alignment));
219219 CurDAG->ReplaceAllUsesWith(SDValue(bvNode, 0), Dummy.getValue());
220220 if (SDNode *N = SelectCode(Dummy.getValue().getNode()))
221221 return N;
666666 // Do the load as a i128 to allow possible shifting
667667 SDValue low = DAG.getLoad(MVT::i128, dl, the_chain, basePtr,
668668 lowMemPtr,
669 LN->isVolatile(), LN->isNonTemporal(), 16);
669 LN->isVolatile(), LN->isNonTemporal(), false, 16);
670670
671671 // When the size is not greater than alignment we get all data with just
672672 // one load
703703 basePtr,
704704 DAG.getConstant(16, PtrVT)),
705705 highMemPtr,
706 LN->isVolatile(), LN->isNonTemporal(), 16);
706 LN->isVolatile(), LN->isNonTemporal(), false,
707 16);
707708
708709 the_chain = DAG.getNode(ISD::TokenFactor, dl, MVT::Other, low.getValue(1),
709710 high.getValue(1));
858859
859860 // Load the lower part of the memory to which to store.
860861 SDValue low = DAG.getLoad(vecVT, dl, the_chain, basePtr,
861 lowMemPtr, SN->isVolatile(), SN->isNonTemporal(), 16);
862 lowMemPtr, SN->isVolatile(), SN->isNonTemporal(),
863 false, 16);
862864
863865 // if we don't need to store over the 16 byte boundary, one store suffices
864866 if (alignment >= StVT.getSizeInBits()/8) {
958960 DAG.getNode(ISD::ADD, dl, PtrVT, basePtr,
959961 DAG.getConstant( 16, PtrVT)),
960962 highMemPtr,
961 SN->isVolatile(), SN->isNonTemporal(), 16);
963 SN->isVolatile(), SN->isNonTemporal(),
964 false, 16);
962965 the_chain = DAG.getNode(ISD::TokenFactor, dl, MVT::Other, low.getValue(1),
963966 hi.getValue(1));
964967
11931196 int FI = MFI->CreateFixedObject(ObjSize, ArgOffset, true);
11941197 SDValue FIN = DAG.getFrameIndex(FI, PtrVT);
11951198 ArgVal = DAG.getLoad(ObjectVT, dl, Chain, FIN, MachinePointerInfo(),
1196 false, false, 0);
1199 false, false, false, 0);
11971200 ArgOffset += StackSlotSize;
11981201 }
11991202
950950 SDValue FIN = DAG.getFrameIndex(FI, getPointerTy());
951951 InVals.push_back(DAG.getLoad(VA.getValVT(), dl, Chain, FIN,
952952 MachinePointerInfo::getFixedStack(FI),
953 false, false, 0));
953 false, false, false, 0));
954954 }
955955 }
956956
370370 SDValue FIN = DAG.getFrameIndex(FI, MVT::i16);
371371 InVals.push_back(DAG.getLoad(VA.getLocVT(), dl, Chain, FIN,
372372 MachinePointerInfo::getFixedStack(FI),
373 false, false, 0));
373 false, false, false, 0));
374374 }
375375 }
376376
906906 return DAG.getLoad(getPointerTy(), dl, DAG.getEntryNode(),
907907 DAG.getNode(ISD::ADD, dl, getPointerTy(),
908908 FrameAddr, Offset),
909 MachinePointerInfo(), false, false, 0);
909 MachinePointerInfo(), false, false, false, 0);
910910 }
911911
912912 // Just load the return address.
913913 SDValue RetAddrFI = getReturnAddressFrameIndex(DAG);
914914 return DAG.getLoad(getPointerTy(), dl, DAG.getEntryNode(),
915 RetAddrFI, MachinePointerInfo(), false, false, 0);
915 RetAddrFI, MachinePointerInfo(), false, false, false, 0);
916916 }
917917
918918 SDValue MSP430TargetLowering::LowerFRAMEADDR(SDValue Op,
928928 while (Depth--)
929929 FrameAddr = DAG.getLoad(VT, dl, DAG.getEntryNode(), FrameAddr,
930930 MachinePointerInfo(),
931 false, false, 0);
931 false, false, false, 0);
932932 return FrameAddr;
933933 }
934934
14011401 GA = DAG.getNode(MipsISD::WrapperPIC, dl, ValTy, GA);
14021402 SDValue ResNode = DAG.getLoad(ValTy, dl,
14031403 DAG.getEntryNode(), GA, MachinePointerInfo(),
1404 false, false, 0);
1404 false, false, false, 0);
14051405 // On functions and global targets not internal linked only
14061406 // a load from got/GP is necessary for PIC to work.
14071407 if (!HasGotOfst)
14371437 MipsII::MO_ABS_LO);
14381438 SDValue Load = DAG.getLoad(MVT::i32, dl,
14391439 DAG.getEntryNode(), BAGOTOffset,
1440 MachinePointerInfo(), false, false, 0);
1440 MachinePointerInfo(), false, false, false, 0);
14411441 SDValue Lo = DAG.getNode(MipsISD::Lo, dl, MVT::i32, BALOOffset);
14421442 return DAG.getNode(ISD::ADD, dl, MVT::i32, Load, Lo);
14431443 }
14841484 MipsII::MO_GOTTPREL);
14851485 Offset = DAG.getLoad(MVT::i32, dl,
14861486 DAG.getEntryNode(), TGA, MachinePointerInfo(),
1487 false, false, 0);
1487 false, false, false, 0);
14881488 } else {
14891489 // Local Exec TLS Model
14901490 SDVTList VTs = DAG.getVTList(MVT::i32);
15231523 JTI = DAG.getNode(MipsISD::WrapperPIC, dl, MVT::i32, JTI);
15241524 HiPart = DAG.getLoad(MVT::i32, dl, DAG.getEntryNode(), JTI,
15251525 MachinePointerInfo(),
1526 false, false, 0);
1526 false, false, false, 0);
15271527 }
15281528
15291529 SDValue JTILo = DAG.getTargetJumpTable(JT->getIndex(), PtrVT,
15671567 CP = DAG.getNode(MipsISD::WrapperPIC, dl, MVT::i32, CP);
15681568 SDValue Load = DAG.getLoad(MVT::i32, dl, DAG.getEntryNode(),
15691569 CP, MachinePointerInfo::getConstantPool(),
1570 false, false, 0);
1570 false, false, false, 0);
15711571 SDValue CPLo = DAG.getTargetConstantPool(C, MVT::i32, N->getAlignment(),
15721572 N->getOffset(), MipsII::MO_ABS_LO);
15731573 SDValue Lo = DAG.getNode(MipsISD::Lo, dl, MVT::i32, CPLo);
18301830 DAG.getConstant(Offset, MVT::i32));
18311831 SDValue LoadVal = DAG.getLoad(MVT::i32, dl, Chain, LoadPtr,
18321832 MachinePointerInfo(),
1833 false, false, std::min(ByValAlign,
1834 (unsigned )4));
1833 false, false, false, std::min(ByValAlign,
1834 (unsigned )4));
18351835 MemOpChains.push_back(LoadVal.getValue(1));
18361836 unsigned DstReg = O32IntRegs[LocMemOffset / 4];
18371837 RegsToPass.push_back(std::make_pair(DstReg, LoadVal));
21182118 Callee = DAG.getNode(MipsISD::WrapperPIC, dl, getPointerTy(), Callee);
21192119 SDValue LoadValue = DAG.getLoad(getPointerTy(), dl, DAG.getEntryNode(),
21202120 Callee, MachinePointerInfo::getGOT(),
2121 false, false, 0);
2121 false, false, false, 0);
21222122
21232123 // Use GOT+LO if callee has internal linkage.
21242124 if (CalleeLo.getNode()) {
23492349 SDValue FIN = DAG.getFrameIndex(LastFI, getPointerTy());
23502350 InVals.push_back(DAG.getLoad(ValVT, dl, Chain, FIN,
23512351 MachinePointerInfo::getFixedStack(LastFI),
2352 false, false, 0));
2352 false, false, false, 0));
23532353 }
23542354 }
23552355
6969 DAG.getNode(ISD::ADD, dl, PointerType, Src,
7070 DAG.getConstant(SrcOff, PointerType)),
7171 SrcPtrInfo.getWithOffset(SrcOff), isVolatile,
72 false, 0);
72 false, false, 0);
7373 TFOps[i] = Loads[i].getValue(1);
7474 SrcOff += VTSize;
7575 }
107107 Loads[i] = DAG.getLoad(VT, dl, Chain,
108108 DAG.getNode(ISD::ADD, dl, PointerType, Src,
109109 DAG.getConstant(SrcOff, PointerType)),
110 SrcPtrInfo.getWithOffset(SrcOff), false, false, 0);
110 SrcPtrInfo.getWithOffset(SrcOff), false, false,
111 false, 0);
111112 TFOps[i] = Loads[i].getValue(1);
112113 ++i;
113114 SrcOff += VTSize;
12221222 // extra load to get the address of the global.
12231223 if (MOHiFlag & PPCII::MO_NLP_FLAG)
12241224 Ptr = DAG.getLoad(PtrVT, DL, DAG.getEntryNode(), Ptr, MachinePointerInfo(),
1225 false, false, 0);
1225 false, false, false, 0);
12261226 return Ptr;
12271227 }
12281228
13181318
13191319 // areas
13201320 SDValue OverflowArea = DAG.getLoad(MVT::i32, dl, InChain, OverflowAreaPtr,
1321 MachinePointerInfo(), false, false, 0);
1321 MachinePointerInfo(), false, false,
1322 false, 0);
13221323 InChain = OverflowArea.getValue(1);
13231324
13241325 SDValue RegSaveArea = DAG.getLoad(MVT::i32, dl, InChain, RegSaveAreaPtr,
1325 MachinePointerInfo(), false, false, 0);
1326 MachinePointerInfo(), false, false,
1327 false, 0);
13261328 InChain = RegSaveArea.getValue(1);
13271329
13281330 // select overflow_area if index > 8
13711373 MachinePointerInfo(),
13721374 MVT::i32, false, false, 0);
13731375
1374 return DAG.getLoad(VT, dl, InChain, Result, MachinePointerInfo(), false, false, 0);
1376 return DAG.getLoad(VT, dl, InChain, Result, MachinePointerInfo(),
1377 false, false, false, 0);
13751378 }
13761379
13771380 SDValue PPCTargetLowering::LowerADJUST_TRAMPOLINE(SDValue Op,
17201723 SDValue FIN = DAG.getFrameIndex(FI, PtrVT);
17211724 InVals.push_back(DAG.getLoad(VA.getValVT(), dl, Chain, FIN,
17221725 MachinePointerInfo(),
1723 false, false, 0));
1726 false, false, false, 0));
17241727 }
17251728 }
17261729
21372140 isImmutable);
21382141 SDValue FIN = DAG.getFrameIndex(FI, PtrVT);
21392142 ArgVal = DAG.getLoad(ObjectVT, dl, Chain, FIN, MachinePointerInfo(),
2140 false, false, 0);
2143 false, false, false, 0);
21412144 }
21422145
21432146 InVals.push_back(ArgVal);
24422445 EVT VT = PPCSubTarget.isPPC64() ? MVT::i64 : MVT::i32;
24432446 LROpOut = getReturnAddrFrameIndex(DAG);
24442447 LROpOut = DAG.getLoad(VT, dl, Chain, LROpOut, MachinePointerInfo(),
2445 false, false, 0);
2448 false, false, false, 0);
24462449 Chain = SDValue(LROpOut.getNode(), 1);
24472450
24482451 // When using the 32/64-bit SVR4 ABI there is no need to load the FP stack
24502453 if (isDarwinABI) {
24512454 FPOpOut = getFramePointerFrameIndex(DAG);
24522455 FPOpOut = DAG.getLoad(VT, dl, Chain, FPOpOut, MachinePointerInfo(),
2453 false, false, 0);
2456 false, false, false, 0);
24542457 Chain = SDValue(FPOpOut.getNode(), 1);
24552458 }
24562459 }
32113214 if (GPR_idx != NumGPRs) {
32123215 SDValue Load = DAG.getLoad(PtrVT, dl, Chain, AddArg,
32133216 MachinePointerInfo(),
3214 false, false, 0);
3217 false, false, false, 0);
32153218 MemOpChains.push_back(Load.getValue(1));
32163219 RegsToPass.push_back(std::make_pair(GPR[GPR_idx++], Load));
32173220 ArgOffset += PtrByteSize;
32493252 // Float varargs are always shadowed in available integer registers
32503253 if (GPR_idx != NumGPRs) {
32513254 SDValue Load = DAG.getLoad(PtrVT, dl, Store, PtrOff,
3252 MachinePointerInfo(), false, false, 0);
3255 MachinePointerInfo(), false, false,
3256 false, 0);
32533257 MemOpChains.push_back(Load.getValue(1));
32543258 RegsToPass.push_back(std::make_pair(GPR[GPR_idx++], Load));
32553259 }
32583262 PtrOff = DAG.getNode(ISD::ADD, dl, PtrVT, PtrOff, ConstFour);
32593263 SDValue Load = DAG.getLoad(PtrVT, dl, Store, PtrOff,
32603264 MachinePointerInfo(),
3261 false, false, 0);
3265 false, false, false, 0);
32623266 MemOpChains.push_back(Load.getValue(1));
32633267 RegsToPass.push_back(std::make_pair(GPR[GPR_idx++], Load));
32643268 }
33073311 if (VR_idx != NumVRs) {
33083312 SDValue Load = DAG.getLoad(MVT::v4f32, dl, Store, PtrOff,
33093313 MachinePointerInfo(),
3310 false, false, 0);
3314 false, false, false, 0);
33113315 MemOpChains.push_back(Load.getValue(1));
33123316 RegsToPass.push_back(std::make_pair(VR[VR_idx++], Load));
33133317 }
33183322 SDValue Ix = DAG.getNode(ISD::ADD, dl, PtrVT, PtrOff,
33193323 DAG.getConstant(i, PtrVT));
33203324 SDValue Load = DAG.getLoad(PtrVT, dl, Store, Ix, MachinePointerInfo(),
3321 false, false, 0);
3325 false, false, false, 0);
33223326 MemOpChains.push_back(Load.getValue(1));
33233327 RegsToPass.push_back(std::make_pair(GPR[GPR_idx++], Load));
33243328 }
34823486 // Load the old link SP.
34833487 SDValue LoadLinkSP = DAG.getLoad(PtrVT, dl, Chain, StackPtr,
34843488 MachinePointerInfo(),
3485 false, false, 0);
3489 false, false, false, 0);
34863490
34873491 // Restore the stack pointer.
34883492 Chain = DAG.getCopyToReg(LoadLinkSP.getValue(1), dl, SP, SaveSP);
36733677 FIPtr = DAG.getNode(ISD::ADD, dl, FIPtr.getValueType(), FIPtr,
36743678 DAG.getConstant(4, FIPtr.getValueType()));
36753679 return DAG.getLoad(Op.getValueType(), dl, Chain, FIPtr, MachinePointerInfo(),
3676 false, false, 0);
3680 false, false, false, 0);
36773681 }
36783682
36793683 SDValue PPCTargetLowering::LowerSINT_TO_FP(SDValue Op,
37173721 Ops, 4, MVT::i64, MMO);
37183722 // Load the value as a double.
37193723 SDValue Ld = DAG.getLoad(MVT::f64, dl, Store, FIdx, MachinePointerInfo(),
3720 false, false, 0);
3724 false, false, false, 0);
37213725
37223726 // FCFID it and return it.
37233727 SDValue FP = DAG.getNode(PPCISD::FCFID, dl, MVT::f64, Ld);
37693773 SDValue Four = DAG.getConstant(4, PtrVT);
37703774 SDValue Addr = DAG.getNode(ISD::ADD, dl, PtrVT, StackSlot, Four);
37713775 SDValue CWD = DAG.getLoad(MVT::i32, dl, Store, Addr, MachinePointerInfo(),
3772 false, false, 0);
3776 false, false, false, 0);
37733777
37743778 // Transform as necessary
37753779 SDValue CWD1 =
44404444 false, false, 0);
44414445 // Load it out.
44424446 return DAG.getLoad(Op.getValueType(), dl, Store, FIdx, MachinePointerInfo(),
4443 false, false, 0);
4447 false, false, false, 0);
44444448 }
44454449
44464450 SDValue PPCTargetLowering::LowerMUL(SDValue Op, SelectionDAG &DAG) const {
57285732 return DAG.getLoad(getPointerTy(), dl, DAG.getEntryNode(),
57295733 DAG.getNode(ISD::ADD, dl, getPointerTy(),
57305734 FrameAddr, Offset),
5731 MachinePointerInfo(), false, false, 0);
5735 MachinePointerInfo(), false, false, false, 0);
57325736 }
57335737
57345738 // Just load the return address off the stack.
57355739 SDValue RetAddrFI = getReturnAddrFrameIndex(DAG);
57365740 return DAG.getLoad(getPointerTy(), dl, DAG.getEntryNode(),
5737 RetAddrFI, MachinePointerInfo(), false, false, 0);
5741 RetAddrFI, MachinePointerInfo(), false, false, false, 0);
57385742 }
57395743
57405744 SDValue PPCTargetLowering::LowerFRAMEADDR(SDValue Op,
57575761 PtrVT);
57585762 while (Depth--)
57595763 FrameAddr = DAG.getLoad(Op.getValueType(), dl, DAG.getEntryNode(),
5760 FrameAddr, MachinePointerInfo(), false, false, 0);
5764 FrameAddr, MachinePointerInfo(), false, false,
5765 false, 0);
57615766 return FrameAddr;
57625767 }
57635768
174174 SDValue FIPtr = DAG.getFrameIndex(FrameIdx, MVT::i32);
175175 SDValue Arg = DAG.getLoad(MVT::i32, dl, Chain, FIPtr,
176176 MachinePointerInfo(),
177 false, false, 0);
177 false, false, false, 0);
178178 InVals.push_back(Arg);
179179 continue;
180180 }
196196 SDValue FIPtr = DAG.getFrameIndex(FrameIdx, MVT::i32);
197197 LoVal = DAG.getLoad(MVT::i32, dl, Chain, FIPtr,
198198 MachinePointerInfo(),
199 false, false, 0);
199 false, false, false, 0);
200200 } else {
201201 unsigned loReg = MF.addLiveIn(NextVA.getLocReg(),
202202 &SP::IntRegsRegClass);
236236 SDValue FIPtr = DAG.getFrameIndex(FI, getPointerTy());
237237 SDValue Load = DAG.getLoad(VA.getValVT(), dl, Chain, FIPtr,
238238 MachinePointerInfo(),
239 false,false, 0);
239 false,false, false, 0);
240240 InVals.push_back(Load);
241241 continue;
242242 }
247247 SDValue FIPtr = DAG.getFrameIndex(FI, getPointerTy());
248248 SDValue HiVal = DAG.getLoad(MVT::i32, dl, Chain, FIPtr,
249249 MachinePointerInfo(),
250 false, false, 0);
250 false, false, false, 0);
251251 int FI2 = MF.getFrameInfo()->CreateFixedObject(4,
252252 Offset+4,
253253 true);
255255
256256 SDValue LoVal = DAG.getLoad(MVT::i32, dl, Chain, FIPtr2,
257257 MachinePointerInfo(),
258 false, false, 0);
258 false, false, false, 0);
259259
260260 SDValue WholeValue =
261261 DAG.getNode(ISD::BUILD_PAIR, dl, MVT::i64, LoVal, HiVal);
272272 if (VA.getValVT() == MVT::i32 || VA.getValVT() == MVT::f32) {
273273 Load = DAG.getLoad(VA.getValVT(), dl, Chain, FIPtr,
274274 MachinePointerInfo(),
275 false, false, 0);
275 false, false, false, 0);
276276 } else {
277277 ISD::LoadExtType LoadOp = ISD::SEXTLOAD;
278278 // Sparc is big endian, so add an offset based on the ObjectVT.
466466 false, false, 0);
467467 // Sparc is big-endian, so the high part comes first.
468468 SDValue Hi = DAG.getLoad(MVT::i32, dl, Store, StackPtr,
469 MachinePointerInfo(), false, false, 0);
469 MachinePointerInfo(), false, false, false, 0);
470470 // Increment the pointer to the other half.
471471 StackPtr = DAG.getNode(ISD::ADD, dl, StackPtr.getValueType(), StackPtr,
472472 DAG.getIntPtrConstant(4));
473473 // Load the low part.
474474 SDValue Lo = DAG.getLoad(MVT::i32, dl, Store, StackPtr,
475 MachinePointerInfo(), false, false, 0);
475 MachinePointerInfo(), false, false, false, 0);
476476
477477 if (VA.isRegLoc()) {
478478 RegsToPass.push_back(std::make_pair(VA.getLocReg(), Hi));
896896 SDValue AbsAddr = DAG.getNode(ISD::ADD, dl, MVT::i32,
897897 GlobalBase, RelAddr);
898898 return DAG.getLoad(getPointerTy(), dl, DAG.getEntryNode(),
899 AbsAddr, MachinePointerInfo(), false, false, 0);
899 AbsAddr, MachinePointerInfo(), false, false, false, 0);
900900 }
901901
902902 SDValue SparcTargetLowering::LowerConstantPool(SDValue Op,
917917 SDValue AbsAddr = DAG.getNode(ISD::ADD, dl, MVT::i32,
918918 GlobalBase, RelAddr);
919919 return DAG.getLoad(getPointerTy(), dl, DAG.getEntryNode(),
920 AbsAddr, MachinePointerInfo(), false, false, 0);
920 AbsAddr, MachinePointerInfo(), false, false, false, 0);
921921 }
922922
923923 static SDValue LowerFP_TO_SINT(SDValue Op, SelectionDAG &DAG) {
10251025 const Value *SV = cast(Node->getOperand(2))->getValue();
10261026 DebugLoc dl = Node->getDebugLoc();
10271027 SDValue VAList = DAG.getLoad(MVT::i32, dl, InChain, VAListPtr,
1028 MachinePointerInfo(SV), false, false, 0);
1028 MachinePointerInfo(SV), false, false, false, 0);
10291029 // Increment the pointer, VAList, to the next vaarg
10301030 SDValue NextPtr = DAG.getNode(ISD::ADD, dl, MVT::i32, VAList,
10311031 DAG.getConstant(VT.getSizeInBits()/8,
10371037 // f64 load.
10381038 if (VT != MVT::f64)
10391039 return DAG.getLoad(VT, dl, InChain, VAList, MachinePointerInfo(),
1040 false, false, 0);
1040 false, false, false, 0);
10411041
10421042 // Otherwise, load it as i64, then do a bitconvert.
10431043 SDValue V = DAG.getLoad(MVT::i64, dl, InChain, VAList, MachinePointerInfo(),
1044 false, false, 0);
1044 false, false, false, 0);
10451045
10461046 // Bit-Convert the value to f64.
10471047 SDValue Ops[2] = {
11021102 FrameAddr = DAG.getLoad(MVT::i32, dl,
11031103 Chain,
11041104 Ptr,
1105 MachinePointerInfo(), false, false, 0);
1105 MachinePointerInfo(), false, false, false, 0);
11061106 }
11071107 }
11081108 return FrameAddr;
11341134 RetAddr = DAG.getLoad(MVT::i32, dl,
11351135 Chain,
11361136 Ptr,
1137 MachinePointerInfo(), false, false, 0);
1137 MachinePointerInfo(), false, false, false, 0);
11381138 }
11391139 }
11401140 return RetAddr;
17061706 SDValue FIN = DAG.getFrameIndex(FI, getPointerTy());
17071707 return DAG.getLoad(ValVT, dl, Chain, FIN,
17081708 MachinePointerInfo::getFixedStack(FI),
1709 false, false, 0);
1709 false, false, false, 0);
17101710 }
17111711 }
17121712
18091809 // If value is passed via pointer - do a load.
18101810 if (VA.getLocInfo() == CCValAssign::Indirect)
18111811 ArgValue = DAG.getLoad(VA.getValVT(), dl, Chain, ArgValue,
1812 MachinePointerInfo(), false, false, 0);
1812 MachinePointerInfo(), false, false, false, 0);
18131813
18141814 InVals.push_back(ArgValue);
18151815 }
20082008
20092009 // Load the "old" Return address.
20102010 OutRetAddr = DAG.getLoad(VT, dl, Chain, OutRetAddr, MachinePointerInfo(),
2011 false, false, 0);
2011 false, false, false, 0);
20122012 return SDValue(OutRetAddr.getNode(), 1);
20132013 }
20142014
23702370 if (ExtraLoad)
23712371 Callee = DAG.getLoad(getPointerTy(), dl, DAG.getEntryNode(), Callee,
23722372 MachinePointerInfo::getGOT(),
2373 false, false, 0);
2373 false, false, false, 0);
23742374 }
23752375 } else if (ExternalSymbolSDNode *S = dyn_cast(Callee)) {
23762376 unsigned char OpFlags = 0;
49814981 EVT NVT = EVT::getVectorVT(*DAG.getContext(), PVT, NumElems);
49824982 SDValue V1 = DAG.getLoad(NVT, dl, Chain, Ptr,
49834983 LD->getPointerInfo().getWithOffset(StartOffset),
4984 false, false, 0);
4984 false, false, false, 0);
49854985
49864986 // Canonicalize it to a v4i32 or v8i32 shuffle.
49874987 SmallVector Mask;
50465046 if (DAG.InferPtrAlignment(LDBase->getBasePtr()) >= 16)
50475047 return DAG.getLoad(VT, DL, LDBase->getChain(), LDBase->getBasePtr(),
50485048 LDBase->getPointerInfo(),
5049 LDBase->isVolatile(), LDBase->isNonTemporal(), 0);
5049 LDBase->isVolatile(), LDBase->isNonTemporal(),
5050 LDBase->isInvariant(), 0);
50505051 return DAG.getLoad(VT, DL, LDBase->getChain(), LDBase->getBasePtr(),
50515052 LDBase->getPointerInfo(),
50525053 LDBase->isVolatile(), LDBase->isNonTemporal(),
5053 LDBase->getAlignment());
5054 LDBase->isInvariant(), LDBase->getAlignment());
50545055 } else if (NumElems == 4 && LastLoadedElt == 1 &&
50555056 DAG.getTargetLoweringInfo().isTypeLegal(MVT::v2i64)) {
50565057 SDVTList Tys = DAG.getVTList(MVT::v2i64, MVT::Other);
73037304 // load.
73047305 if (isGlobalStubReference(OpFlag))
73057306 Result = DAG.getLoad(getPointerTy(), DL, DAG.getEntryNode(), Result,
7306 MachinePointerInfo::getGOT(), false, false, 0);
7307 MachinePointerInfo::getGOT(), false, false, false, 0);
73077308
73087309 return Result;
73097310 }
73717372 // load.
73727373 if (isGlobalStubReference(OpFlags))
73737374 Result = DAG.getLoad(getPointerTy(), dl, DAG.getEntryNode(), Result,
7374 MachinePointerInfo::getGOT(), false, false, 0);
7375 MachinePointerInfo::getGOT(), false, false, false, 0);
73757376
73767377 // If there was a non-zero offset that we didn't fold, create an explicit
73777378 // addition for it.
74507451
74517452 SDValue ThreadPointer = DAG.getLoad(PtrVT, dl, DAG.getEntryNode(),
74527453 DAG.getIntPtrConstant(0),
7453 MachinePointerInfo(Ptr), false, false, 0);
7454 MachinePointerInfo(Ptr),
7455 false, false, false, 0);
74547456
74557457 unsigned char OperandFlags = 0;
74567458 // Most TLS accesses are not RIP relative, even on x86-64. One exception is
74767478
74777479 if (model == TLSModel::InitialExec)
74787480 Offset = DAG.getLoad(PtrVT, dl, DAG.getEntryNode(), Offset,
7479 MachinePointerInfo::getGOT(), false, false, 0);
7481 MachinePointerInfo::getGOT(), false, false, false, 0);
74807482
74817483 // The address of the thread local variable is the add of the thread
74827484 // pointer with the offset of the variable.
77007702 Op.getValueType(), MMO);
77017703 Result = DAG.getLoad(Op.getValueType(), DL, Chain, StackSlot,
77027704 MachinePointerInfo::getFixedStack(SSFI),
7703 false, false, 0);
7705 false, false, false, 0);
77047706 }
77057707
77067708 return Result;
77747776 SDValue Unpck1 = getUnpackl(DAG, dl, MVT::v4i32, XR1, XR2);
77757777 SDValue CLod0 = DAG.getLoad(MVT::v4i32, dl, DAG.getEntryNode(), CPIdx0,
77767778 MachinePointerInfo::getConstantPool(),
7777 false, false, 16);
7779 false, false, false, 16);
77787780 SDValue Unpck2 = getUnpackl(DAG, dl, MVT::v4i32, Unpck1, CLod0);
77797781 SDValue XR2F = DAG.getNode(ISD::BITCAST, dl, MVT::v2f64, Unpck2);
77807782 SDValue CLod1 = DAG.getLoad(MVT::v2f64, dl, CLod0.getValue(1), CPIdx1,
77817783 MachinePointerInfo::getConstantPool(),
7782 false, false, 16);
7784 false, false, false, 16);
77837785 SDValue Sub = DAG.getNode(ISD::FSUB, dl, MVT::v2f64, XR2F, CLod1);
77847786
77857787 // Add the halves; easiest way is to swap them into another reg first.
80118013
80128014 // Load the result.
80138015 return DAG.getLoad(Op.getValueType(), Op.getDebugLoc(),
8014 FIST, StackSlot, MachinePointerInfo(), false, false, 0);
8016 FIST, StackSlot, MachinePointerInfo(),
8017 false, false, false, 0);
80158018 }
80168019
80178020 SDValue X86TargetLowering::LowerFP_TO_UINT(SDValue Op,
80228025
80238026 // Load the result.
80248027 return DAG.getLoad(Op.getValueType(), Op.getDebugLoc(),
8025 FIST, StackSlot, MachinePointerInfo(), false, false, 0);
8028 FIST, StackSlot, MachinePointerInfo(),
8029 false, false, false, 0);
80268030 }
80278031
80288032 SDValue X86TargetLowering::LowerFABS(SDValue Op,
80498053 SDValue CPIdx = DAG.getConstantPool(C, getPointerTy(), 16);
80508054 SDValue Mask = DAG.getLoad(VT, dl, DAG.getEntryNode(), CPIdx,
80518055 MachinePointerInfo::getConstantPool(),
8052 false, false, 16);
8056 false, false, false, 16);
80538057 return DAG.getNode(X86ISD::FAND, dl, VT, Op.getOperand(0), Mask);
80548058 }
80558059
80768080 SDValue CPIdx = DAG.getConstantPool(C, getPointerTy(), 16);
80778081 SDValue Mask = DAG.getLoad(VT, dl, DAG.getEntryNode(), CPIdx,
80788082 MachinePointerInfo::getConstantPool(),
8079 false, false, 16);
8083 false, false, false, 16);
80808084 if (VT.isVector()) {
80818085 return DAG.getNode(ISD::BITCAST, dl, VT,
80828086 DAG.getNode(ISD::XOR, dl, MVT::v2i64,
81258129 SDValue CPIdx = DAG.getConstantPool(C, getPointerTy(), 16);
81268130 SDValue Mask1 = DAG.getLoad(SrcVT, dl, DAG.getEntryNode(), CPIdx,
81278131 MachinePointerInfo::getConstantPool(),
8128 false, false, 16);
8132 false, false, false, 16);
81298133 SDValue SignBit = DAG.getNode(X86ISD::FAND, dl, SrcVT, Op1, Mask1);
81308134
81318135 // Shift sign bit right or left if the two operands have different types.
81548158 CPIdx = DAG.getConstantPool(C, getPointerTy(), 16);
81558159 SDValue Mask2 = DAG.getLoad(VT, dl, DAG.getEntryNode(), CPIdx,
81568160 MachinePointerInfo::getConstantPool(),
8157 false, false, 16);
8161 false, false, false, 16);
81588162 SDValue Val = DAG.getNode(X86ISD::FAND, dl, VT, Op0, Mask2);
81598163
81608164 // Or the value with the sign bit.
92819285 Chain,
92829286 VAARG,
92839287 MachinePointerInfo(),
9284 false, false, 0);
9288 false, false, false, 0);
92859289 }
92869290
92879291 SDValue X86TargetLowering::LowerVACOPY(SDValue Op, SelectionDAG &DAG) const {
96079611 return DAG.getLoad(getPointerTy(), dl, DAG.getEntryNode(),
96089612 DAG.getNode(ISD::ADD, dl, getPointerTy(),
96099613 FrameAddr, Offset),
9610 MachinePointerInfo(), false, false, 0);
9614 MachinePointerInfo(), false, false, false, 0);
96119615 }
96129616
96139617 // Just load the return address.
96149618 SDValue RetAddrFI = getReturnAddressFrameIndex(DAG);
96159619 return DAG.getLoad(getPointerTy(), dl, DAG.getEntryNode(),
9616 RetAddrFI, MachinePointerInfo(), false, false, 0);
9620 RetAddrFI, MachinePointerInfo(), false, false, false, 0);
96179621 }
96189622
96199623 SDValue X86TargetLowering::LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) const {
96289632 while (Depth--)
96299633 FrameAddr = DAG.getLoad(VT, dl, DAG.getEntryNode(), FrameAddr,
96309634 MachinePointerInfo(),
9631 false, false, 0);
9635 false, false, false, 0);
96329636 return FrameAddr;
96339637 }
96349638
98609864
98619865 // Load FP Control Word from stack slot
98629866 SDValue CWD = DAG.getLoad(MVT::i16, DL, Chain, StackSlot,
9863 MachinePointerInfo(), false, false, 0);
9867 MachinePointerInfo(), false, false, false, 0);
98649868
98659869 // Transform as necessary
98669870 SDValue CWD1 =
1020010204 SDValue CPIdx = DAG.getConstantPool(C, getPointerTy(), 16);
1020110205 SDValue Addend = DAG.getLoad(VT, dl, DAG.getEntryNode(), CPIdx,
1020210206 MachinePointerInfo::getConstantPool(),
10203 false, false, 16);
10207 false, false, false, 16);
1020410208
1020510209 Op = DAG.getNode(ISD::ADD, dl, VT, Op, Addend);
1020610210 Op = DAG.getNode(ISD::BITCAST, dl, MVT::v4f32, Op);
1022210226 SDValue CPIdx = DAG.getConstantPool(C, getPointerTy(), 16);
1022310227 SDValue M = DAG.getLoad(VT, dl, DAG.getEntryNode(), CPIdx,
1022410228 MachinePointerInfo::getConstantPool(),
10225 false, false, 16);
10229 false, false, false, 16);
1022610230
1022710231 // r = pblendv(r, psllw(r & (char16)15, 4), a);
1022810232 M = DAG.getNode(ISD::AND, dl, VT, R, M);
1023710241 CPIdx = DAG.getConstantPool(C, getPointerTy(), 16);
1023810242 M = DAG.getLoad(VT, dl, DAG.getEntryNode(), CPIdx,
1023910243 MachinePointerInfo::getConstantPool(),
10240 false, false, 16);
10244 false, false, false, 16);
1024110245
1024210246 // r = pblendv(r, psllw(r & (char16)63, 2), a);
1024310247 M = DAG.getNode(ISD::AND, dl, VT, R, M);
1073810742 EVT VT = N->getValueType(0);
1073910743 // Return a load from the stack slot.
1074010744 Results.push_back(DAG.getLoad(VT, dl, FIST, StackSlot,
10741 MachinePointerInfo(), false, false, 0));
10745 MachinePointerInfo(),
10746 false, false, false, 0));
1074210747 }
1074310748 return;
1074410749 }
1280612811 // Load the scalar.
1280712812 SDValue LoadScalar = DAG.getLoad(Extract->getValueType(0), dl, Ch,
1280812813 ScalarAddr, MachinePointerInfo(),
12809 false, false, 0);
12814 false, false, false, 0);
1281012815
1281112816 // Replace the exact with the load.
1281212817 DAG.ReplaceAllUsesOfValueWith(SDValue(Extract, 0), LoadScalar);
1383613841 SDValue ScalarLoad = DAG.getLoad(SclrLoadTy, dl, Ld->getChain(),
1383713842 Ld->getBasePtr(),
1383813843 Ld->getPointerInfo(), Ld->isVolatile(),
13839 Ld->isNonTemporal(), Ld->getAlignment());
13844 Ld->isNonTemporal(), Ld->isInvariant(),
13845 Ld->getAlignment());
1384013846
1384113847 // Insert the word loaded into a vector.
1384213848 SDValue ScalarInVector = DAG.getNode(ISD::SCALAR_TO_VECTOR, dl,
1403214038 EVT LdVT = Subtarget->is64Bit() ? MVT::i64 : MVT::f64;
1403314039 SDValue NewLd = DAG.getLoad(LdVT, LdDL, Ld->getChain(), Ld->getBasePtr(),
1403414040 Ld->getPointerInfo(), Ld->isVolatile(),
14035 Ld->isNonTemporal(), Ld->getAlignment());
14041 Ld->isNonTemporal(), Ld->isInvariant(),
14042 Ld->getAlignment());
1403614043 SDValue NewChain = NewLd.getValue(1);
1403714044 if (TokenFactorIndex != -1) {
1403814045 Ops.push_back(NewChain);
1405314060 SDValue LoLd = DAG.getLoad(MVT::i32, LdDL, Ld->getChain(), LoAddr,
1405414061 Ld->getPointerInfo(),
1405514062 Ld->isVolatile(), Ld->isNonTemporal(),
14056 Ld->getAlignment());
14063 Ld->isInvariant(), Ld->getAlignment());
1405714064 SDValue HiLd = DAG.getLoad(MVT::i32, LdDL, Ld->getChain(), HiAddr,
1405814065 Ld->getPointerInfo().getWithOffset(4),
1405914066 Ld->isVolatile(), Ld->isNonTemporal(),
14067 Ld->isInvariant(),
1406014068 MinAlign(Ld->getAlignment(), 4));
1406114069
1406214070 SDValue NewChain = LoLd.getValue(1);
426426 //
427427 return DAG.getLoad(getPointerTy(), DL, Chain, BasePtr,
428428 MachinePointerInfo(),
429 false, false, 0);
429 false, false, false, 0);
430430 }
431431 // Lower to
432432 // ldw low, base[offset >> 2]
443443 SDValue HighAddr = DAG.getNode(ISD::ADD, DL, MVT::i32, Base, HighOffset);
444444
445445 SDValue Low = DAG.getLoad(getPointerTy(), DL, Chain,
446 LowAddr, MachinePointerInfo(), false, false, 0);
446 LowAddr, MachinePointerInfo(),
447 false, false, false, 0);
447448 SDValue High = DAG.getLoad(getPointerTy(), DL, Chain,
448 HighAddr, MachinePointerInfo(), false, false, 0);
449 HighAddr, MachinePointerInfo(),
450 false, false, false, 0);
449451 SDValue LowShifted = DAG.getNode(ISD::SRL, DL, MVT::i32, Low, LowShift);
450452 SDValue HighShifted = DAG.getNode(ISD::SHL, DL, MVT::i32, High, HighShift);
451453 SDValue Result = DAG.getNode(ISD::OR, DL, MVT::i32, LowShifted, HighShifted);
760762 EVT VT = Node->getValueType(0);
761763 SDValue VAList = DAG.getLoad(getPointerTy(), dl, Node->getOperand(0),
762764 Node->getOperand(1), MachinePointerInfo(V),
763 false, false, 0);
765 false, false, false, 0);
764766 // Increment the pointer, VAList, to the next vararg
765767 SDValue Tmp3 = DAG.getNode(ISD::ADD, dl, getPointerTy(), VAList,
766768 DAG.getConstant(VT.getSizeInBits(),
770772 MachinePointerInfo(V), false, false, 0);
771773 // Load the actual argument out of the pointer VAList
772774 return DAG.getLoad(VT, dl, Tmp3, VAList, MachinePointerInfo(),
773 false, false, 0);
775 false, false, false, 0);
774776 }
775777
776778 SDValue XCoreTargetLowering::
11451147 SDValue FIN = DAG.getFrameIndex(FI, MVT::i32);
11461148 InVals.push_back(DAG.getLoad(VA.getLocVT(), dl, Chain, FIN,
11471149 MachinePointerInfo::getFixedStack(FI),
1148 false, false, 0));
1150 false, false, false, 0));
11491151 }
11501152 }
11511153