llvm.org GIT mirror llvm / b2d6ad7
[SelectionDAG] Get rid of bool parameters in SelectionDAG::getLoad, getStore, and friends. Summary: Instead, we take a single flags arg (a bitset). Also add a default 0 alignment, and change the order of arguments so the alignment comes before the flags. This greatly simplifies many callsites, and fixes a bug in AMDGPUISelLowering, wherein the order of the args to getLoad was inverted. It also greatly simplifies the process of adding another flag to getLoad. Reviewers: chandlerc, tstellarAMD Subscribers: jholewinski, arsenm, jyknight, dsanders, nemanjai, llvm-commits Differential Revision: http://reviews.llvm.org/D22249 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275592 91177308-0d34-0410-b5e6-96231b3b80d8 Justin Lebar 4 years ago
33 changed file(s) with 1219 addition(s) and 1661 deletion(s). Raw diff Collapse all Expand all
911911 /// Loads are not normal binary operators: their result type is not
912912 /// determined by their operands, and they produce a value AND a token chain.
913913 ///
914 /// This function will set the MOLoad flag on MMOFlags, but you can set it if
915 /// you want. The MOStore flag must not be set.
914916 SDValue getLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr,
915 MachinePointerInfo PtrInfo, bool isVolatile,
916 bool isNonTemporal, bool isInvariant, unsigned Alignment,
917 MachinePointerInfo PtrInfo, unsigned Alignment = 0,
918 MachineMemOperand::Flags MMOFlags = MachineMemOperand::MONone,
917919 const AAMDNodes &AAInfo = AAMDNodes(),
918920 const MDNode *Ranges = nullptr);
919921 SDValue getLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr,
920922 MachineMemOperand *MMO);
921 SDValue getExtLoad(ISD::LoadExtType ExtType, const SDLoc &dl, EVT VT,
922 SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo,
923 EVT MemVT, bool isVolatile, bool isNonTemporal,
924 bool isInvariant, unsigned Alignment,
925 const AAMDNodes &AAInfo = AAMDNodes());
923 SDValue
924 getExtLoad(ISD::LoadExtType ExtType, const SDLoc &dl, EVT VT, SDValue Chain,
925 SDValue Ptr, MachinePointerInfo PtrInfo, EVT MemVT,
926 unsigned Alignment = 0,
927 MachineMemOperand::Flags MMOFlags = MachineMemOperand::MONone,
928 const AAMDNodes &AAInfo = AAMDNodes());
926929 SDValue getExtLoad(ISD::LoadExtType ExtType, const SDLoc &dl, EVT VT,
927930 SDValue Chain, SDValue Ptr, EVT MemVT,
928931 MachineMemOperand *MMO);
930933 SDValue Offset, ISD::MemIndexedMode AM);
931934 SDValue getLoad(ISD::MemIndexedMode AM, ISD::LoadExtType ExtType, EVT VT,
932935 const SDLoc &dl, SDValue Chain, SDValue Ptr, SDValue Offset,
933 MachinePointerInfo PtrInfo, EVT MemVT, bool isVolatile,
934 bool isNonTemporal, bool isInvariant, unsigned Alignment,
936 MachinePointerInfo PtrInfo, EVT MemVT, unsigned Alignment = 0,
937 MachineMemOperand::Flags MMOFlags = MachineMemOperand::MONone,
935938 const AAMDNodes &AAInfo = AAMDNodes(),
936939 const MDNode *Ranges = nullptr);
937940 SDValue getLoad(ISD::MemIndexedMode AM, ISD::LoadExtType ExtType, EVT VT,
939942 EVT MemVT, MachineMemOperand *MMO);
940943
941944 /// Helper function to build ISD::STORE nodes.
942 SDValue getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr,
943 MachinePointerInfo PtrInfo, bool isVolatile,
944 bool isNonTemporal, unsigned Alignment,
945 const AAMDNodes &AAInfo = AAMDNodes());
945 ///
946 /// This function will set the MOStore flag on MMOFlags, but you can set it if
947 /// you want. The MOLoad and MOInvariant flags must not be set.
948 SDValue
949 getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr,
950 MachinePointerInfo PtrInfo, unsigned Alignment = 0,
951 MachineMemOperand::Flags MMOFlags = MachineMemOperand::MONone,
952 const AAMDNodes &AAInfo = AAMDNodes());
946953 SDValue getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr,
947954 MachineMemOperand *MMO);
948 SDValue getTruncStore(SDValue Chain, const SDLoc &dl, SDValue Val,
949 SDValue Ptr, MachinePointerInfo PtrInfo, EVT TVT,
950 bool isNonTemporal, bool isVolatile, unsigned Alignment,
951 const AAMDNodes &AAInfo = AAMDNodes());
955 SDValue
956 getTruncStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr,
957 MachinePointerInfo PtrInfo, EVT TVT, unsigned Alignment = 0,
958 MachineMemOperand::Flags MMOFlags = MachineMemOperand::MONone,
959 const AAMDNodes &AAInfo = AAMDNodes());
952960 SDValue getTruncStore(SDValue Chain, const SDLoc &dl, SDValue Val,
953961 SDValue Ptr, EVT TVT, MachineMemOperand *MMO);
954962 SDValue getIndexedStore(SDValue OrigStoe, const SDLoc &dl, SDValue Base,
32723272
32733273 AddToWorklist(NewPtr.getNode());
32743274
3275 SDValue Load =
3276 DAG.getExtLoad(ISD::ZEXTLOAD, SDLoc(LN0), LoadResultTy,
3277 LN0->getChain(), NewPtr,
3278 LN0->getPointerInfo(),
3279 ExtVT, LN0->isVolatile(), LN0->isNonTemporal(),
3280 LN0->isInvariant(), Alignment, LN0->getAAInfo());
3275 SDValue Load = DAG.getExtLoad(
3276 ISD::ZEXTLOAD, SDLoc(LN0), LoadResultTy, LN0->getChain(), NewPtr,
3277 LN0->getPointerInfo(), ExtVT, Alignment,
3278 LN0->getMemOperand()->getFlags(), LN0->getAAInfo());
32813279 AddToWorklist(N);
32823280 CombineTo(LN0, Load, Load.getValue(1));
32833281 return SDValue(N, 0); // Return N so it doesn't get rechecked!
59845982
59855983 SDValue SplitLoad = DAG.getExtLoad(
59865984 ExtType, DL, SplitDstVT, LN0->getChain(), BasePtr,
5987 LN0->getPointerInfo().getWithOffset(Offset), SplitSrcVT,
5988 LN0->isVolatile(), LN0->isNonTemporal(), LN0->isInvariant(),
5989 Align, LN0->getAAInfo());
5985 LN0->getPointerInfo().getWithOffset(Offset), SplitSrcVT, Align,
5986 LN0->getMemOperand()->getFlags(), LN0->getAAInfo());
59905987
59915988 BasePtr = DAG.getNode(ISD::ADD, DL, BasePtr.getValueType(), BasePtr,
59925989 DAG.getConstant(Stride, DL, BasePtr.getValueType()));
69006897
69016898 SDValue Load;
69026899 if (ExtType == ISD::NON_EXTLOAD)
6903 Load = DAG.getLoad(VT, SDLoc(N0), LN0->getChain(), NewPtr,
6904 LN0->getPointerInfo().getWithOffset(PtrOff),
6905 LN0->isVolatile(), LN0->isNonTemporal(),
6906 LN0->isInvariant(), NewAlign, LN0->getAAInfo());
6900 Load = DAG.getLoad(VT, SDLoc(N0), LN0->getChain(), NewPtr,
6901 LN0->getPointerInfo().getWithOffset(PtrOff), NewAlign,
6902 LN0->getMemOperand()->getFlags(), LN0->getAAInfo());
69076903 else
6908 Load = DAG.getExtLoad(ExtType, SDLoc(N0), VT, LN0->getChain(),NewPtr,
6909 LN0->getPointerInfo().getWithOffset(PtrOff),
6910 ExtVT, LN0->isVolatile(), LN0->isNonTemporal(),
6911 LN0->isInvariant(), NewAlign, LN0->getAAInfo());
6904 Load = DAG.getExtLoad(ExtType, SDLoc(N0), VT, LN0->getChain(), NewPtr,
6905 LN0->getPointerInfo().getWithOffset(PtrOff), ExtVT,
6906 NewAlign, LN0->getMemOperand()->getFlags(),
6907 LN0->getAAInfo());
69126908
69136909 // Replace the old load's chain with the new load's chain.
69146910 WorklistRemover DeadNodes(*this);
73267322
73277323 if (NewAlign <= Align &&
73287324 (!LegalOperations || TLI.isOperationLegal(ISD::LOAD, VT)))
7329 return DAG.getLoad(VT, SDLoc(N), LD1->getChain(),
7330 LD1->getBasePtr(), LD1->getPointerInfo(),
7331 false, false, false, Align);
7325 return DAG.getLoad(VT, SDLoc(N), LD1->getChain(), LD1->getBasePtr(),
7326 LD1->getPointerInfo(), Align);
73327327 }
73337328
73347329 return SDValue();
74377432 if (TLI.allowsMemoryAccess(*DAG.getContext(), DAG.getDataLayout(), VT,
74387433 LN0->getAddressSpace(), OrigAlign, &Fast) &&
74397434 Fast) {
7440 SDValue Load = DAG.getLoad(VT, SDLoc(N), LN0->getChain(),
7441 LN0->getBasePtr(), LN0->getPointerInfo(),
7442 LN0->isVolatile(), LN0->isNonTemporal(),
7443 LN0->isInvariant(), OrigAlign,
7444 LN0->getAAInfo());
7435 SDValue Load =
7436 DAG.getLoad(VT, SDLoc(N), LN0->getChain(), LN0->getBasePtr(),
7437 LN0->getPointerInfo(), OrigAlign,
7438 LN0->getMemOperand()->getFlags(), LN0->getAAInfo());
74457439 DAG.ReplaceAllUsesOfValueWith(N0.getValue(1), Load.getValue(1));
74467440 return Load;
74477441 }
1010710101 if (OptLevel != CodeGenOpt::None && LD->isUnindexed()) {
1010810102 if (unsigned Align = DAG.InferPtrAlignment(Ptr)) {
1010910103 if (Align > LD->getMemOperand()->getBaseAlignment()) {
10110 SDValue NewLoad =
10111 DAG.getExtLoad(LD->getExtensionType(), SDLoc(N),
10112 LD->getValueType(0),
10113 Chain, Ptr, LD->getPointerInfo(),
10114 LD->getMemoryVT(),
10115 LD->isVolatile(), LD->isNonTemporal(),
10116 LD->isInvariant(), Align, LD->getAAInfo());
10104 SDValue NewLoad = DAG.getExtLoad(
10105 LD->getExtensionType(), SDLoc(N), LD->getValueType(0), Chain, Ptr,
10106 LD->getPointerInfo(), LD->getMemoryVT(), Align,
10107 LD->getMemOperand()->getFlags(), LD->getAAInfo());
1011710108 if (NewLoad.getNode() != N)
1011810109 return CombineTo(N, NewLoad, SDValue(NewLoad.getNode(), 1), true);
1011910110 }
1041410405 EVT SliceType = getLoadedType();
1041510406
1041610407 // Create the load for the slice.
10417 SDValue LastInst = DAG->getLoad(
10418 SliceType, SDLoc(Origin), Origin->getChain(), BaseAddr,
10419 Origin->getPointerInfo().getWithOffset(Offset), Origin->isVolatile(),
10420 Origin->isNonTemporal(), Origin->isInvariant(), getAlignment());
10408 SDValue LastInst =
10409 DAG->getLoad(SliceType, SDLoc(Origin), Origin->getChain(), BaseAddr,
10410 Origin->getPointerInfo().getWithOffset(Offset),
10411 getAlignment(), Origin->getMemOperand()->getFlags());
1042110412 // If the final type is not the same as the loaded type, this means that
1042210413 // we have to pad with zero. Create a zero extend for that.
1042310414 EVT FinalType = Inst->getValueType(0);
1084110832 IVal = DAG.getNode(ISD::TRUNCATE, SDLoc(IVal), VT, IVal);
1084210833
1084310834 ++OpsNarrowed;
10844 return DAG.getStore(St->getChain(), SDLoc(St), IVal, Ptr,
10845 St->getPointerInfo().getWithOffset(StOffset),
10846 false, false, NewAlign).getNode();
10835 return DAG
10836 .getStore(St->getChain(), SDLoc(St), IVal, Ptr,
10837 St->getPointerInfo().getWithOffset(StOffset), NewAlign)
10838 .getNode();
1084710839 }
1084810840
1084910841
1094910941 Ptr.getValueType(), Ptr,
1095010942 DAG.getConstant(PtrOff, SDLoc(LD),
1095110943 Ptr.getValueType()));
10952 SDValue NewLD = DAG.getLoad(NewVT, SDLoc(N0),
10953 LD->getChain(), NewPtr,
10954 LD->getPointerInfo().getWithOffset(PtrOff),
10955 LD->isVolatile(), LD->isNonTemporal(),
10956 LD->isInvariant(), NewAlign,
10957 LD->getAAInfo());
10944 SDValue NewLD =
10945 DAG.getLoad(NewVT, SDLoc(N0), LD->getChain(), NewPtr,
10946 LD->getPointerInfo().getWithOffset(PtrOff), NewAlign,
10947 LD->getMemOperand()->getFlags(), LD->getAAInfo());
1095810948 SDValue NewVal = DAG.getNode(Opc, SDLoc(Value), NewVT, NewLD,
1095910949 DAG.getConstant(NewImm, SDLoc(Value),
1096010950 NewVT));
10961 SDValue NewST = DAG.getStore(Chain, SDLoc(N),
10962 NewVal, NewPtr,
10963 ST->getPointerInfo().getWithOffset(PtrOff),
10964 false, false, NewAlign);
10951 SDValue NewST =
10952 DAG.getStore(Chain, SDLoc(N), NewVal, NewPtr,
10953 ST->getPointerInfo().getWithOffset(PtrOff), NewAlign);
1096510954
1096610955 AddToWorklist(NewPtr.getNode());
1096710956 AddToWorklist(NewLD.getNode());
1101010999 if (LDAlign < ABIAlign || STAlign < ABIAlign)
1101111000 return SDValue();
1101211001
11013 SDValue NewLD = DAG.getLoad(IntVT, SDLoc(Value),
11014 LD->getChain(), LD->getBasePtr(),
11015 LD->getPointerInfo(),
11016 false, false, false, LDAlign);
11017
11018 SDValue NewST = DAG.getStore(NewLD.getValue(1), SDLoc(N),
11019 NewLD, ST->getBasePtr(),
11020 ST->getPointerInfo(),
11021 false, false, STAlign);
11002 SDValue NewLD =
11003 DAG.getLoad(IntVT, SDLoc(Value), LD->getChain(), LD->getBasePtr(),
11004 LD->getPointerInfo(), LDAlign);
11005
11006 SDValue NewST =
11007 DAG.getStore(NewLD.getValue(1), SDLoc(N), NewLD, ST->getBasePtr(),
11008 ST->getPointerInfo(), STAlign);
1102211009
1102311010 AddToWorklist(NewLD.getNode());
1102411011 AddToWorklist(NewST.getNode());
1131711304 SDValue NewStore = DAG.getStore(NewChain, DL, StoredVal,
1131811305 FirstInChain->getBasePtr(),
1131911306 FirstInChain->getPointerInfo(),
11320 false, false,
1132111307 FirstInChain->getAlignment());
1132211308
1132311309 bool UseAA = CombinerAA.getNumOccurrences() > 0 ? CombinerAA
1186211848
1186311849 // The merged loads are required to have the same incoming chain, so
1186411850 // using the first's chain is acceptable.
11865 SDValue NewLoad = DAG.getLoad(
11866 JointMemOpVT, LoadDL, FirstLoad->getChain(), FirstLoad->getBasePtr(),
11867 FirstLoad->getPointerInfo(), false, false, false, FirstLoadAlign);
11851 SDValue NewLoad = DAG.getLoad(JointMemOpVT, LoadDL, FirstLoad->getChain(),
11852 FirstLoad->getBasePtr(),
11853 FirstLoad->getPointerInfo(), FirstLoadAlign);
1186811854
1186911855 SDValue NewStoreChain =
1187011856 DAG.getNode(ISD::TokenFactor, StoreDL, MVT::Other, MergeStoreChains);
1187111857
11872 SDValue NewStore = DAG.getStore(
11873 NewStoreChain, StoreDL, NewLoad, FirstInChain->getBasePtr(),
11874 FirstInChain->getPointerInfo(), false, false, FirstStoreAlign);
11858 SDValue NewStore =
11859 DAG.getStore(NewStoreChain, StoreDL, NewLoad, FirstInChain->getBasePtr(),
11860 FirstInChain->getPointerInfo(), FirstStoreAlign);
1187511861
1187611862 // Transfer chain users from old loads to the new load.
1187711863 for (unsigned i = 0; i < NumElem; ++i) {
1198611972 std::swap(Lo, Hi);
1198711973
1198811974 unsigned Alignment = ST->getAlignment();
11989 bool isVolatile = ST->isVolatile();
11990 bool isNonTemporal = ST->isNonTemporal();
11975 MachineMemOperand::Flags MMOFlags = ST->getMemOperand()->getFlags();
1199111976 AAMDNodes AAInfo = ST->getAAInfo();
1199211977
11993 SDValue St0 = DAG.getStore(Chain, DL, Lo,
11994 Ptr, ST->getPointerInfo(),
11995 isVolatile, isNonTemporal,
11996 ST->getAlignment(), AAInfo);
11978 SDValue St0 = DAG.getStore(Chain, DL, Lo, Ptr, ST->getPointerInfo(),
11979 ST->getAlignment(), MMOFlags, AAInfo);
1199711980 Ptr = DAG.getNode(ISD::ADD, DL, Ptr.getValueType(), Ptr,
1199811981 DAG.getConstant(4, DL, Ptr.getValueType()));
1199911982 Alignment = MinAlign(Alignment, 4U);
12000 SDValue St1 = DAG.getStore(Chain, DL, Hi,
12001 Ptr, ST->getPointerInfo().getWithOffset(4),
12002 isVolatile, isNonTemporal,
12003 Alignment, AAInfo);
11983 SDValue St1 = DAG.getStore(Chain, DL, Hi, Ptr,
11984 ST->getPointerInfo().getWithOffset(4),
11985 Alignment, MMOFlags, AAInfo);
1200411986 return DAG.getNode(ISD::TokenFactor, DL, MVT::Other,
1200511987 St0, St1);
1200611988 }
1202812010 if (TLI.allowsMemoryAccess(*DAG.getContext(), DAG.getDataLayout(), SVT,
1202912011 ST->getAddressSpace(), OrigAlign, &Fast) &&
1203012012 Fast) {
12031 return DAG.getStore(Chain, SDLoc(N), Value.getOperand(0),
12032 Ptr, ST->getPointerInfo(), ST->isVolatile(),
12033 ST->isNonTemporal(), OrigAlign,
12034 ST->getAAInfo());
12013 return DAG.getStore(Chain, SDLoc(N), Value.getOperand(0), Ptr,
12014 ST->getPointerInfo(), OrigAlign,
12015 ST->getMemOperand()->getFlags(), ST->getAAInfo());
1203512016 }
1203612017 }
1203712018 }
1204512026 if (unsigned Align = DAG.InferPtrAlignment(Ptr)) {
1204612027 if (Align > ST->getAlignment()) {
1204712028 SDValue NewStore =
12048 DAG.getTruncStore(Chain, SDLoc(N), Value,
12049 Ptr, ST->getPointerInfo(), ST->getMemoryVT(),
12050 ST->isVolatile(), ST->isNonTemporal(), Align,
12051 ST->getAAInfo());
12029 DAG.getTruncStore(Chain, SDLoc(N), Value, Ptr, ST->getPointerInfo(),
12030 ST->getMemoryVT(), Align,
12031 ST->getMemOperand()->getFlags(), ST->getAAInfo());
1205212032 if (NewStore.getNode() != N)
1205312033 return CombineTo(ST, NewStore, true);
1205412034 }
1230012280 VecEltVT)
1230112281 ? ISD::ZEXTLOAD
1230212282 : ISD::EXTLOAD;
12303 Load = DAG.getExtLoad(
12304 ExtType, SDLoc(EVE), ResultVT, OriginalLoad->getChain(), NewPtr, MPI,
12305 VecEltVT, OriginalLoad->isVolatile(), OriginalLoad->isNonTemporal(),
12306 OriginalLoad->isInvariant(), Align, OriginalLoad->getAAInfo());
12283 Load = DAG.getExtLoad(ExtType, SDLoc(EVE), ResultVT,
12284 OriginalLoad->getChain(), NewPtr, MPI, VecEltVT,
12285 Align, OriginalLoad->getMemOperand()->getFlags(),
12286 OriginalLoad->getAAInfo());
1230712287 Chain = Load.getValue(1);
1230812288 } else {
12309 Load = DAG.getLoad(
12310 VecEltVT, SDLoc(EVE), OriginalLoad->getChain(), NewPtr, MPI,
12311 OriginalLoad->isVolatile(), OriginalLoad->isNonTemporal(),
12312 OriginalLoad->isInvariant(), Align, OriginalLoad->getAAInfo());
12289 Load = DAG.getLoad(VecEltVT, SDLoc(EVE), OriginalLoad->getChain(), NewPtr,
12290 MPI, Align, OriginalLoad->getMemOperand()->getFlags(),
12291 OriginalLoad->getAAInfo());
1231312292 Chain = Load.getValue(1);
1231412293 if (ResultVT.bitsLT(VecEltVT))
1231512294 Load = DAG.getNode(ISD::TRUNCATE, SDLoc(EVE), ResultVT, Load);
1412114100 // It is safe to replace the two loads if they have different alignments,
1412214101 // but the new load must be the minimum (most restrictive) alignment of the
1412314102 // inputs.
14124 bool isInvariant = LLD->isInvariant() & RLD->isInvariant();
1412514103 unsigned Alignment = std::min(LLD->getAlignment(), RLD->getAlignment());
14104 MachineMemOperand::Flags MMOFlags = LLD->getMemOperand()->getFlags();
14105 if (!RLD->isInvariant())
14106 MMOFlags &= ~MachineMemOperand::MOInvariant;
1412614107 if (LLD->getExtensionType() == ISD::NON_EXTLOAD) {
14127 Load = DAG.getLoad(TheSelect->getValueType(0),
14128 SDLoc(TheSelect),
14129 // FIXME: Discards pointer and AA info.
14130 LLD->getChain(), Addr, MachinePointerInfo(),
14131 LLD->isVolatile(), LLD->isNonTemporal(),
14132 isInvariant, Alignment);
14108 // FIXME: Discards pointer and AA info.
14109 Load = DAG.getLoad(TheSelect->getValueType(0), SDLoc(TheSelect),
14110 LLD->getChain(), Addr, MachinePointerInfo(), Alignment,
14111 MMOFlags);
1413314112 } else {
14134 Load = DAG.getExtLoad(LLD->getExtensionType() == ISD::EXTLOAD ?
14135 RLD->getExtensionType() : LLD->getExtensionType(),
14136 SDLoc(TheSelect),
14137 TheSelect->getValueType(0),
14138 // FIXME: Discards pointer and AA info.
14139 LLD->getChain(), Addr, MachinePointerInfo(),
14140 LLD->getMemoryVT(), LLD->isVolatile(),
14141 LLD->isNonTemporal(), isInvariant, Alignment);
14113 // FIXME: Discards pointer and AA info.
14114 Load = DAG.getExtLoad(
14115 LLD->getExtensionType() == ISD::EXTLOAD ? RLD->getExtensionType()
14116 : LLD->getExtensionType(),
14117 SDLoc(TheSelect), TheSelect->getValueType(0), LLD->getChain(), Addr,
14118 MachinePointerInfo(), LLD->getMemoryVT(), Alignment, MMOFlags);
1414214119 }
1414314120
1414414121 // Users of the select now use the result of the load.
1424614223 return DAG.getLoad(
1424714224 TV->getValueType(0), DL, DAG.getEntryNode(), CPIdx,
1424814225 MachinePointerInfo::getConstantPool(DAG.getMachineFunction()),
14249 false, false, false, Alignment);
14226 Alignment);
1425014227 }
1425114228 }
1425214229
281281 SDValue Result = DAG.getExtLoad(
282282 ISD::EXTLOAD, dl, OrigVT, DAG.getEntryNode(), CPIdx,
283283 MachinePointerInfo::getConstantPool(DAG.getMachineFunction()), VT,
284 false, false, false, Alignment);
284 Alignment);
285285 return Result;
286286 }
287 SDValue Result =
288 DAG.getLoad(OrigVT, dl, DAG.getEntryNode(), CPIdx,
289 MachinePointerInfo::getConstantPool(DAG.getMachineFunction()),
290 false, false, false, Alignment);
287 SDValue Result = DAG.getLoad(
288 OrigVT, dl, DAG.getEntryNode(), CPIdx,
289 MachinePointerInfo::getConstantPool(DAG.getMachineFunction()), Alignment);
291290 return Result;
292291 }
293292
298297 SDValue CPIdx = DAG.getConstantPool(CP->getConstantIntValue(),
299298 TLI.getPointerTy(DAG.getDataLayout()));
300299 unsigned Alignment = cast(CPIdx)->getAlignment();
301 SDValue Result =
302 DAG.getLoad(VT, dl, DAG.getEntryNode(), CPIdx,
303 MachinePointerInfo::getConstantPool(DAG.getMachineFunction()),
304 false, false, false, Alignment);
300 SDValue Result = DAG.getLoad(
301 VT, dl, DAG.getEntryNode(), CPIdx,
302 MachinePointerInfo::getConstantPool(DAG.getMachineFunction()), Alignment);
305303 return Result;
306304 }
307305
334332 // Store the vector.
335333 SDValue Ch = DAG.getStore(
336334 DAG.getEntryNode(), dl, Tmp1, StackPtr,
337 MachinePointerInfo::getFixedStack(DAG.getMachineFunction(), SPFI), false,
338 false, 0);
335 MachinePointerInfo::getFixedStack(DAG.getMachineFunction(), SPFI));
339336
340337 // Truncate or zero extend offset to target pointer type.
341338 Tmp3 = DAG.getZExtOrTrunc(Tmp3, dl, PtrVT);
345342 DAG.getConstant(EltSize, dl, IdxVT));
346343 SDValue StackPtr2 = DAG.getNode(ISD::ADD, dl, IdxVT, Tmp3, StackPtr);
347344 // Store the scalar value.
348 Ch = DAG.getTruncStore(Ch, dl, Tmp2, StackPtr2, MachinePointerInfo(), EltVT,
349 false, false, 0);
345 Ch = DAG.getTruncStore(Ch, dl, Tmp2, StackPtr2, MachinePointerInfo(), EltVT);
350346 // Load the updated vector.
351347 return DAG.getLoad(VT, dl, Ch, StackPtr, MachinePointerInfo::getFixedStack(
352 DAG.getMachineFunction(), SPFI),
353 false, false, false, 0);
348 DAG.getMachineFunction(), SPFI));
354349 }
355350
356351 SDValue SelectionDAGLegalize::ExpandINSERT_VECTOR_ELT(SDValue Vec, SDValue Val,
391386 SDValue Chain = ST->getChain();
392387 SDValue Ptr = ST->getBasePtr();
393388 unsigned Alignment = ST->getAlignment();
394 bool isVolatile = ST->isVolatile();
395 bool isNonTemporal = ST->isNonTemporal();
389 MachineMemOperand::Flags MMOFlags = ST->getMemOperand()->getFlags();
396390 AAMDNodes AAInfo = ST->getAAInfo();
397391 SDLoc dl(ST);
398392 if (ConstantFPSDNode *CFP = dyn_cast(ST->getValue())) {
401395 SDValue Con = DAG.getConstant(CFP->getValueAPF().
402396 bitcastToAPInt().zextOrTrunc(32),
403397 SDLoc(CFP), MVT::i32);
404 return DAG.getStore(Chain, dl, Con, Ptr, ST->getPointerInfo(),
405 isVolatile, isNonTemporal, Alignment, AAInfo);
398 return DAG.getStore(Chain, dl, Con, Ptr, ST->getPointerInfo(), Alignment,
399 MMOFlags, AAInfo);
406400 }
407401
408402 if (CFP->getValueType(0) == MVT::f64) {
411405 SDValue Con = DAG.getConstant(CFP->getValueAPF().bitcastToAPInt().
412406 zextOrTrunc(64), SDLoc(CFP), MVT::i64);
413407 return DAG.getStore(Chain, dl, Con, Ptr, ST->getPointerInfo(),
414 isVolatile, isNonTemporal, Alignment, AAInfo);
408 Alignment, MMOFlags, AAInfo);
415409 }
416410
417411 if (TLI.isTypeLegal(MVT::i32) && !ST->isVolatile()) {
424418 if (DAG.getDataLayout().isBigEndian())
425419 std::swap(Lo, Hi);
426420
427 Lo = DAG.getStore(Chain, dl, Lo, Ptr, ST->getPointerInfo(), isVolatile,
428 isNonTemporal, Alignment, AAInfo);
421 Lo = DAG.getStore(Chain, dl, Lo, Ptr, ST->getPointerInfo(), Alignment,
422 MMOFlags, AAInfo);
429423 Ptr = DAG.getNode(ISD::ADD, dl, Ptr.getValueType(), Ptr,
430424 DAG.getConstant(4, dl, Ptr.getValueType()));
431425 Hi = DAG.getStore(Chain, dl, Hi, Ptr,
432426 ST->getPointerInfo().getWithOffset(4),
433 isVolatile, isNonTemporal, MinAlign(Alignment, 4U),
434 AAInfo);
427 MinAlign(Alignment, 4U), MMOFlags, AAInfo);
435428
436429 return DAG.getNode(ISD::TokenFactor, dl, MVT::Other, Lo, Hi);
437430 }
447440 SDLoc dl(Node);
448441
449442 unsigned Alignment = ST->getAlignment();
450 bool isVolatile = ST->isVolatile();
451 bool isNonTemporal = ST->isNonTemporal();
443 MachineMemOperand::Flags MMOFlags = ST->getMemOperand()->getFlags();
452444 AAMDNodes AAInfo = ST->getAAInfo();
453445
454446 if (!ST->isTruncatingStore()) {
487479 "Can only promote stores to same size type");
488480 Value = DAG.getNode(ISD::BITCAST, dl, NVT, Value);
489481 SDValue Result =
490 DAG.getStore(Chain, dl, Value, Ptr,
491 ST->getPointerInfo(), isVolatile,
492 isNonTemporal, Alignment, AAInfo);
482 DAG.getStore(Chain, dl, Value, Ptr, ST->getPointerInfo(),
483 Alignment, MMOFlags, AAInfo);
493484 ReplaceNode(SDValue(Node, 0), Result);
494485 break;
495486 }
511502 StVT.getStoreSizeInBits());
512503 Value = DAG.getZeroExtendInReg(Value, dl, StVT);
513504 SDValue Result =
514 DAG.getTruncStore(Chain, dl, Value, Ptr, ST->getPointerInfo(),
515 NVT, isVolatile, isNonTemporal, Alignment, AAInfo);
505 DAG.getTruncStore(Chain, dl, Value, Ptr, ST->getPointerInfo(), NVT,
506 Alignment, MMOFlags, AAInfo);
516507 ReplaceNode(SDValue(Node, 0), Result);
517508 } else if (StWidth & (StWidth - 1)) {
518509 // If not storing a power-of-2 number of bits, expand as two stores.
532523 // TRUNCSTORE:i24 X -> TRUNCSTORE:i16 X, TRUNCSTORE@+2:i8 (srl X, 16)
533524 // Store the bottom RoundWidth bits.
534525 Lo = DAG.getTruncStore(Chain, dl, Value, Ptr, ST->getPointerInfo(),
535 RoundVT,
536 isVolatile, isNonTemporal, Alignment,
537 AAInfo);
526 RoundVT, Alignment, MMOFlags, AAInfo);
538527
539528 // Store the remaining ExtraWidth bits.
540529 IncrementSize = RoundWidth / 8;
545534 ISD::SRL, dl, Value.getValueType(), Value,
546535 DAG.getConstant(RoundWidth, dl,
547536 TLI.getShiftAmountTy(Value.getValueType(), DL)));
548 Hi = DAG.getTruncStore(Chain, dl, Hi, Ptr,
549 ST->getPointerInfo().getWithOffset(IncrementSize),
550 ExtraVT, isVolatile, isNonTemporal,
551 MinAlign(Alignment, IncrementSize), AAInfo);
537 Hi = DAG.getTruncStore(
538 Chain, dl, Hi, Ptr,
539 ST->getPointerInfo().getWithOffset(IncrementSize), ExtraVT,
540 MinAlign(Alignment, IncrementSize), MMOFlags, AAInfo);
552541 } else {
553542 // Big endian - avoid unaligned stores.
554543 // TRUNCSTORE:i24 X -> TRUNCSTORE:i16 (srl X, 8), TRUNCSTORE@+2:i8 X
558547 DAG.getConstant(ExtraWidth, dl,
559548 TLI.getShiftAmountTy(Value.getValueType(), DL)));
560549 Hi = DAG.getTruncStore(Chain, dl, Hi, Ptr, ST->getPointerInfo(),
561 RoundVT, isVolatile, isNonTemporal, Alignment,
562 AAInfo);
550 RoundVT, Alignment, MMOFlags, AAInfo);
563551
564552 // Store the remaining ExtraWidth bits.
565553 IncrementSize = RoundWidth / 8;
566554 Ptr = DAG.getNode(ISD::ADD, dl, Ptr.getValueType(), Ptr,
567555 DAG.getConstant(IncrementSize, dl,
568556 Ptr.getValueType()));
569 Lo = DAG.getTruncStore(Chain, dl, Value, Ptr,
570 ST->getPointerInfo().getWithOffset(IncrementSize),
571 ExtraVT, isVolatile, isNonTemporal,
572 MinAlign(Alignment, IncrementSize), AAInfo);
557 Lo = DAG.getTruncStore(
558 Chain, dl, Value, Ptr,
559 ST->getPointerInfo().getWithOffset(IncrementSize), ExtraVT,
560 MinAlign(Alignment, IncrementSize), MMOFlags, AAInfo);
573561 }
574562
575563 // The order of the stores doesn't matter.
605593 "Do not know how to expand this store!");
606594 Value = DAG.getNode(ISD::TRUNCATE, dl, StVT, Value);
607595 SDValue Result =
608 DAG.getStore(Chain, dl, Value, Ptr, ST->getPointerInfo(),
609 isVolatile, isNonTemporal, Alignment, AAInfo);
596 DAG.getStore(Chain, dl, Value, Ptr, ST->getPointerInfo(),
597 Alignment, MMOFlags, AAInfo);
610598 ReplaceNode(SDValue(Node, 0), Result);
611599 break;
612600 }
675663 EVT SrcVT = LD->getMemoryVT();
676664 unsigned SrcWidth = SrcVT.getSizeInBits();
677665 unsigned Alignment = LD->getAlignment();
678 bool isVolatile = LD->isVolatile();
679 bool isNonTemporal = LD->isNonTemporal();
680 bool isInvariant = LD->isInvariant();
666 MachineMemOperand::Flags MMOFlags = LD->getMemOperand()->getFlags();
681667 AAMDNodes AAInfo = LD->getAAInfo();
682668
683669 if (SrcWidth != SrcVT.getStoreSizeInBits() &&
704690 ExtType == ISD::ZEXTLOAD ? ISD::ZEXTLOAD : ISD::EXTLOAD;
705691
706692 SDValue Result =
707 DAG.getExtLoad(NewExtType, dl, Node->getValueType(0),
708 Chain, Ptr, LD->getPointerInfo(),
709 NVT, isVolatile, isNonTemporal, isInvariant, Alignment,
710 AAInfo);
693 DAG.getExtLoad(NewExtType, dl, Node->getValueType(0), Chain, Ptr,
694 LD->getPointerInfo(), NVT, Alignment, MMOFlags, AAInfo);
711695
712696 Ch = Result.getValue(1); // The chain.
713697
742726 if (DL.isLittleEndian()) {
743727 // EXTLOAD:i24 -> ZEXTLOAD:i16 | (shl EXTLOAD@+2:i8, 16)
744728 // Load the bottom RoundWidth bits.
745 Lo = DAG.getExtLoad(ISD::ZEXTLOAD, dl, Node->getValueType(0),
746 Chain, Ptr,
747 LD->getPointerInfo(), RoundVT, isVolatile,
748 isNonTemporal, isInvariant, Alignment, AAInfo);
729 Lo = DAG.getExtLoad(ISD::ZEXTLOAD, dl, Node->getValueType(0), Chain, Ptr,
730 LD->getPointerInfo(), RoundVT, Alignment, MMOFlags,
731 AAInfo);
749732
750733 // Load the remaining ExtraWidth bits.
751734 IncrementSize = RoundWidth / 8;
754737 Ptr.getValueType()));
755738 Hi = DAG.getExtLoad(ExtType, dl, Node->getValueType(0), Chain, Ptr,
756739 LD->getPointerInfo().getWithOffset(IncrementSize),
757 ExtraVT, isVolatile, isNonTemporal, isInvariant,
758 MinAlign(Alignment, IncrementSize), AAInfo);
740 ExtraVT, MinAlign(Alignment, IncrementSize), MMOFlags,
741 AAInfo);
759742
760743 // Build a factor node to remember that this load is independent of
761744 // the other one.
775758 // EXTLOAD:i24 -> (shl EXTLOAD:i16, 8) | ZEXTLOAD@+2:i8
776759 // Load the top RoundWidth bits.
777760 Hi = DAG.getExtLoad(ExtType, dl, Node->getValueType(0), Chain, Ptr,
778 LD->getPointerInfo(), RoundVT, isVolatile,
779 isNonTemporal, isInvariant, Alignment, AAInfo);
761 LD->getPointerInfo(), RoundVT, Alignment, MMOFlags,
762 AAInfo);
780763
781764 // Load the remaining ExtraWidth bits.
782765 IncrementSize = RoundWidth / 8;
783766 Ptr = DAG.getNode(ISD::ADD, dl, Ptr.getValueType(), Ptr,
784767 DAG.getConstant(IncrementSize, dl,
785768 Ptr.getValueType()));
786 Lo = DAG.getExtLoad(ISD::ZEXTLOAD,
787 dl, Node->getValueType(0), Chain, Ptr,
769 Lo = DAG.getExtLoad(ISD::ZEXTLOAD, dl, Node->getValueType(0), Chain, Ptr,
788770 LD->getPointerInfo().getWithOffset(IncrementSize),
789 ExtraVT, isVolatile, isNonTemporal, isInvariant,
790 MinAlign(Alignment, IncrementSize), AAInfo);
771 ExtraVT, MinAlign(Alignment, IncrementSize), MMOFlags,
772 AAInfo);
791773
792774 // Build a factor node to remember that this load is independent of
793775 // the other one.
12161198 // Store the value to a temporary stack slot, then LOAD the returned part.
12171199 StackPtr = DAG.CreateStackTemporary(Vec.getValueType());
12181200 Ch = DAG.getStore(DAG.getEntryNode(), dl, Vec, StackPtr,
1219 MachinePointerInfo(), false, false, 0);
1201 MachinePointerInfo());
12201202 }
12211203
12221204 // Add the offset to the index.
12311213 SDValue NewLoad;
12321214
12331215 if (Op.getValueType().isVector())
1234 NewLoad = DAG.getLoad(Op.getValueType(), dl, Ch, StackPtr,
1235 MachinePointerInfo(), false, false, false, 0);
1216 NewLoad =
1217 DAG.getLoad(Op.getValueType(), dl, Ch, StackPtr, MachinePointerInfo());
12361218 else
1237 NewLoad = DAG.getExtLoad(
1238 ISD::EXTLOAD, dl, Op.getValueType(), Ch, StackPtr, MachinePointerInfo(),
1239 Vec.getValueType().getVectorElementType(), false, false, false, 0);
1219 NewLoad = DAG.getExtLoad(ISD::EXTLOAD, dl, Op.getValueType(), Ch, StackPtr,
1220 MachinePointerInfo(),
1221 Vec.getValueType().getVectorElementType());
12401222
12411223 // Replace the chain going out of the store, by the one out of the load.
12421224 DAG.ReplaceAllUsesOfValueWith(Ch, SDValue(NewLoad.getNode(), 1));
12671249 MachinePointerInfo::getFixedStack(DAG.getMachineFunction(), FI);
12681250
12691251 // First store the whole vector.
1270 SDValue Ch = DAG.getStore(DAG.getEntryNode(), dl, Vec, StackPtr, PtrInfo,
1271 false, false, 0);
1252 SDValue Ch = DAG.getStore(DAG.getEntryNode(), dl, Vec, StackPtr, PtrInfo);
12721253
12731254 // Then store the inserted part.
12741255
12841265 StackPtr);
12851266
12861267 // Store the subvector.
1287 Ch = DAG.getStore(Ch, dl, Part, SubStackPtr,
1288 MachinePointerInfo(), false, false, 0);
1268 Ch = DAG.getStore(Ch, dl, Part, SubStackPtr, MachinePointerInfo());
12891269
12901270 // Finally, load the updated vector.
1291 return DAG.getLoad(Op.getValueType(), dl, Ch, StackPtr, PtrInfo,
1292 false, false, false, 0);
1271 return DAG.getLoad(Op.getValueType(), dl, Ch, StackPtr, PtrInfo);
12931272 }
12941273
12951274 SDValue SelectionDAGLegalize::ExpandVectorBuildThroughStack(SDNode* Node) {
13231302 if (EltVT.bitsLT(Node->getOperand(i).getValueType().getScalarType())) {
13241303 Stores.push_back(DAG.getTruncStore(DAG.getEntryNode(), dl,
13251304 Node->getOperand(i), Idx,
1326 PtrInfo.getWithOffset(Offset),
1327 EltVT, false, false, 0));
1305 PtrInfo.getWithOffset(Offset), EltVT));
13281306 } else
1329 Stores.push_back(DAG.getStore(DAG.getEntryNode(), dl,
1330 Node->getOperand(i), Idx,
1331 PtrInfo.getWithOffset(Offset),
1332 false, false, 0));
1307 Stores.push_back(DAG.getStore(DAG.getEntryNode(), dl, Node->getOperand(i),
1308 Idx, PtrInfo.getWithOffset(Offset)));
13331309 }
13341310
13351311 SDValue StoreChain;
13391315 StoreChain = DAG.getEntryNode();
13401316
13411317 // Result is a load from the stack slot.
1342 return DAG.getLoad(VT, dl, StoreChain, FIPtr, PtrInfo,
1343 false, false, false, 0);
1318 return DAG.getLoad(VT, dl, StoreChain, FIPtr, PtrInfo);
13441319 }
13451320
13461321 namespace {
13881363 MachineFunction &MF = DAG.getMachineFunction();
13891364 State.FloatPointerInfo = MachinePointerInfo::getFixedStack(MF, FI);
13901365 State.Chain = DAG.getStore(DAG.getEntryNode(), DL, Value, State.FloatPtr,
1391 State.FloatPointerInfo, false, false, 0);
1366 State.FloatPointerInfo);
13921367
13931368 SDValue IntPtr;
13941369 if (DataLayout.isBigEndian()) {
14061381 }
14071382
14081383 State.IntPtr = IntPtr;
1409 State.IntValue = DAG.getExtLoad(ISD::EXTLOAD, DL, LoadTy, State.Chain,
1410 IntPtr, State.IntPointerInfo, MVT::i8,
1411 false, false, false, 0);
1384 State.IntValue = DAG.getExtLoad(ISD::EXTLOAD, DL, LoadTy, State.Chain, IntPtr,
1385 State.IntPointerInfo, MVT::i8);
14121386 State.SignMask = APInt::getOneBitSet(LoadTy.getSizeInBits(), 7);
14131387 State.SignBit = 7;
14141388 }
14231397
14241398 // Override the part containing the sign bit in the value stored on the stack.
14251399 SDValue Chain = DAG.getTruncStore(State.Chain, DL, NewIntValue, State.IntPtr,
1426 State.IntPointerInfo, MVT::i8, false, false,
1427 0);
1400 State.IntPointerInfo, MVT::i8);
14281401 return DAG.getLoad(State.FloatVT, DL, Chain, State.FloatPtr,
1429 State.FloatPointerInfo, false, false, false, 0);
1402 State.FloatPointerInfo);
14301403 }
14311404
14321405 SDValue SelectionDAGLegalize::ExpandFCOPYSIGN(SDNode *Node) const {
16861659 SDValue Store;
16871660
16881661 if (SrcSize > SlotSize)
1689 Store = DAG.getTruncStore(DAG.getEntryNode(), dl, SrcOp, FIPtr,
1690 PtrInfo, SlotVT, false, false, SrcAlign);
1662 Store = DAG.getTruncStore(DAG.getEntryNode(), dl, SrcOp, FIPtr, PtrInfo,
1663 SlotVT, SrcAlign);
16911664 else {
16921665 assert(SrcSize == SlotSize && "Invalid store");
1693 Store = DAG.getStore(DAG.getEntryNode(), dl, SrcOp, FIPtr,
1694 PtrInfo, false, false, SrcAlign);
1666 Store =
1667 DAG.getStore(DAG.getEntryNode(), dl, SrcOp, FIPtr, PtrInfo, SrcAlign);
16951668 }
16961669
16971670 // Result is a load from the stack slot.
16981671 if (SlotSize == DestSize)
1699 return DAG.getLoad(DestVT, dl, Store, FIPtr, PtrInfo,
1700 false, false, false, DestAlign);
1672 return DAG.getLoad(DestVT, dl, Store, FIPtr, PtrInfo, DestAlign);
17011673
17021674 assert(SlotSize < DestSize && "Unknown extension!");
1703 return DAG.getExtLoad(ISD::EXTLOAD, dl, DestVT, Store, FIPtr,
1704 PtrInfo, SlotVT, false, false, false, DestAlign);
1675 return DAG.getExtLoad(ISD::EXTLOAD, dl, DestVT, Store, FIPtr, PtrInfo, SlotVT,
1676 DestAlign);
17051677 }
17061678
17071679 SDValue SelectionDAGLegalize::ExpandSCALAR_TO_VECTOR(SDNode *Node) {
17161688 SDValue Ch = DAG.getTruncStore(
17171689 DAG.getEntryNode(), dl, Node->getOperand(0), StackPtr,
17181690 MachinePointerInfo::getFixedStack(DAG.getMachineFunction(), SPFI),
1719 Node->getValueType(0).getVectorElementType(), false, false, 0);
1691 Node->getValueType(0).getVectorElementType());
17201692 return DAG.getLoad(
17211693 Node->getValueType(0), dl, Ch, StackPtr,
1722 MachinePointerInfo::getFixedStack(DAG.getMachineFunction(), SPFI), false,
1723 false, false, 0);
1694 MachinePointerInfo::getFixedStack(DAG.getMachineFunction(), SPFI));
17241695 }
17251696
17261697 static bool
18881859 unsigned Alignment = cast(CPIdx)->getAlignment();
18891860 return DAG.getLoad(
18901861 VT, dl, DAG.getEntryNode(), CPIdx,
1891 MachinePointerInfo::getConstantPool(DAG.getMachineFunction()), false,
1892 false, false, Alignment);
1862 MachinePointerInfo::getConstantPool(DAG.getMachineFunction()),
1863 Alignment);
18931864 }
18941865
18951866 SmallSet DefinedValues;
21412112 std::pair CallInfo = TLI.LowerCallTo(CLI);
21422113
21432114 // Remainder is loaded back from the stack frame.
2144 SDValue Rem = DAG.getLoad(RetVT, dl, CallInfo.second, FIPtr,
2145 MachinePointerInfo(), false, false, false, 0);
2115 SDValue Rem =
2116 DAG.getLoad(RetVT, dl, CallInfo.second, FIPtr, MachinePointerInfo());
21462117 Results.push_back(CallInfo.first);
21472118 Results.push_back(Rem);
21482119 }
22512222
22522223 std::pair CallInfo = TLI.LowerCallTo(CLI);
22532224
2254 Results.push_back(DAG.getLoad(RetVT, dl, CallInfo.second, SinPtr,
2255 MachinePointerInfo(), false, false, false, 0));
2256 Results.push_back(DAG.getLoad(RetVT, dl, CallInfo.second, CosPtr,
2257 MachinePointerInfo(), false, false, false, 0));
2225 Results.push_back(
2226 DAG.getLoad(RetVT, dl, CallInfo.second, SinPtr, MachinePointerInfo()));
2227 Results.push_back(
2228 DAG.getLoad(RetVT, dl, CallInfo.second, CosPtr, MachinePointerInfo()));
22582229 }
22592230
22602231 /// This function is responsible for legalizing a
22922263 Op0Mapped = Op0;
22932264 }
22942265 // store the lo of the constructed double - based on integer input
2295 SDValue Store1 = DAG.getStore(DAG.getEntryNode(), dl,
2296 Op0Mapped, Lo, MachinePointerInfo(),
2297 false, false, 0);
2266 SDValue Store1 = DAG.getStore(DAG.getEntryNode(), dl, Op0Mapped, Lo,
2267 MachinePointerInfo());
22982268 // initial hi portion of constructed double
22992269 SDValue InitialHi = DAG.getConstant(0x43300000u, dl, MVT::i32);
23002270 // store the hi of the constructed double - biased exponent
2301 SDValue Store2 = DAG.getStore(Store1, dl, InitialHi, Hi,
2302 MachinePointerInfo(),
2303 false, false, 0);
2271 SDValue Store2 =
2272 DAG.getStore(Store1, dl, InitialHi, Hi, MachinePointerInfo());
23042273 // load the constructed double
2305 SDValue Load = DAG.getLoad(MVT::f64, dl, Store2, StackSlot,
2306 MachinePointerInfo(), false, false, false, 0);
2274 SDValue Load =
2275 DAG.getLoad(MVT::f64, dl, Store2, StackSlot, MachinePointerInfo());
23072276 // FP constant to bias correct the final result
23082277 SDValue Bias = DAG.getConstantFP(isSigned ?
23092278 BitsToDouble(0x4330000080000000ULL) :
24512420 if (DestVT == MVT::f32)
24522421 FudgeInReg = DAG.getLoad(
24532422 MVT::f32, dl, DAG.getEntryNode(), CPIdx,
2454 MachinePointerInfo::getConstantPool(DAG.getMachineFunction()), false,
2455 false, false, Alignment);
2423 MachinePointerInfo::getConstantPool(DAG.getMachineFunction()),
2424 Alignment);
24562425 else {
24572426 SDValue Load = DAG.getExtLoad(
24582427 ISD::EXTLOAD, dl, DestVT, DAG.getEntryNode(), CPIdx,
24592428 MachinePointerInfo::getConstantPool(DAG.getMachineFunction()), MVT::f32,
2460 false, false, false, Alignment);
2429 Alignment);
24612430 HandleSDNode Handle(Load);
24622431 LegalizeOp(Load.getNode());
24632432 FudgeInReg = Handle.getValue();
35043473 EVT MemVT = EVT::getIntegerVT(*DAG.getContext(), EntrySize * 8);
35053474 SDValue LD = DAG.getExtLoad(
35063475 ISD::SEXTLOAD, dl, PTy, Chain, Addr,
3507 MachinePointerInfo::getJumpTable(DAG.getMachineFunction()), MemVT,
3508 false, false, false, 0);
3476 MachinePointerInfo::getJumpTable(DAG.getMachineFunction()), MemVT);
35093477 Addr = LD;
35103478 if (TM.isPositionIndependent()) {
35113479 // For PIC, the sequence is:
630630 EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), VT);
631631 SDLoc dl(N);
632632
633 auto MMOFlags =
634 L->getMemOperand()->getFlags() & ~MachineMemOperand::MOInvariant;
633635 SDValue NewL;
634636 if (L->getExtensionType() == ISD::NON_EXTLOAD) {
635 NewL = DAG.getLoad(L->getAddressingMode(), L->getExtensionType(),
636 NVT, dl, L->getChain(), L->getBasePtr(), L->getOffset(),
637 L->getPointerInfo(), NVT, L->isVolatile(),
638 L->isNonTemporal(), false, L->getAlignment(),
637 NewL = DAG.getLoad(L->getAddressingMode(), L->getExtensionType(), NVT, dl,
638 L->getChain(), L->getBasePtr(), L->getOffset(),
639 L->getPointerInfo(), NVT, L->getAlignment(), MMOFlags,
639640 L->getAAInfo());
640641 // Legalized the chain result - switch anything that used the old chain to
641642 // use the new one.
645646 }
646647
647648 // Do a non-extending load followed by FP_EXTEND.
648 NewL = DAG.getLoad(L->getAddressingMode(), ISD::NON_EXTLOAD,
649 L->getMemoryVT(), dl, L->getChain(),
650 L->getBasePtr(), L->getOffset(), L->getPointerInfo(),
651 L->getMemoryVT(), L->isVolatile(),
652 L->isNonTemporal(), false, L->getAlignment(),
653 L->getAAInfo());
649 NewL = DAG.getLoad(L->getAddressingMode(), ISD::NON_EXTLOAD, L->getMemoryVT(),
650 dl, L->getChain(), L->getBasePtr(), L->getOffset(),
651 L->getPointerInfo(), L->getMemoryVT(), L->getAlignment(),
652 MMOFlags, L->getAAInfo());
654653 // Legalized the chain result - switch anything that used the old chain to
655654 // use the new one.
656655 ReplaceValueWith(SDValue(N, 1), NewL.getValue(1));
20812080 LoadSDNode *L = cast(N);
20822081 EVT VT = N->getValueType(0);
20832082
2084 // Load the value as an integer value with the same number of bits
2083 // Load the value as an integer value with the same number of bits.
20852084 EVT IVT = EVT::getIntegerVT(*DAG.getContext(), VT.getSizeInBits());
2086 SDValue newL = DAG.getLoad(L->getAddressingMode(), L->getExtensionType(),
2087 IVT, SDLoc(N), L->getChain(), L->getBasePtr(),
2088 L->getOffset(), L->getPointerInfo(), IVT, L->isVolatile(),
2089 L->isNonTemporal(), false, L->getAlignment(),
2090 L->getAAInfo());
2085 auto MMOFlags =
2086 L->getMemOperand()->getFlags() & ~MachineMemOperand::MOInvariant;
2087 SDValue newL = DAG.getLoad(L->getAddressingMode(), L->getExtensionType(), IVT,
2088 SDLoc(N), L->getChain(), L->getBasePtr(),
2089 L->getOffset(), L->getPointerInfo(), IVT,
2090 L->getAlignment(), MMOFlags, L->getAAInfo());
20912091 // Legalize the chain result by replacing uses of the old value chain with the
20922092 // new one
20932093 ReplaceValueWith(SDValue(N, 1), newL.getValue(1));
20462046 SDValue Ptr = N->getBasePtr();
20472047 ISD::LoadExtType ExtType = N->getExtensionType();
20482048 unsigned Alignment = N->getAlignment();
2049 bool isVolatile = N->isVolatile();
2050 bool isNonTemporal = N->isNonTemporal();
2051 bool isInvariant = N->isInvariant();
2049 MachineMemOperand::Flags MMOFlags = N->getMemOperand()->getFlags();
20522050 AAMDNodes AAInfo = N->getAAInfo();
20532051 SDLoc dl(N);
20542052
20572055 if (N->getMemoryVT().bitsLE(NVT)) {
20582056 EVT MemVT = N->getMemoryVT();
20592057
2060 Lo = DAG.getExtLoad(ExtType, dl, NVT, Ch, Ptr, N->getPointerInfo(),
2061 MemVT, isVolatile, isNonTemporal, isInvariant,
2062 Alignment, AAInfo);
2058 Lo = DAG.getExtLoad(ExtType, dl, NVT, Ch, Ptr, N->getPointerInfo(), MemVT,
2059 Alignment, MMOFlags, AAInfo);
20632060
20642061 // Remember the chain.
20652062 Ch = Lo.getValue(1);
20812078 }
20822079 } else if (DAG.getDataLayout().isLittleEndian()) {
20832080 // Little-endian - low bits are at low addresses.
2084 Lo = DAG.getLoad(NVT, dl, Ch, Ptr, N->getPointerInfo(),
2085 isVolatile, isNonTemporal, isInvariant, Alignment,
2081 Lo = DAG.getLoad(NVT, dl, Ch, Ptr, N->getPointerInfo(), Alignment, MMOFlags,
20862082 AAInfo);
20872083
20882084 unsigned ExcessBits =
20952091 DAG.getConstant(IncrementSize, dl, Ptr.getValueType()));
20962092 Hi = DAG.getExtLoad(ExtType, dl, NVT, Ch, Ptr,
20972093 N->getPointerInfo().getWithOffset(IncrementSize), NEVT,
2098 isVolatile, isNonTemporal, isInvariant,
2099 MinAlign(Alignment, IncrementSize), AAInfo);
2094 MinAlign(Alignment, IncrementSize), MMOFlags, AAInfo);
21002095
21012096 // Build a factor node to remember that this load is independent of the
21022097 // other one.
21142109 Hi = DAG.getExtLoad(ExtType, dl, NVT, Ch, Ptr, N->getPointerInfo(),
21152110 EVT::getIntegerVT(*DAG.getContext(),
21162111 MemVT.getSizeInBits() - ExcessBits),
2117 isVolatile, isNonTemporal, isInvariant, Alignment,
2118 AAInfo);
2112 Alignment, MMOFlags, AAInfo);
21192113
21202114 // Increment the pointer to the other half.
21212115 Ptr = DAG.getNode(ISD::ADD, dl, Ptr.getValueType(), Ptr,
21242118 Lo = DAG.getExtLoad(ISD::ZEXTLOAD, dl, NVT, Ch, Ptr,
21252119 N->getPointerInfo().getWithOffset(IncrementSize),
21262120 EVT::getIntegerVT(*DAG.getContext(), ExcessBits),
2127 isVolatile, isNonTemporal, isInvariant,
2128 MinAlign(Alignment, IncrementSize), AAInfo);
2121 MinAlign(Alignment, IncrementSize), MMOFlags, AAInfo);
21292122
21302123 // Build a factor node to remember that this load is independent of the
21312124 // other one.
25772570
25782571 SDValue Temp = DAG.CreateStackTemporary(PtrVT);
25792572 // Temporary for the overflow value, default it to zero.
2580 SDValue Chain = DAG.getStore(DAG.getEntryNode(), dl,
2581 DAG.getConstant(0, dl, PtrVT), Temp,
2582 MachinePointerInfo(), false, false, 0);
2573 SDValue Chain =
2574 DAG.getStore(DAG.getEntryNode(), dl, DAG.getConstant(0, dl, PtrVT), Temp,
2575 MachinePointerInfo());
25832576
25842577 TargetLowering::ArgListTy Args;
25852578 TargetLowering::ArgListEntry Entry;
26102603 std::pair CallInfo = TLI.LowerCallTo(CLI);
26112604
26122605 SplitInteger(CallInfo.first, Lo, Hi);
2613 SDValue Temp2 = DAG.getLoad(PtrVT, dl, CallInfo.second, Temp,
2614 MachinePointerInfo(), false, false, false, 0);
2606 SDValue Temp2 =
2607 DAG.getLoad(PtrVT, dl, CallInfo.second, Temp, MachinePointerInfo());
26152608 SDValue Ofl = DAG.getSetCC(dl, N->getValueType(1), Temp2,
26162609 DAG.getConstant(0, dl, PtrVT),
26172610 ISD::SETNE);
30383031 SDValue Ch = N->getChain();
30393032 SDValue Ptr = N->getBasePtr();
30403033 unsigned Alignment = N->getAlignment();
3041 bool isVolatile = N->isVolatile();
3042 bool isNonTemporal = N->isNonTemporal();
3034 MachineMemOperand::Flags MMOFlags = N->getMemOperand()->getFlags();
30433035 AAMDNodes AAInfo = N->getAAInfo();
30443036 SDLoc dl(N);
30453037 SDValue Lo, Hi;
30493041 if (N->getMemoryVT().bitsLE(NVT)) {
30503042 GetExpandedInteger(N->getValue(), Lo, Hi);
30513043 return DAG.getTruncStore(Ch, dl, Lo, Ptr, N->getPointerInfo(),
3052 N->getMemoryVT(), isVolatile, isNonTemporal,
3053 Alignment, AAInfo);
3044 N->getMemoryVT(), Alignment, MMOFlags, AAInfo);
30543045 }
30553046
30563047 if (DAG.getDataLayout().isLittleEndian()) {
30573048 // Little-endian - low bits are at low addresses.
30583049 GetExpandedInteger(N->getValue(), Lo, Hi);
30593050
3060 Lo = DAG.getStore(Ch, dl, Lo, Ptr, N->getPointerInfo(),
3061 isVolatile, isNonTemporal, Alignment, AAInfo);
3051 Lo = DAG.getStore(Ch, dl, Lo, Ptr, N->getPointerInfo(), Alignment, MMOFlags,
3052 AAInfo);
30623053
30633054 unsigned ExcessBits =
30643055 N->getMemoryVT().getSizeInBits() - NVT.getSizeInBits();
30683059 unsigned IncrementSize = NVT.getSizeInBits()/8;
30693060 Ptr = DAG.getNode(ISD::ADD, dl, Ptr.getValueType(), Ptr,
30703061 DAG.getConstant(IncrementSize, dl, Ptr.getValueType()));
3071 Hi = DAG.getTruncStore(Ch, dl, Hi, Ptr,
3072 N->getPointerInfo().getWithOffset(IncrementSize),
3073 NEVT, isVolatile, isNonTemporal,
3074 MinAlign(Alignment, IncrementSize), AAInfo);
3062 Hi = DAG.getTruncStore(
3063 Ch, dl, Hi, Ptr, N->getPointerInfo().getWithOffset(IncrementSize), NEVT,
3064 MinAlign(Alignment, IncrementSize), MMOFlags, AAInfo);
30753065 return DAG.getNode(ISD::TokenFactor, dl, MVT::Other, Lo, Hi);
30763066 }
30773067
30993089 }
31003090
31013091 // Store both the high bits and maybe some of the low bits.
3102 Hi = DAG.getTruncStore(Ch, dl, Hi, Ptr, N->getPointerInfo(),
3103 HiVT, isVolatile, isNonTemporal, Alignment, AAInfo);
3092 Hi = DAG.getTruncStore(Ch, dl, Hi, Ptr, N->getPointerInfo(), HiVT, Alignment,
3093 MMOFlags, AAInfo);
31043094
31053095 // Increment the pointer to the other half.
31063096 Ptr = DAG.getNode(ISD::ADD, dl, Ptr.getValueType(), Ptr,
31093099 Lo = DAG.getTruncStore(Ch, dl, Lo, Ptr,
31103100 N->getPointerInfo().getWithOffset(IncrementSize),
31113101 EVT::getIntegerVT(*DAG.getContext(), ExcessBits),
3112 isVolatile, isNonTemporal,
3113 MinAlign(Alignment, IncrementSize), AAInfo);
3102 MinAlign(Alignment, IncrementSize), MMOFlags, AAInfo);
31143103 return DAG.getNode(ISD::TokenFactor, dl, MVT::Other, Lo, Hi);
31153104 }
31163105
31863175 SDValue Fudge = DAG.getExtLoad(
31873176 ISD::EXTLOAD, dl, DstVT, DAG.getEntryNode(), FudgePtr,
31883177 MachinePointerInfo::getConstantPool(DAG.getMachineFunction()), MVT::f32,
3189 false, false, false, Alignment);
3178 Alignment);
31903179 return DAG.getNode(ISD::FADD, dl, DstVT, SignedConv, Fudge);
31913180 }
31923181
926926 // the source and destination types.
927927 SDValue StackPtr = DAG.CreateStackTemporary(Op.getValueType(), DestVT);
928928 // Emit a store to the stack slot.
929 SDValue Store = DAG.getStore(DAG.getEntryNode(), dl, Op, StackPtr,
930 MachinePointerInfo(), false, false, 0);
929 SDValue Store =
930 DAG.getStore(DAG.getEntryNode(), dl, Op, StackPtr, MachinePointerInfo());
931931 // Result is a load from the stack slot.
932 return DAG.getLoad(DestVT, dl, Store, StackPtr, MachinePointerInfo(),
933 false, false, false, 0);
932 return DAG.getLoad(DestVT, dl, Store, StackPtr, MachinePointerInfo());
934933 }
935934
936935 /// Replace the node's results with custom code provided by the target and
169169 MachinePointerInfo::getFixedStack(DAG.getMachineFunction(), SPFI);
170170
171171 // Emit a store to the stack slot.
172 SDValue Store = DAG.getStore(DAG.getEntryNode(), dl, InOp, StackPtr, PtrInfo,
173 false, false, 0);
172 SDValue Store = DAG.getStore(DAG.getEntryNode(), dl, InOp, StackPtr, PtrInfo);
174173
175174 // Load the first half from the stack slot.
176 Lo = DAG.getLoad(NOutVT, dl, Store, StackPtr, PtrInfo,
177 false, false, false, 0);
175 Lo = DAG.getLoad(NOutVT, dl, Store, StackPtr, PtrInfo);
178176
179177 // Increment the pointer to the other half.
180178 unsigned IncrementSize = NOutVT.getSizeInBits() / 8;
184182
185183 // Load the second half from the stack slot.
186184 Hi = DAG.getLoad(NOutVT, dl, Store, StackPtr,
187 PtrInfo.getWithOffset(IncrementSize), false,
188 false, false, MinAlign(Alignment, IncrementSize));
185 PtrInfo.getWithOffset(IncrementSize),
186 MinAlign(Alignment, IncrementSize));
189187
190188 // Handle endianness of the load.
191189 if (TLI.hasBigEndianPartOrdering(OutVT, DAG.getDataLayout()))
262260 SDValue Chain = LD->getChain();
263261 SDValue Ptr = LD->getBasePtr();
264262 unsigned Alignment = LD->getAlignment();
265 bool isVolatile = LD->isVolatile();
266 bool isNonTemporal = LD->isNonTemporal();
267 bool isInvariant = LD->isInvariant();
268263 AAMDNodes AAInfo = LD->getAAInfo();
269264
270265 assert(NVT.isByteSized() && "Expanded type not byte sized!");
271266
272 Lo = DAG.getLoad(NVT, dl, Chain, Ptr, LD->getPointerInfo(),
273 isVolatile, isNonTemporal, isInvariant, Alignment,
274 AAInfo);
267 Lo = DAG.getLoad(NVT, dl, Chain, Ptr, LD->getPointerInfo(), Alignment,
268 LD->getMemOperand()->getFlags(), AAInfo);
275269
276270 // Increment the pointer to the other half.
277271 unsigned IncrementSize = NVT.getSizeInBits() / 8;
279273 DAG.getConstant(IncrementSize, dl, Ptr.getValueType()));
280274 Hi = DAG.getLoad(NVT, dl, Chain, Ptr,
281275 LD->getPointerInfo().getWithOffset(IncrementSize),
282 isVolatile, isNonTemporal, isInvariant,
283 MinAlign(Alignment, IncrementSize), AAInfo);
276 MinAlign(Alignment, IncrementSize),
277 LD->getMemOperand()->getFlags(), AAInfo);
284278
285279 // Build a factor node to remember that this load is independent of the
286280 // other one.
477471 SDValue Chain = St->getChain();
478472 SDValue Ptr = St->getBasePtr();
479473 unsigned Alignment = St->getAlignment();
480 bool isVolatile = St->isVolatile();
481 bool isNonTemporal = St->isNonTemporal();
482474 AAMDNodes AAInfo = St->getAAInfo();
483475
484476 assert(NVT.isByteSized() && "Expanded type not byte sized!");
490482 if (TLI.hasBigEndianPartOrdering(ValueVT, DAG.getDataLayout()))
491483 std::swap(Lo, Hi);
492484
493 Lo = DAG.getStore(Chain, dl, Lo, Ptr, St->getPointerInfo(),
494 isVolatile, isNonTemporal, Alignment, AAInfo);
485 Lo = DAG.getStore(Chain, dl, Lo, Ptr, St->getPointerInfo(), Alignment,
486 St->getMemOperand()->getFlags(), AAInfo);
495487
496488 Ptr = DAG.getNode(ISD::ADD, dl, Ptr.getValueType(), Ptr,
497489 DAG.getConstant(IncrementSize, dl, Ptr.getValueType()));
498490 Hi = DAG.getStore(Chain, dl, Hi, Ptr,
499491 St->getPointerInfo().getWithOffset(IncrementSize),
500 isVolatile, isNonTemporal,
501 MinAlign(Alignment, IncrementSize), AAInfo);
492 MinAlign(Alignment, IncrementSize),
493 St->getMemOperand()->getFlags(), AAInfo);
502494
503495 return DAG.getNode(ISD::TokenFactor, dl, MVT::Other, Lo, Hi);
504496 }
534534 unsigned LoadBytes = WideBytes;
535535
536536 if (RemainingBytes >= LoadBytes) {
537 ScalarLoad = DAG.getLoad(WideVT, dl, Chain, BasePTR,
538 LD->getPointerInfo().getWithOffset(Offset),
539 LD->isVolatile(), LD->isNonTemporal(),
540 LD->isInvariant(),
541 MinAlign(LD->getAlignment(), Offset),
542 LD->getAAInfo());
537 ScalarLoad =
538 DAG.getLoad(WideVT, dl, Chain, BasePTR,
539 LD->getPointerInfo().getWithOffset(Offset),
540 MinAlign(LD->getAlignment(), Offset),
541 LD->getMemOperand()->getFlags(), LD->getAAInfo());
543542 } else {
544543 EVT LoadVT = WideVT;
545544 while (RemainingBytes < LoadBytes) {
546545 LoadBytes >>= 1; // Reduce the load size by half.
547546 LoadVT = EVT::getIntegerVT(*DAG.getContext(), LoadBytes << 3);
548547 }
549 ScalarLoad = DAG.getExtLoad(ISD::EXTLOAD, dl, WideVT, Chain, BasePTR,
550 LD->getPointerInfo().getWithOffset(Offset),
551 LoadVT, LD->isVolatile(),
552 LD->isNonTemporal(), LD->isInvariant(),
553 MinAlign(LD->getAlignment(), Offset),
554 LD->getAAInfo());
548 ScalarLoad =
549 DAG.getExtLoad(ISD::EXTLOAD, dl, WideVT, Chain, BasePTR,
550 LD->getPointerInfo().getWithOffset(Offset), LoadVT,
551 MinAlign(LD->getAlignment(), Offset),
552 LD->getMemOperand()->getFlags(), LD->getAAInfo());
555553 }
556554
557555 RemainingBytes -= LoadBytes;
658656 MemSclVT.getIntegerVT(Ctx, NextPowerOf2(ScalarSize)),
659657 StVT.getVectorNumElements());
660658
661 SDValue NewVectorStore
662 = DAG.getTruncStore(ST->getChain(), SDLoc(Op), ST->getValue(),
663 ST->getBasePtr(),
664 ST->getPointerInfo(), NewMemVT,
665 ST->isVolatile(), ST->isNonTemporal(),
666 ST->getAlignment(),
667 ST->getAAInfo());
659 SDValue NewVectorStore = DAG.getTruncStore(
660 ST->getChain(), SDLoc(Op), ST->getValue(), ST->getBasePtr(),
661 ST->getPointerInfo(), NewMemVT, ST->getAlignment(),
662 ST->getMemOperand()->getFlags(), ST->getAAInfo());
668663 ST = cast(NewVectorStore.getNode());
669664 }
670665
222222 SDValue DAGTypeLegalizer::ScalarizeVecRes_LOAD(LoadSDNode *N) {
223223 assert(N->isUnindexed() && "Indexed vector load?");
224224
225 SDValue Result = DAG.getLoad(ISD::UNINDEXED,
226 N->getExtensionType(),
227 N->getValueType(0).getVectorElementType(),
228 SDLoc(N),
229 N->getChain(), N->getBasePtr(),
230 DAG.getUNDEF(N->getBasePtr().getValueType()),
231 N->getPointerInfo(),
232 N->getMemoryVT().getVectorElementType(),
233 N->isVolatile(), N->isNonTemporal(),
234 N->isInvariant(), N->getOriginalAlignment(),
235 N->getAAInfo());
225 SDValue Result = DAG.getLoad(
226 ISD::UNINDEXED, N->getExtensionType(),
227 N->getValueType(0).getVectorElementType(), SDLoc(N), N->getChain(),
228 N->getBasePtr(), DAG.getUNDEF(N->getBasePtr().getValueType()),
229 N->getPointerInfo(), N->getMemoryVT().getVectorElementType(),
230 N->getOriginalAlignment(), N->getMemOperand()->getFlags(),
231 N->getAAInfo());
236232
237233 // Legalize the chain result - switch anything that used the old chain to
238234 // use the new one.
534530 SDLoc dl(N);
535531
536532 if (N->isTruncatingStore())
537 return DAG.getTruncStore(N->getChain(), dl,
538 GetScalarizedVector(N->getOperand(1)),
539 N->getBasePtr(), N->getPointerInfo(),
540 N->getMemoryVT().getVectorElementType(),
541 N->isVolatile(), N->isNonTemporal(),
542 N->getAlignment(), N->getAAInfo());
533 return DAG.getTruncStore(
534 N->getChain(), dl, GetScalarizedVector(N->getOperand(1)),
535 N->getBasePtr(), N->getPointerInfo(),
536 N->getMemoryVT().getVectorElementType(), N->getAlignment(),
537 N->getMemOperand()->getFlags(), N->getAAInfo());
543538
544539 return DAG.getStore(N->getChain(), dl, GetScalarizedVector(N->getOperand(1)),
545540 N->getBasePtr(), N->getPointerInfo(),
546 N->isVolatile(), N->isNonTemporal(),
547 N->getOriginalAlignment(), N->getAAInfo());
541 N->getOriginalAlignment(), N->getMemOperand()->getFlags(),
542 N->getAAInfo());
548543 }
549544
550545 /// If the value to round is a vector that needs to be scalarized, it must be
872867
873868 // Spill the vector to the stack.
874869 SDValue StackPtr = DAG.CreateStackTemporary(VecVT);
875 SDValue Store = DAG.getStore(DAG.getEntryNode(), dl, Vec, StackPtr,
876 MachinePointerInfo(), false, false, 0);
870 SDValue Store =
871 DAG.getStore(DAG.getEntryNode(), dl, Vec, StackPtr, MachinePointerInfo());
877872
878873 // Store the new subvector into the specified index.
879874 SDValue SubVecPtr = GetVectorElementPointer(StackPtr, VecElemVT, Idx);
880875 Type *VecType = VecVT.getTypeForEVT(*DAG.getContext());
881876 unsigned Alignment = DAG.getDataLayout().getPrefTypeAlignment(VecType);
882 Store = DAG.getStore(Store, dl, SubVec, SubVecPtr, MachinePointerInfo(),
883 false, false, 0);
877 Store = DAG.getStore(Store, dl, SubVec, SubVecPtr, MachinePointerInfo());
884878
885879 // Load the Lo part from the stack slot.
886 Lo = DAG.getLoad(Lo.getValueType(), dl, Store, StackPtr, MachinePointerInfo(),
887 false, false, false, 0);
880 Lo =
881 DAG.getLoad(Lo.getValueType(), dl, Store, StackPtr, MachinePointerInfo());
888882
889883 // Increment the pointer to the other part.
890884 unsigned IncrementSize = Lo.getValueType().getSizeInBits() / 8;
894888
895889 // Load the Hi part from the stack slot.
896890 Hi = DAG.getLoad(Hi.getValueType(), dl, Store, StackPtr, MachinePointerInfo(),
897 false, false, false, MinAlign(Alignment, IncrementSize));
891 MinAlign(Alignment, IncrementSize));
898892 }
899893
900894 void DAGTypeLegalizer::SplitVecRes_FPOWI(SDNode *N, SDValue &Lo,
1003997 EVT VecVT = Vec.getValueType();
1004998 EVT EltVT = VecVT.getVectorElementType();
1005999 SDValue StackPtr = DAG.CreateStackTemporary(VecVT);
1006 SDValue Store = DAG.getStore(DAG.getEntryNode(), dl, Vec, StackPtr,
1007 MachinePointerInfo(), false, false, 0);
1000 SDValue Store =
1001 DAG.getStore(DAG.getEntryNode(), dl, Vec, StackPtr, MachinePointerInfo());
10081002
10091003 // Store the new element. This may be larger than the vector element type,
10101004 // so use a truncating store.
10111005 SDValue EltPtr = GetVectorElementPointer(StackPtr, EltVT, Idx);
10121006 Type *VecType = VecVT.getTypeForEVT(*DAG.getContext());
10131007 unsigned Alignment = DAG.getDataLayout().getPrefTypeAlignment(VecType);
1014 Store = DAG.getTruncStore(Store, dl, Elt, EltPtr, MachinePointerInfo(), EltVT,
1015 false, false, 0);
1008 Store =
1009 DAG.getTruncStore(Store, dl, Elt, EltPtr, MachinePointerInfo(), EltVT);
10161010
10171011 // Load the Lo part from the stack slot.
1018 Lo = DAG.getLoad(Lo.getValueType(), dl, Store, StackPtr, MachinePointerInfo(),
1019 false, false, false, 0);
1012 Lo =
1013 DAG.getLoad(Lo.getValueType(), dl, Store, StackPtr, MachinePointerInfo());
10201014
10211015 // Increment the pointer to the other part.
10221016 unsigned IncrementSize = Lo.getValueType().getSizeInBits() / 8;
10261020
10271021 // Load the Hi part from the stack slot.
10281022 Hi = DAG.getLoad(Hi.getValueType(), dl, Store, StackPtr, MachinePointerInfo(),
1029 false, false, false, MinAlign(Alignment, IncrementSize));
1023 MinAlign(Alignment, IncrementSize));
10301024 }
10311025
10321026 void DAGTypeLegalizer::SplitVecRes_SCALAR_TO_VECTOR(SDNode *N, SDValue &Lo,
10511045 SDValue Offset = DAG.getUNDEF(Ptr.getValueType());
10521046 EVT MemoryVT = LD->getMemoryVT();
10531047 unsigned Alignment = LD->getOriginalAlignment();
1054 bool isVolatile = LD->isVolatile();
1055 bool isNonTemporal = LD->isNonTemporal();
1056 bool isInvariant = LD->isInvariant();
1048 MachineMemOperand::Flags MMOFlags = LD->getMemOperand()->getFlags();
10571049 AAMDNodes AAInfo = LD->getAAInfo();
10581050
10591051 EVT LoMemVT, HiMemVT;
10601052 std::tie(LoMemVT, HiMemVT) = DAG.GetSplitDestVTs(MemoryVT);
10611053
10621054 Lo = DAG.getLoad(ISD::UNINDEXED, ExtType, LoVT, dl, Ch, Ptr, Offset,
1063 LD->getPointerInfo(), LoMemVT, isVolatile, isNonTemporal,
1064 isInvariant, Alignment, AAInfo);
1055 LD->getPointerInfo(), LoMemVT, Alignment, MMOFlags, AAInfo);
10651056
10661057 unsigned IncrementSize = LoMemVT.getSizeInBits()/8;
10671058 Ptr = DAG.getNode(ISD::ADD, dl, Ptr.getValueType(), Ptr,
10681059 DAG.getConstant(IncrementSize, dl, Ptr.getValueType()));
10691060 Hi = DAG.getLoad(ISD::UNINDEXED, ExtType, HiVT, dl, Ch, Ptr, Offset,
1070 LD->getPointerInfo().getWithOffset(IncrementSize),
1071 HiMemVT, isVolatile, isNonTemporal, isInvariant, Alignment,
1072 AAInfo);
1061 LD->getPointerInfo().getWithOffset(IncrementSize), HiMemVT,
1062 Alignment, MMOFlags, AAInfo);
10731063
10741064 // Build a factor node to remember that this load is independent of the
10751065 // other one.
16561646
16571647 // Store the vector to the stack.
16581648 SDValue StackPtr = DAG.CreateStackTemporary(VecVT);
1659 SDValue Store = DAG.getStore(DAG.getEntryNode(), dl, Vec, StackPtr,
1660 MachinePointerInfo(), false, false, 0);
1649 SDValue Store =
1650 DAG.getStore(DAG.getEntryNode(), dl, Vec, StackPtr, MachinePointerInfo());
16611651
16621652 // Load back the required element.
16631653 StackPtr = GetVectorElementPointer(StackPtr, EltVT, Idx);
16641654 return DAG.getExtLoad(ISD::EXTLOAD, dl, N->getValueType(0), Store, StackPtr,
1665 MachinePointerInfo(), EltVT, false, false, false, 0);
1655 MachinePointerInfo(), EltVT);
16661656 }
16671657
16681658 SDValue DAGTypeLegalizer::SplitVecOp_MGATHER(MaskedGatherSDNode *MGT,
18661856 SDValue Ptr = N->getBasePtr();
18671857 EVT MemoryVT = N->getMemoryVT();
18681858 unsigned Alignment = N->getOriginalAlignment();
1869 bool isVol = N->isVolatile();
1870 bool isNT = N->isNonTemporal();
1859 MachineMemOperand::Flags MMOFlags = N->getMemOperand()->getFlags();
18711860 AAMDNodes AAInfo = N->getAAInfo();
18721861 SDValue Lo, Hi;
18731862 GetSplitVector(N->getOperand(1), Lo, Hi);
18781867 unsigned IncrementSize = LoMemVT.getSizeInBits()/8;
18791868
18801869 if (isTruncating)
1881 Lo = DAG.getTruncStore(Ch, DL, Lo, Ptr, N->getPointerInfo(),
1882 LoMemVT, isVol, isNT, Alignment, AAInfo);
1870 Lo = DAG.getTruncStore(Ch, DL, Lo, Ptr, N->getPointerInfo(), LoMemVT,
1871 Alignment, MMOFlags, AAInfo);
18831872 else
1884 Lo = DAG.getStore(Ch, DL, Lo, Ptr, N->getPointerInfo(),
1885 isVol, isNT, Alignment, AAInfo);
1873 Lo = DAG.getStore(Ch, DL, Lo, Ptr, N->getPointerInfo(), Alignment, MMOFlags,
1874 AAInfo);
18861875
18871876 // Increment the pointer to the other half.
18881877 Ptr = DAG.getNode(ISD::ADD, DL, Ptr.getValueType(), Ptr,
18911880 if (isTruncating)
18921881 Hi = DAG.getTruncStore(Ch, DL, Hi, Ptr,
18931882 N->getPointerInfo().getWithOffset(IncrementSize),
1894 HiMemVT, isVol, isNT, Alignment, AAInfo);
1883 HiMemVT, Alignment, MMOFlags, AAInfo);
18951884 else
18961885 Hi = DAG.getStore(Ch, DL, Hi, Ptr,
18971886 N->getPointerInfo().getWithOffset(IncrementSize),
1898 isVol, isNT, Alignment, AAInfo);
1887 Alignment, MMOFlags, AAInfo);
18991888
19001889 return DAG.getNode(ISD::TokenFactor, DL, MVT::Other, Lo, Hi);
19011890 }
34973486 assert(LdVT.getVectorElementType() == WidenVT.getVectorElementType());
34983487
34993488 // Load information
3500 SDValue Chain = LD->getChain();
3501 SDValue BasePtr = LD->getBasePtr();
3502 unsigned Align = LD->getAlignment();
3503 bool isVolatile = LD->isVolatile();
3504 bool isNonTemporal = LD->isNonTemporal();
3505 bool isInvariant = LD->isInvariant();
3489 SDValue Chain = LD->getChain();
3490 SDValue BasePtr = LD->getBasePtr();
3491 unsigned Align = LD->getAlignment();
3492 MachineMemOperand::Flags MMOFlags = LD->getMemOperand()->getFlags();
35063493 AAMDNodes AAInfo = LD->getAAInfo();
35073494
35083495 int LdWidth = LdVT.getSizeInBits();
35093496 int WidthDiff = WidenWidth - LdWidth;
3510 unsigned LdAlign = (isVolatile) ? 0 : Align; // Allow wider loads.
3497 unsigned LdAlign = LD->isVolatile() ? 0 : Align; // Allow wider loads.
35113498
35123499 // Find the vector type that can load from.
35133500 EVT NewVT = FindMemType(DAG, TLI, LdWidth, WidenVT, LdAlign, WidthDiff);
35143501 int NewVTWidth = NewVT.getSizeInBits();
35153502 SDValue LdOp = DAG.getLoad(NewVT, dl, Chain, BasePtr, LD->getPointerInfo(),
3516 isVolatile, isNonTemporal, isInvariant, Align,
3517 AAInfo);
3503 Align, MMOFlags, AAInfo);
35183504 LdChain.push_back(LdOp.getValue(1));
35193505
35203506 // Check if we can load the element with one instruction.
35573543 NewVT = FindMemType(DAG, TLI, LdWidth, WidenVT, LdAlign, WidthDiff);
35583544 NewVTWidth = NewVT.getSizeInBits();
35593545 L = DAG.getLoad(NewVT, dl, Chain, BasePtr,
3560 LD->getPointerInfo().getWithOffset(Offset), isVolatile,
3561 isNonTemporal, isInvariant, MinAlign(Align, Increment),
3562 AAInfo);
3546 LD->getPointerInfo().getWithOffset(Offset),
3547 MinAlign(Align, Increment), MMOFlags, AAInfo);
35633548 LdChain.push_back(L.getValue(1));
35643549 if (L->getValueType(0).isVector()) {
35653550 SmallVector Loads;
35733558 }
35743559 } else {
35753560 L = DAG.getLoad(NewVT, dl, Chain, BasePtr,
3576 LD->getPointerInfo().getWithOffset(Offset), isVolatile,
3577 isNonTemporal, isInvariant, MinAlign(Align, Increment),
3578 AAInfo);
3561 LD->getPointerInfo().getWithOffset(Offset),
3562 MinAlign(Align, Increment), MMOFlags, AAInfo);
35793563 LdChain.push_back(L.getValue(1));
35803564 }
35813565
36503634 assert(LdVT.isVector() && WidenVT.isVector());
36513635
36523636 // Load information
3653 SDValue Chain = LD->getChain();
3654 SDValue BasePtr = LD->getBasePtr();
3655 unsigned Align = LD->getAlignment();
3656 bool isVolatile = LD->isVolatile();
3657 bool isNonTemporal = LD->isNonTemporal();
3658 bool isInvariant = LD->isInvariant();
3637 SDValue Chain = LD->getChain();
3638 SDValue BasePtr = LD->getBasePtr();
3639 unsigned Align = LD->getAlignment();
3640 MachineMemOperand::Flags MMOFlags = LD->getMemOperand()->getFlags();
36593641 AAMDNodes AAInfo = LD->getAAInfo();
36603642
36613643 EVT EltVT = WidenVT.getVectorElementType();
36663648 unsigned WidenNumElts = WidenVT.getVectorNumElements();
36673649 SmallVector Ops(WidenNumElts);
36683650 unsigned Increment = LdEltVT.getSizeInBits() / 8;
3669 Ops[0] = DAG.getExtLoad(ExtType, dl, EltVT, Chain, BasePtr,
3670 LD->getPointerInfo(),
3671 LdEltVT, isVolatile, isNonTemporal, isInvariant,
3672 Align, AAInfo);
3651 Ops[0] =
3652 DAG.getExtLoad(ExtType, dl, EltVT, Chain, BasePtr, LD->getPointerInfo(),
3653 LdEltVT, Align, MMOFlags, AAInfo);
36733654 LdChain.push_back(Ops[0].getValue(1));
36743655 unsigned i = 0, Offset = Increment;
36753656 for (i=1; i < NumElts; ++i, Offset += Increment) {
36793660 BasePtr.getValueType()));
36803661 Ops[i] = DAG.getExtLoad(ExtType, dl, EltVT, Chain, NewBasePtr,
36813662 LD->getPointerInfo().getWithOffset(Offset), LdEltVT,
3682 isVolatile, isNonTemporal, isInvariant, Align,
3683 AAInfo);
3663 Align, MMOFlags, AAInfo);
36843664 LdChain.push_back(Ops[i].getValue(1));
36853665 }
36863666
37013681 SDValue Chain = ST->getChain();
37023682 SDValue BasePtr = ST->getBasePtr();
37033683 unsigned Align = ST->getAlignment();
3704 bool isVolatile = ST->isVolatile();
3705 bool isNonTemporal = ST->isNonTemporal();
3684 MachineMemOperand::Flags MMOFlags = ST->getMemOperand()->getFlags();
37063685 AAMDNodes AAInfo = ST->getAAInfo();
37073686 SDValue ValOp = GetWidenedVector(ST->getValue());
37083687 SDLoc dl(ST);
37283707 SDValue EOp = DAG.getNode(
37293708 ISD::EXTRACT_SUBVECTOR, dl, NewVT, ValOp,
37303709 DAG.getConstant(Idx, dl, TLI.getVectorIdxTy(DAG.getDataLayout())));
3731 StChain.push_back(DAG.getStore(Chain, dl, EOp, BasePtr,
3732 ST->getPointerInfo().getWithOffset(Offset),
3733 isVolatile, isNonTemporal,
3734 MinAlign(Align, Offset), AAInfo));
3710 StChain.push_back(DAG.getStore(
3711 Chain, dl, EOp, BasePtr, ST->getPointerInfo().getWithOffset(Offset),
3712 MinAlign(Align, Offset), MMOFlags, AAInfo));
37353713 StWidth -= NewVTWidth;
37363714 Offset += Increment;
37373715 Idx += NumVTElts;
37513729 ISD::EXTRACT_VECTOR_ELT, dl, NewVT, VecOp,
37523730 DAG.getConstant(Idx++, dl,
37533731 TLI.getVectorIdxTy(DAG.getDataLayout())));
3754 StChain.push_back(DAG.getStore(Chain, dl, EOp, BasePtr,
3755 ST->getPointerInfo().getWithOffset(Offset),
3756 isVolatile, isNonTemporal,
3757 MinAlign(Align, Offset), AAInfo));
3732 StChain.push_back(DAG.getStore(
3733 Chain, dl, EOp, BasePtr, ST->getPointerInfo().getWithOffset(Offset),
3734 MinAlign(Align, Offset), MMOFlags, AAInfo));
37583735 StWidth -= NewVTWidth;
37593736 Offset += Increment;
37603737 BasePtr = DAG.getNode(ISD::ADD, dl, BasePtr.getValueType(), BasePtr,
37723749 StoreSDNode *ST) {
37733750 // For extension loads, it may not be more efficient to truncate the vector
37743751 // and then store it. Instead, we extract each element and then store it.
3775 SDValue Chain = ST->getChain();
3776 SDValue BasePtr = ST->getBasePtr();
3752 SDValue Chain = ST->getChain();
3753 SDValue BasePtr = ST->getBasePtr();
37773754 unsigned Align = ST->getAlignment();
3778 bool isVolatile = ST->isVolatile();
3779 bool isNonTemporal = ST->isNonTemporal();
3755 MachineMemOperand::Flags MMOFlags = ST->getMemOperand()->getFlags();
37803756 AAMDNodes AAInfo = ST->getAAInfo();
3781 SDValue ValOp = GetWidenedVector(ST->getValue());
3757 SDValue ValOp = GetWidenedVector(ST->getValue());
37823758 SDLoc dl(ST);
37833759
37843760 EVT StVT = ST->getMemoryVT();
37993775 ISD::EXTRACT_VECTOR_ELT, dl, ValEltVT, ValOp,
38003776 DAG.getConstant(0, dl, TLI.getVectorIdxTy(DAG.getDataLayout())));
38013777 StChain.push_back(DAG.getTruncStore(Chain, dl, EOp, BasePtr,
3802 ST->getPointerInfo(), StEltVT,
3803 isVolatile, isNonTemporal, Align,
3804 AAInfo));
3778 ST->getPointerInfo(), StEltVT, Align,
3779 MMOFlags, AAInfo));
38053780 unsigned Offset = Increment;
38063781 for (unsigned i=1; i < NumElts; ++i, Offset += Increment) {
38073782 SDValue NewBasePtr = DAG.getNode(ISD::ADD, dl, BasePtr.getValueType(),
38113786 SDValue EOp = DAG.getNode(
38123787 ISD::EXTRACT_VECTOR_ELT, dl, ValEltVT, ValOp,
38133788 DAG.getConstant(0, dl, TLI.getVectorIdxTy(DAG.getDataLayout())));
3814 StChain.push_back(DAG.getTruncStore(Chain, dl, EOp, NewBasePtr,
3815 ST->getPointerInfo().getWithOffset(Offset),
3816 StEltVT, isVolatile, isNonTemporal,
3817 MinAlign(Align, Offset), AAInfo));
3789 StChain.push_back(DAG.getTruncStore(
3790 Chain, dl, EOp, NewBasePtr, ST->getPointerInfo().getWithOffset(Offset),
3791 StEltVT, MinAlign(Align, Offset), MMOFlags, AAInfo));
38183792 }
38193793 }
38203794
18211821 SDValue Tmp2 = Node->getOperand(1);
18221822 unsigned Align = Node->getConstantOperandVal(3);
18231823
1824 SDValue VAListLoad =
1825 getLoad(TLI.getPointerTy(getDataLayout()), dl, Tmp1, Tmp2,
1826 MachinePointerInfo(V), false, false, false, 0);
1824 SDValue VAListLoad = getLoad(TLI.getPointerTy(getDataLayout()), dl, Tmp1,
1825 Tmp2, MachinePointerInfo(V));
18271826 SDValue VAList = VAListLoad;
18281827
18291828 if (Align > TLI.getMinStackArgumentAlignment()) {
18421841 VT.getTypeForEVT(*getContext())),
18431842 dl, VAList.getValueType()));
18441843 // Store the incremented VAList to the legalized pointer
1845 Tmp1 = getStore(VAListLoad.getValue(1), dl, Tmp1, Tmp2,
1846 MachinePointerInfo(V), false, false, 0);
1844 Tmp1 =
1845 getStore(VAListLoad.getValue(1), dl, Tmp1, Tmp2, MachinePointerInfo(V));
18471846 // Load the actual argument out of the pointer VAList
1848 return getLoad(VT, dl, Tmp1, VAList, MachinePointerInfo(),
1849 false, false, false, 0);
1847 return getLoad(VT, dl, Tmp1, VAList, MachinePointerInfo());
18501848 }
18511849
18521850 SDValue SelectionDAG::expandVACopy(SDNode *Node) {
18561854 // output, returning the chain.
18571855 const Value *VD = cast(Node->getOperand(3))->getValue();
18581856 const Value *VS = cast(Node->getOperand(4))->getValue();
1859 SDValue Tmp1 = getLoad(TLI.getPointerTy(getDataLayout()), dl,
1860 Node->getOperand(0), Node->getOperand(2),
1861 MachinePointerInfo(VS), false, false, false, 0);
1857 SDValue Tmp1 =
1858 getLoad(TLI.getPointerTy(getDataLayout()), dl, Node->getOperand(0),
1859 Node->getOperand(2), MachinePointerInfo(VS));
18621860 return getStore(Tmp1.getValue(1), dl, Tmp1, Node->getOperand(1),
1863 MachinePointerInfo(VD), false, false, 0);
1861 MachinePointerInfo(VD));
18641862 }
18651863
18661864 SDValue SelectionDAG::CreateStackTemporary(EVT VT, unsigned minAlign) {
43494347 }
43504348 }
43514349
4350 MachineMemOperand::Flags MMOFlags =
4351 isVol ? MachineMemOperand::MOVolatile : MachineMemOperand::MONone;
43524352 SmallVector OutChains;
43534353 unsigned NumMemOps = MemOps.size();
43544354 uint64_t SrcOff = 0, DstOff = 0;
43764376 if (Value.getNode())
43774377 Store = DAG.getStore(Chain, dl, Value,
43784378 DAG.getMemBasePlusOffset(Dst, DstOff, dl),
4379 DstPtrInfo.getWithOffset(DstOff), isVol,
4380 false, Align);
4379 DstPtrInfo.getWithOffset(DstOff), Align, MMOFlags);
43814380 }
43824381
43834382 if (!Store.getNode()) {
43904389 assert(NVT.bitsGE(VT));
43914390 Value = DAG.getExtLoad(ISD::EXTLOAD, dl, NVT, Chain,
43924391 DAG.getMemBasePlusOffset(Src, SrcOff, dl),
4393 SrcPtrInfo.getWithOffset(SrcOff), VT, isVol, false,
4394 false, MinAlign(SrcAlign, SrcOff));
4392 SrcPtrInfo.getWithOffset(SrcOff), VT,
4393 MinAlign(SrcAlign, SrcOff), MMOFlags);
43954394 OutChains.push_back(Value.getValue(1));
4396 Store = DAG.getTruncStore(Chain, dl, Value,
4397 DAG.getMemBasePlusOffset(Dst, DstOff, dl),
4398 DstPtrInfo.getWithOffset(DstOff), VT, isVol,
4399 false, Align);
4395 Store = DAG.getTruncStore(
4396 Chain, dl, Value, DAG.getMemBasePlusOffset(Dst, DstOff, dl),
4397 DstPtrInfo.getWithOffset(DstOff), VT, Align, MMOFlags);
44004398 }
44014399 OutChains.push_back(Store);
44024400 SrcOff += VTSize;
44524450 }
44534451 }
44544452
4453 MachineMemOperand::Flags MMOFlags =
4454 isVol ? MachineMemOperand::MOVolatile : MachineMemOperand::MONone;
44554455 uint64_t SrcOff = 0, DstOff = 0;
44564456 SmallVector LoadValues;
44574457 SmallVector LoadChains;
44624462 unsigned VTSize = VT.getSizeInBits() / 8;
44634463 SDValue Value;
44644464
4465 Value = DAG.getLoad(VT, dl, Chain,
4466 DAG.getMemBasePlusOffset(Src, SrcOff, dl),
4467 SrcPtrInfo.getWithOffset(SrcOff), isVol,
4468 false, false, SrcAlign);
4465 Value =
4466 DAG.getLoad(VT, dl, Chain, DAG.getMemBasePlusOffset(Src, SrcOff, dl),
4467 SrcPtrInfo.getWithOffset(SrcOff), SrcAlign, MMOFlags);
44694468 LoadValues.push_back(Value);
44704469 LoadChains.push_back(Value.getValue(1));
44714470 SrcOff += VTSize;
44794478
44804479 Store = DAG.getStore(Chain, dl, LoadValues[i],
44814480 DAG.getMemBasePlusOffset(Dst, DstOff, dl),
4482 DstPtrInfo.getWithOffset(DstOff), isVol, false, Align);
4481 DstPtrInfo.getWithOffset(DstOff), Align, MMOFlags);
44834482 OutChains.push_back(Store);
44844483 DstOff += VTSize;
44854484 }
45764575 Value = getMemsetValue(Src, VT, DAG, dl);
45774576 }
45784577 assert(Value.getValueType() == VT && "Value with wrong type.");
4579 SDValue Store = DAG.getStore(Chain, dl, Value,
4580 DAG.getMemBasePlusOffset(Dst, DstOff, dl),
4581 DstPtrInfo.getWithOffset(DstOff),
4582 isVol, false, Align);
4578 SDValue Store = DAG.getStore(
4579 Chain, dl, Value, DAG.getMemBasePlusOffset(Dst, DstOff, dl),
4580 DstPtrInfo.getWithOffset(DstOff), Align,
4581 isVol ? MachineMemOperand::MOVolatile : MachineMemOperand::MONone);
45834582 OutChains.push_back(Store);
45844583 DstOff += VT.getSizeInBits() / 8;
45854584 Size -= VTSize;
50505049 EVT VT, const SDLoc &dl, SDValue Chain,
50515050 SDValue Ptr, SDValue Offset,
50525051 MachinePointerInfo PtrInfo, EVT MemVT,
5053 bool isVolatile, bool isNonTemporal,
5054 bool isInvariant, unsigned Alignment,
5052 unsigned Alignment,
5053 MachineMemOperand::Flags MMOFlags,
50555054 const AAMDNodes &AAInfo, const MDNode *Ranges) {
50565055 assert(Chain.getValueType() == MVT::Other &&
50575056 "Invalid chain type");
50585057 if (Alignment == 0) // Ensure that codegen never sees alignment 0
50595058 Alignment = getEVTAlignment(VT);
50605059
5061 auto Flags = MachineMemOperand::MOLoad;
5062 if (isVolatile)
5063 Flags |= MachineMemOperand::MOVolatile;
5064 if (isNonTemporal)
5065 Flags |= MachineMemOperand::MONonTemporal;
5066 if (isInvariant)
5067 Flags |= MachineMemOperand::MOInvariant;
5068
5060 MMOFlags |= MachineMemOperand::MOLoad;
5061 assert((MMOFlags & MachineMemOperand::MOStore) == 0);
50695062 // If we don't have a PtrInfo, infer the trivial frame index case to simplify
50705063 // clients.
50715064 if (PtrInfo.V.isNull())
50725065 PtrInfo = InferPointerInfo(*this, Ptr, Offset);
50735066
50745067 MachineFunction &MF = getMachineFunction();
5075 MachineMemOperand *MMO =
5076 MF.getMachineMemOperand(PtrInfo, Flags, MemVT.getStoreSize(), Alignment,
5077 AAInfo, Ranges);
5068 MachineMemOperand *MMO = MF.getMachineMemOperand(
5069 PtrInfo, MMOFlags, MemVT.getStoreSize(), Alignment, AAInfo, Ranges);
50785070 return getLoad(AM, ExtType, VT, dl, Chain, Ptr, Offset, MemVT, MMO);
50795071 }
50805072
51285120
51295121 SDValue SelectionDAG::getLoad(EVT VT, const SDLoc &dl, SDValue Chain,
51305122 SDValue Ptr, MachinePointerInfo PtrInfo,
5131 bool isVolatile, bool isNonTemporal,
5132 bool isInvariant, unsigned Alignment,
5123 unsigned Alignment,
5124 MachineMemOperand::Flags MMOFlags,
51335125 const AAMDNodes &AAInfo, const MDNode *Ranges) {
51345126 SDValue Undef = getUNDEF(Ptr.getValueType());
51355127 return getLoad(ISD::UNINDEXED, ISD::NON_EXTLOAD, VT, dl, Chain, Ptr, Undef,
5136 PtrInfo, VT, isVolatile, isNonTemporal, isInvariant, Alignment,
5137 AAInfo, Ranges);
5128 PtrInfo, VT, Alignment, MMOFlags, AAInfo, Ranges);
51385129 }
51395130
51405131 SDValue SelectionDAG::getLoad(EVT VT, const SDLoc &dl, SDValue Chain,
51475138 SDValue SelectionDAG::getExtLoad(ISD::LoadExtType ExtType, const SDLoc &dl,
51485139 EVT VT, SDValue Chain, SDValue Ptr,
51495140 MachinePointerInfo PtrInfo, EVT MemVT,
5150 bool isVolatile, bool isNonTemporal,
5151 bool isInvariant, unsigned Alignment,
5141 unsigned Alignment,
5142 MachineMemOperand::Flags MMOFlags,
51525143 const AAMDNodes &AAInfo) {
51535144 SDValue Undef = getUNDEF(Ptr.getValueType());
5154 return getLoad(ISD::UNINDEXED, ExtType, VT, dl, Chain, Ptr, Undef,
5155 PtrInfo, MemVT, isVolatile, isNonTemporal, isInvariant,
5156 Alignment, AAInfo);
5145 return getLoad(ISD::UNINDEXED, ExtType, VT, dl, Chain, Ptr, Undef, PtrInfo,
5146 MemVT, Alignment, MMOFlags, AAInfo);
51575147 }
51585148
51595149 SDValue SelectionDAG::getExtLoad(ISD::LoadExtType ExtType, const SDLoc &dl,
51695159 ISD::MemIndexedMode AM) {
51705160 LoadSDNode *LD = cast(OrigLoad);
51715161 assert(LD->getOffset().isUndef() && "Load is already a indexed load!");
5162 // Don't propagate the invariant flag.
5163 auto MMOFlags =
5164 LD->getMemOperand()->getFlags() & ~MachineMemOperand::MOInvariant;
51725165 return getLoad(AM, LD->getExtensionType(), OrigLoad.getValueType(), dl,
51735166 LD->getChain(), Base, Offset, LD->getPointerInfo(),
5174 LD->getMemoryVT(), LD->isVolatile(), LD->isNonTemporal(),
5175 false, LD->getAlignment());
5167 LD->getMemoryVT(), LD->getAlignment(), MMOFlags);
51765168 }
51775169
51785170 SDValue SelectionDAG::getStore(SDValue Chain, const SDLoc &dl, SDValue Val,
51795171 SDValue Ptr, MachinePointerInfo PtrInfo,
5180 bool isVolatile, bool isNonTemporal,
5181 unsigned Alignment, const AAMDNodes &AAInfo) {
5172 unsigned Alignment,
5173 MachineMemOperand::Flags MMOFlags,
5174 const AAMDNodes &AAInfo) {
51825175 assert(Chain.getValueType() == MVT::Other && "Invalid chain type");
51835176 if (Alignment == 0) // Ensure that codegen never sees alignment 0
51845177 Alignment = getEVTAlignment(Val.getValueType());
51855178
5186 auto Flags = MachineMemOperand::MOStore;
5187 if (isVolatile)
5188 Flags |= MachineMemOperand::MOVolatile;
5189 if (isNonTemporal)
5190 Flags |= MachineMemOperand::MONonTemporal;
5179 MMOFlags |= MachineMemOperand::MOStore;
5180 assert((MMOFlags & MachineMemOperand::MOLoad) == 0);
51915181
51925182 if (PtrInfo.V.isNull())
51935183 PtrInfo = InferPointerInfo(*this, Ptr);
51945184
51955185 MachineFunction &MF = getMachineFunction();
5196 MachineMemOperand *MMO =
5197 MF.getMachineMemOperand(PtrInfo, Flags,
5198 Val.getValueType().getStoreSize(), Alignment,
5199 AAInfo);
5200
5186 MachineMemOperand *MMO = MF.getMachineMemOperand(
5187 PtrInfo, MMOFlags, Val.getValueType().getStoreSize(), Alignment, AAInfo);
52015188 return getStore(Chain, dl, Val, Ptr, MMO);
52025189 }
52035190
52315218
52325219 SDValue SelectionDAG::getTruncStore(SDValue Chain, const SDLoc &dl, SDValue Val,
52335220 SDValue Ptr, MachinePointerInfo PtrInfo,
5234 EVT SVT, bool isVolatile,
5235 bool isNonTemporal, unsigned Alignment,
5221 EVT SVT, unsigned Alignment,
5222 MachineMemOperand::Flags MMOFlags,
52365223 const AAMDNodes &AAInfo) {
52375224 assert(Chain.getValueType() == MVT::Other &&
52385225 "Invalid chain type");
52395226 if (Alignment == 0) // Ensure that codegen never sees alignment 0
52405227 Alignment = getEVTAlignment(SVT);
52415228
5242 auto Flags = MachineMemOperand::MOStore;
5243 if (isVolatile)
5244 Flags |= MachineMemOperand::MOVolatile;
5245 if (isNonTemporal)
5246 Flags |= MachineMemOperand::MONonTemporal;
5229 MMOFlags |= MachineMemOperand::MOStore;
5230 assert((MMOFlags & MachineMemOperand::MOLoad) == 0);
52475231
52485232 if (PtrInfo.V.isNull())
52495233 PtrInfo = InferPointerInfo(*this, Ptr);
52505234
52515235 MachineFunction &MF = getMachineFunction();
5252 MachineMemOperand *MMO =
5253 MF.getMachineMemOperand(PtrInfo, Flags, SVT.getStoreSize(), Alignment,
5254 AAInfo);
5255
5236 MachineMemOperand *MMO = MF.getMachineMemOperand(
5237 PtrInfo, MMOFlags, SVT.getStoreSize(), Alignment, AAInfo);
52565238 return getTruncStore(Chain, dl, Val, Ptr, SVT, MMO);
52575239 }
52585240
14221422 DAG.getIntPtrConstant(Offsets[i],
14231423 getCurSDLoc()),
14241424 &Flags);
1425 Chains[i] =
1426 DAG.getStore(Chain, getCurSDLoc(),
1427 SDValue(RetOp.getNode(), RetOp.getResNo() + i),
1428 // FIXME: better loc info would be nice.
1429 Add, MachinePointerInfo(), false, false, 0);
1425 Chains[i] = DAG.getStore(Chain, getCurSDLoc(),
1426 SDValue(RetOp.getNode(), RetOp.getResNo() + i),
1427 // FIXME: better loc info would be nice.
1428 Add, MachinePointerInfo());
14301429 }
14311430
14321431 Chain = DAG.getNode(ISD::TokenFactor, getCurSDLoc(),
20452044 // Generate code to load the content of the guard slot.
20462045 SDValue StackSlot = DAG.getLoad(
20472046 PtrTy, dl, DAG.getEntryNode(), StackSlotPtr,
2048 MachinePointerInfo::getFixedStack(DAG.getMachineFunction(), FI), true,
2049 false, false, Align);
2047 MachinePointerInfo::getFixedStack(DAG.getMachineFunction(), FI), Align,
2048 MachineMemOperand::MOVolatile);
20502049
20512050 // Retrieve guard check function, nullptr if instrumentation is inlined.
20522051 if (const Value *GuardCheck = TLI.getSSPStackGuardCheck(M)) {
20872086
20882087 Guard =
20892088 DAG.getLoad(PtrTy, dl, Chain, GuardPtr, MachinePointerInfo(IRGuard, 0),
2090 true, false, false, Align);
2089 Align, MachineMemOperand::MOVolatile);
20912090 }
20922091
20932092 // Perform the comparison via a subtract/getsetcc.
35333532 PtrVT, Ptr,
35343533 DAG.getConstant(Offsets[i], dl, PtrVT),
35353534 &Flags);
3536 SDValue L = DAG.getLoad(ValueVTs[i], dl, Root,
3537 A, MachinePointerInfo(SV, Offsets[i]), isVolatile,
3538 isNonTemporal, isInvariant, Alignment, AAInfo,
3539 Ranges);
3535 auto MMOFlags = MachineMemOperand::MONone;
3536 if (isVolatile)
3537 MMOFlags |= MachineMemOperand::MOVolatile;
3538 if (isNonTemporal)
3539 MMOFlags |= MachineMemOperand::MONonTemporal;
3540 if (isInvariant)
3541 MMOFlags |= MachineMemOperand::MOInvariant;
3542
3543 SDValue L = DAG.getLoad(ValueVTs[i], dl, Root, A,
3544 MachinePointerInfo(SV, Offsets[i]), Alignment,
3545 MMOFlags, AAInfo, Ranges);
35403546
35413547 Values[i] = L;
35423548 Chains[ChainI] = L.getValue(1);
36513657
36523658 SDValue Root = getRoot();
36533659 SmallVector Chains(std::min(MaxParallelChains, NumValues));
3660 SDLoc dl = getCurSDLoc();
36543661 EVT PtrVT = Ptr.getValueType();
3655 bool isVolatile = I.isVolatile();
3656 bool isNonTemporal = I.getMetadata(LLVMContext::MD_nontemporal) != nullptr;
36573662 unsigned Alignment = I.getAlignment();
3658 SDLoc dl = getCurSDLoc();
3659
36603663 AAMDNodes AAInfo;
36613664 I.getAAMetadata(AAInfo);
3665
3666 auto MMOFlags = MachineMemOperand::MONone;
3667 if (I.isVolatile())
3668 MMOFlags |= MachineMemOperand::MOVolatile;
3669 if (I.getMetadata(LLVMContext::MD_nontemporal) != nullptr)
3670 MMOFlags |= MachineMemOperand::MONonTemporal;
36623671
36633672 // An aggregate load cannot wrap around the address space, so offsets to its
36643673 // parts don't wrap either.
36763685 }
36773686 SDValue Add = DAG.getNode(ISD::ADD, dl, PtrVT, Ptr,
36783687 DAG.getConstant(Offsets[i], dl, PtrVT), &Flags);
3679 SDValue St = DAG.getStore(Root, dl,
3680 SDValue(Src.getNode(), Src.getResNo() + i),
3681 Add, MachinePointerInfo(PtrV, Offsets[i]),
3682 isVolatile, isNonTemporal, Alignment, AAInfo);
3688 SDValue St = DAG.getStore(
3689 Root, dl, SDValue(Src.getNode(), Src.getResNo() + i), Add,
3690 MachinePointerInfo(PtrV, Offsets[i]), Alignment, MMOFlags, AAInfo);
36833691 Chains[ChainI] = St;
36843692 }
36853693
53575365 } else {
53585366 const Value *Global = TLI.getSDagStackGuard(M);
53595367 unsigned Align = DL->getPrefTypeAlignment(Global->getType());
5360 Res =
5361 DAG.getLoad(PtrTy, sdl, Chain, getValue(Global),
5362 MachinePointerInfo(Global, 0), true, false, false, Align);
5368 Res = DAG.getLoad(PtrTy, sdl, Chain, getValue(Global),
5369 MachinePointerInfo(Global, 0), Align,
5370 MachineMemOperand::MOVolatile);
53635371 }
53645372 DAG.setRoot(Chain);
53655373 setValue(&I, Res);
53875395 // Store the stack protector onto the stack.
53885396 Res = DAG.getStore(Chain, sdl, Src, FIN, MachinePointerInfo::getFixedStack(
53895397 DAG.getMachineFunction(), FI),
5390 true, false, 0);
5398 /* Alignment = */ 0, MachineMemOperand::MOVolatile);
53915399 setValue(&I, Res);
53925400 DAG.setRoot(Res);
53935401 return nullptr;
58805888 SDValue Ptr = Builder.getValue(PtrVal);
58815889 SDValue LoadVal = Builder.DAG.getLoad(LoadVT, Builder.getCurSDLoc(), Root,
58825890 Ptr, MachinePointerInfo(PtrVal),
5883 false /*volatile*/,
5884 false /*nontemporal*/,
5885 false /*isinvariant*/, 1 /* align=1 */);
5891 /* Alignment = */ 1);
58865892
58875893 if (!ConstantMemory)
58885894 Builder.PendingLoads.push_back(LoadVal.getValue(1));
67216727 DAG.getFrameIndex(SSFI, TLI.getPointerTy(DAG.getDataLayout()));
67226728 Chain = DAG.getStore(
67236729 Chain, getCurSDLoc(), OpInfo.CallOperand, StackSlot,
6724 MachinePointerInfo::getFixedStack(DAG.getMachineFunction(), SSFI),
6725 false, false, 0);
6730 MachinePointerInfo::getFixedStack(DAG.getMachineFunction(), SSFI));
67266731 OpInfo.CallOperand = StackSlot;
67276732 }
67286733
70817086 // Emit the non-flagged stores from the physregs.
70827087 SmallVector OutChains;
70837088 for (unsigned i = 0, e = StoresToEmit.size(); i != e; ++i) {
7084 SDValue Val = DAG.getStore(Chain, getCurSDLoc(),
7085 StoresToEmit[i].first,
7089 SDValue Val = DAG.getStore(Chain, getCurSDLoc(), StoresToEmit[i].first,
70867090 getValue(StoresToEmit[i].second),
7087 MachinePointerInfo(StoresToEmit[i].second),
7088 false, false, 0);
7091 MachinePointerInfo(StoresToEmit[i].second));
70897092 OutChains.push_back(Val);
70907093 }
70917094
77377740 RetTys[i], CLI.DL, CLI.Chain, Add,
77387741 MachinePointerInfo::getFixedStack(CLI.DAG.getMachineFunction(),
77397742 DemoteStackIdx, Offsets[i]),
7740 false, false, false, 1);
7743 /* Alignment = */ 1);
77417744 ReturnValues[i] = L;
77427745 Chains[i] = L.getValue(1);
77437746 }
357357
358358 Chain = Builder.DAG.getStore(Chain, Builder.getCurSDLoc(), Incoming, Loc,
359359 MachinePointerInfo::getFixedStack(
360 Builder.DAG.getMachineFunction(), Index),
361 false, false, 0);
360 Builder.DAG.getMachineFunction(), Index));
362361
363362 Builder.StatepointLowering.setLocation(Incoming, Loc);
364363 }
926925 SDValue SpillLoad =
927926 DAG.getLoad(SpillSlot.getValueType(), getCurSDLoc(), Chain, SpillSlot,
928927 MachinePointerInfo::getFixedStack(DAG.getMachineFunction(),
929 *DerivedPtrLocation),
930 false, false, false, 0);
928 *DerivedPtrLocation));
931929
932930 // Again, be conservative, don't emit pending loads
933931 DAG.setRoot(SpillLoad.getValue(1));
15521552 Ptr = DAG.getNode(ISD::ADD, dl, PtrType, Lod->getBasePtr(),
15531553 DAG.getConstant(bestOffset, dl, PtrType));
15541554 unsigned NewAlign = MinAlign(Lod->getAlignment(), bestOffset);
1555 SDValue NewLoad = DAG.getLoad(newVT, dl, Lod->getChain(), Ptr,
1556 Lod->getPointerInfo().getWithOffset(bestOffset),
1557 false, false, false, NewAlign);
1555 SDValue NewLoad = DAG.getLoad(
1556 newVT, dl, Lod->getChain(), Ptr,
1557 Lod->getPointerInfo().getWithOffset(bestOffset), NewAlign);
15581558 return DAG.getSetCC(dl, VT,
15591559 DAG.getNode(ISD::AND, dl, newVT, NewLoad,
15601560 DAG.getConstant(bestMask.trunc(bestWidth),
31653165 SmallVector LoadChains;
31663166
31673167 for (unsigned Idx = 0; Idx < NumElem; ++Idx) {
3168 SDValue ScalarLoad = DAG.getExtLoad(
3169 ExtType, SL, DstEltVT,
3170 Chain, BasePTR, LD->getPointerInfo().getWithOffset(Idx * Stride),
3171 SrcEltVT,
3172 LD->isVolatile(), LD->isNonTemporal(), LD->isInvariant(),
3173 MinAlign(LD->getAlignment(), Idx * Stride), LD->getAAInfo());
3168 SDValue ScalarLoad =
3169 DAG.getExtLoad(ExtType, SL, DstEltVT, Chain, BasePTR,
3170 LD->getPointerInfo().getWithOffset(Idx * Stride),
3171 SrcEltVT, MinAlign(LD->getAlignment(), Idx * Stride),
3172 LD->getMemOperand()->getFlags(), LD->getAAInfo());
31743173
31753174 BasePTR = DAG.getNode(ISD::ADD, SL, PtrVT, BasePTR,
31763175 DAG.getConstant(Stride, SL, PtrVT));
31973196 SDValue Value = ST->getValue();
31983197 EVT StVT = ST->getMemoryVT();
31993198
3200 unsigned Alignment = ST->getAlignment();
3201 bool isVolatile = ST->isVolatile();
3202 bool isNonTemporal = ST->isNonTemporal();
3203 AAMDNodes AAInfo = ST->getAAInfo();
3204
32053199 // The type of the data we want to save
32063200 EVT RegVT = Value.getValueType();
32073201 EVT RegSclVT = RegVT.getScalarType();
32283222
32293223 // This scalar TruncStore may be illegal, but we legalize it later.
32303224 SDValue Store = DAG.getTruncStore(
3231 Chain, SL, Elt, Ptr,
3232 ST->getPointerInfo().getWithOffset(Idx * Stride), MemSclVT,
3233 isVolatile, isNonTemporal, MinAlign(Alignment, Idx * Stride),
3234 AAInfo);
3225 Chain, SL, Elt, Ptr, ST->getPointerInfo().getWithOffset(Idx * Stride),
3226 MemSclVT, MinAlign(ST->getAlignment(), Idx * Stride),
3227 ST->getMemOperand()->getFlags(), ST->getAAInfo());
32353228
32363229 Stores.push_back(Store);
32373230 }
32923285 // Do all but one copies using the full register width.
32933286 for (unsigned i = 1; i < NumRegs; i++) {
32943287 // Load one integer register's worth from the original location.
3295 SDValue Load = DAG.getLoad(RegVT, dl, Chain, Ptr,
3296 LD->getPointerInfo().getWithOffset(Offset),
3297 LD->isVolatile(), LD->isNonTemporal(),
3298 LD->isInvariant(),
3299 MinAlign(LD->getAlignment(), Offset),
3300 LD->getAAInfo());
3288 SDValue Load = DAG.getLoad(
3289 RegVT, dl, Chain, Ptr, LD->getPointerInfo().getWithOffset(Offset),
3290 MinAlign(LD->getAlignment(), Offset), LD->getMemOperand()->getFlags(),
3291 LD->getAAInfo());
33013292 // Follow the load with a store to the stack slot. Remember the store.
33023293 Stores.push_back(DAG.getStore(Load.getValue(1), dl, Load, StackPtr,
3303 MachinePointerInfo(), false, false, 0));
3294 MachinePointerInfo()));
33043295 // Increment the pointers.
33053296 Offset += RegBytes;
33063297 Ptr = DAG.getNode(ISD::ADD, dl, PtrVT, Ptr, PtrIncrement);
33113302 // The last copy may be partial. Do an extending load.
33123303 EVT MemVT = EVT::getIntegerVT(*DAG.getContext(),
33133304 8 * (LoadedBytes - Offset));
3314 SDValue Load = DAG.getExtLoad(ISD::EXTLOAD, dl, RegVT, Chain, Ptr,
3315 LD->getPointerInfo().getWithOffset(Offset),
3316 MemVT, LD->isVolatile(),
3317 LD->isNonTemporal(),
3318 LD->isInvariant(),
3319 MinAlign(LD->getAlignment(), Offset),
3320 LD->getAAInfo());
3305 SDValue Load =
3306 DAG.getExtLoad(ISD::EXTLOAD, dl, RegVT, Chain, Ptr,
3307 LD->getPointerInfo().getWithOffset(Offset), MemVT,
3308 MinAlign(LD->getAlignment(), Offset),
3309 LD->getMemOperand()->getFlags(), LD->getAAInfo());
33213310 // Follow the load with a store to the stack slot. Remember the store.
33223311 // On big-endian machines this requires a truncating store to ensure
33233312 // that the bits end up in the right place.
33243313 Stores.push_back(DAG.getTruncStore(Load.getValue(1), dl, Load, StackPtr,
3325 MachinePointerInfo(), MemVT,
3326 false, false, 0));
3314 MachinePointerInfo(), MemVT));
33273315
33283316 // The order of the stores doesn't matter - say it with a TokenFactor.
33293317 SDValue TF = DAG.getNode(ISD::TokenFactor, dl, MVT::Other, Stores);
33303318
33313319 // Finally, perform the original load only redirected to the stack slot.
33323320 Load = DAG.getExtLoad(LD->getExtensionType(), dl, VT, TF, StackBase,
3333 MachinePointerInfo(), LoadedVT, false,false, false,
3334 0);
3321 MachinePointerInfo(), LoadedVT);
33353322
33363323 // Callers expect a MERGE_VALUES node.
33373324 return std::make_pair(Load, TF);
33593346 SDValue Lo, Hi;
33603347 if (DAG.getDataLayout().isLittleEndian()) {
33613348 Lo = DAG.getExtLoad(ISD::ZEXTLOAD, dl, VT, Chain, Ptr, LD->getPointerInfo(),
3362 NewLoadedVT, LD->isVolatile(),
3363 LD->isNonTemporal(), LD->isInvariant(), Alignment,
3349 NewLoadedVT, Alignment, LD->getMemOperand()->getFlags(),
33643350 LD->getAAInfo());
33653351 Ptr = DAG.getNode(ISD::ADD, dl, Ptr.getValueType(), Ptr,
33663352 DAG.getConstant(IncrementSize, dl, Ptr.getValueType()));
33673353 Hi = DAG.getExtLoad(HiExtType, dl, VT, Chain, Ptr,
33683354 LD->getPointerInfo().getWithOffset(IncrementSize),
3369 NewLoadedVT, LD->isVolatile(),
3370 LD->isNonTemporal(),LD->isInvariant(),
3371 MinAlign(Alignment, IncrementSize), LD->getAAInfo());
3355 NewLoadedVT, MinAlign(Alignment, IncrementSize),
3356 LD->getMemOperand()->getFlags(), LD->getAAInfo());
33723357 } else {
33733358 Hi = DAG.getExtLoad(HiExtType, dl, VT, Chain, Ptr, LD->getPointerInfo(),
3374 NewLoadedVT, LD->isVolatile(),
3375 LD->isNonTemporal(), LD->isInvariant(), Alignment,
3359 NewLoadedVT, Alignment, LD->getMemOperand()->getFlags(),
33763360 LD->getAAInfo());
33773361 Ptr = DAG.getNode(ISD::ADD, dl, Ptr.getValueType(), Ptr,
33783362 DAG.getConstant(IncrementSize, dl, Ptr.getValueType()));
33793363 Lo = DAG.getExtLoad(ISD::ZEXTLOAD, dl, VT, Chain, Ptr,
33803364 LD->getPointerInfo().getWithOffset(IncrementSize),
3381 NewLoadedVT, LD->isVolatile(),
3382 LD->isNonTemporal(), LD->isInvariant(),
3383 MinAlign(Alignment, IncrementSize), LD->getAAInfo());
3365 NewLoadedVT, MinAlign(Alignment, IncrementSize),
3366 LD->getMemOperand()->getFlags(), LD->getAAInfo());
33843367 }
33853368
33863369 // aggregate the two parts
34223405 // FIXME: Does not handle truncating floating point stores!
34233406 SDValue Result = DAG.getNode(ISD::BITCAST, dl, intVT, Val);
34243407 Result = DAG.getStore(Chain, dl, Result, Ptr, ST->getPointerInfo(),
3425 ST->isVolatile(), ST->isNonTemporal(), Alignment);
3408 Alignment, ST->getMemOperand()->getFlags());
34263409 return Result;
34273410 }
34283411 // Do a (aligned) store to a stack slot, then copy from the stack slot
34413424 SDValue StackPtr = DAG.CreateStackTemporary(StoredVT, RegVT);
34423425
34433426 // Perform the original store, only redirected to the stack slot.
3444 SDValue Store = DAG.getTruncStore(Chain, dl,
3445 Val, StackPtr, MachinePointerInfo(),
3446 StoredVT, false, false, 0);
3427 SDValue Store = DAG.getTruncStore(Chain, dl, Val, StackPtr,
3428 MachinePointerInfo(), StoredVT);
34473429
34483430 EVT StackPtrVT = StackPtr.getValueType();
34493431
34553437 // Do all but one copies using the full register width.
34563438 for (unsigned i = 1; i < NumRegs; i++) {
34573439 // Load one integer register's worth from the stack slot.
3458 SDValue Load = DAG.getLoad(RegVT, dl, Store, StackPtr,
3459 MachinePointerInfo(),
3460 false, false, false, 0);
3440 SDValue Load =
3441 DAG.getLoad(RegVT, dl, Store, StackPtr, MachinePointerInfo());
34613442 // Store it to the final location. Remember the store.
34623443 Stores.push_back(DAG.getStore(Load.getValue(1), dl, Load, Ptr,
3463 ST->getPointerInfo().getWithOffset(Offset),
3464 ST->isVolatile(), ST->isNonTemporal(),
3465 MinAlign(ST->getAlignment(), Offset)));
3444 ST->getPointerInfo().getWithOffset(Offset),
3445 MinAlign(ST->getAlignment(), Offset),
3446 ST->getMemOperand()->getFlags()));
34663447 // Increment the pointers.
34673448 Offset += RegBytes;
34683449 StackPtr = DAG.getNode(ISD::ADD, dl, StackPtrVT,
34783459
34793460 // Load from the stack slot.
34803461 SDValue Load = DAG.getExtLoad(ISD::EXTLOAD, dl, RegVT, Store, StackPtr,
3481 MachinePointerInfo(),
3482 MemVT, false, false, false, 0);
3483
3484 Stores.push_back(DAG.getTruncStore(Load.getValue(1), dl, Load, Ptr,
3485 ST->getPointerInfo()
3486 .getWithOffset(Offset),
3487 MemVT, ST->isVolatile(),
3488 ST->isNonTemporal(),
3489 MinAlign(ST->getAlignment(), Offset),
3490 ST->getAAInfo()));
3462 MachinePointerInfo(), MemVT);
3463
3464 Stores.push_back(
3465 DAG.getTruncStore(Load.getValue(1), dl, Load, Ptr,
3466 ST->getPointerInfo().getWithOffset(Offset), MemVT,
3467 MinAlign(ST->getAlignment(), Offset),
3468 ST->getMemOperand()->getFlags(), ST->getAAInfo()));
34913469 // The order of the stores doesn't matter - say it with a TokenFactor.
34923470 SDValue Result = DAG.getNode(ISD::TokenFactor, dl, MVT::Other, Stores);
34933471 return Result;
35123490 SDValue Store1, Store2;
35133491 Store1 = DAG.getTruncStore(Chain, dl,
35143492 DAG.getDataLayout().isLittleEndian() ? Lo : Hi,
3515 Ptr, ST->getPointerInfo(), NewStoredVT,
3516 ST->isVolatile(), ST->isNonTemporal(), Alignment);
3493 Ptr, ST->getPointerInfo(), NewStoredVT, Alignment,
3494 ST->getMemOperand()->getFlags());
35173495
35183496 EVT PtrVT = Ptr.getValueType();
35193497 Ptr = DAG.getNode(ISD::ADD, dl, PtrVT, Ptr,
35213499 Alignment = MinAlign(Alignment, IncrementSize);
35223500 Store2 = DAG.getTruncStore(
35233501 Chain, dl, DAG.getDataLayout().isLittleEndian() ? Hi : Lo, Ptr,
3524 ST->getPointerInfo().getWithOffset(IncrementSize), NewStoredVT,
3525 ST->isVolatile(), ST->isNonTemporal(), Alignment, ST->getAAInfo());
3502 ST->getPointerInfo().getWithOffset(IncrementSize), NewStoredVT, Alignment,
3503 ST->getMemOperand()->getFlags(), ST->getAAInfo());
35263504
35273505 SDValue Result =
35283506 DAG.getNode(ISD::TokenFactor, dl, MVT::Other, Store1, Store2);
25862586 ArgValue = DAG.getExtLoad(
25872587 ExtType, DL, VA.getLocVT(), Chain, FIN,
25882588 MachinePointerInfo::getFixedStack(DAG.getMachineFunction(), FI),
2589 MemVT, false, false, false, 0);
2589 MemVT);
25902590
25912591 InVals.push_back(ArgValue);
25922592 }
26612661 SDValue Val = DAG.getCopyFromReg(Chain, DL, VReg, MVT::i64);
26622662 SDValue Store = DAG.getStore(
26632663 Val.getValue(1), DL, Val, FIN,
2664 MachinePointerInfo::getStack(DAG.getMachineFunction(), i * 8), false,
2665 false, 0);
2664 MachinePointerInfo::getStack(DAG.getMachineFunction(), i * 8));
26662665 MemOps.push_back(Store);
26672666 FIN =
26682667 DAG.getNode(ISD::ADD, DL, PtrVT, FIN, DAG.getConstant(8, DL, PtrVT));
26912690
26922691 SDValue Store = DAG.getStore(
26932692 Val.getValue(1), DL, Val, FIN,
2694 MachinePointerInfo::getStack(DAG.getMachineFunction(), i * 16),
2695 false, false, 0);
2693 MachinePointerInfo::getStack(DAG.getMachineFunction(), i * 16));
26962694 MemOps.push_back(Store);
26972695 FIN = DAG.getNode(ISD::ADD, DL, PtrVT, FIN,
26982696 DAG.getConstant(16, DL, PtrVT));
31493147 VA.getValVT() == MVT::i16)
31503148 Arg = DAG.getNode(ISD::TRUNCATE, DL, VA.getValVT(), Arg);
31513149
3152 SDValue Store =
3153 DAG.getStore(Chain, DL, Arg, DstAddr, DstInfo, false, false, 0);
3150 SDValue Store = DAG.getStore(Chain, DL, Arg, DstAddr, DstInfo);
31543151 MemOpChains.push_back(Store);
31553152 }
31563153 }
34413438 SDValue Chain = DAG.getEntryNode();
34423439 SDValue FuncTLVGet =
34433440 DAG.getLoad(MVT::i64, DL, Chain, DescAddr,
3444 MachinePointerInfo::getGOT(DAG.getMachineFunction()), false,
3445 true, true, 8);
3441 MachinePointerInfo::getGOT(DAG.getMachineFunction()),
3442 /* Alignment = */ 8, MachineMemOperand::MONonTemporal |
3443 MachineMemOperand::MOInvariant);
34463444 Chain = FuncTLVGet.getValue(1);
34473445
34483446 MachineFrameInfo *MFI = DAG.getMachineFunction().getFrameInfo();
42154213 getPointerTy(DAG.getDataLayout()));
42164214 const Value *SV = cast(Op.getOperand(2))->getValue();
42174215 return DAG.getStore(Op.getOperand(0), DL, FR, Op.getOperand(1),
4218 MachinePointerInfo(SV), false, false, 0);
4216 MachinePointerInfo(SV));
42194217 }
42204218
42214219 SDValue AArch64TargetLowering::LowerAAPCS_VASTART(SDValue Op,
42354233 // void *__stack at offset 0
42364234 SDValue Stack = DAG.getFrameIndex(FuncInfo->getVarArgsStackIndex(), PtrVT);
42374235 MemOps.push_back(DAG.getStore(Chain, DL, Stack, VAList,
4238 MachinePointerInfo(SV), false, false, 8));
4236 MachinePointerInfo(SV), /* Alignment = */ 8));
42394237
42404238 // void *__gr_top at offset 8
42414239 int GPRSize = FuncInfo->getVarArgsGPRSize();
42504248 DAG.getConstant(GPRSize, DL, PtrVT));
42514249
42524250 MemOps.push_back(DAG.getStore(Chain, DL, GRTop, GRTopAddr,
4253 MachinePointerInfo(SV, 8), false, false, 8));
4251 MachinePointerInfo(SV, 8),
4252 /* Alignment = */ 8));
42544253 }
42554254
42564255 // void *__vr_top at offset 16
42654264 DAG.getConstant(FPRSize, DL, PtrVT));
42664265
42674266 MemOps.push_back(DAG.getStore(Chain, DL, VRTop, VRTopAddr,
4268 MachinePointerInfo(SV, 16), false, false, 8));
4267 MachinePointerInfo(SV, 16),
4268 /* Alignment = */ 8));
42694269 }
42704270
42714271 // int __gr_offs at offset 24
42724272 SDValue GROffsAddr =
42734273 DAG.getNode(ISD::ADD, DL, PtrVT, VAList, DAG.getConstant(24, DL, PtrVT));
4274 MemOps.push_back(DAG.getStore(Chain, DL,
4275 DAG.getConstant(-GPRSize, DL, MVT::i32),
4276 GROffsAddr, MachinePointerInfo(SV, 24), false,
4277 false, 4));
4274 MemOps.push_back(DAG.getStore(
4275 Chain, DL, DAG.getConstant(-GPRSize, DL, MVT::i32), GROffsAddr,
4276 MachinePointerInfo(SV, 24), /* Alignment = */ 4));
42784277
42794278 // int __vr_offs at offset 28
42804279 SDValue VROffsAddr =
42814280 DAG.getNode(ISD::ADD, DL, PtrVT, VAList, DAG.getConstant(28, DL, PtrVT));
4282 MemOps.push_back(DAG.getStore(Chain, DL,
4283 DAG.getConstant(-FPRSize, DL, MVT::i32),
4284 VROffsAddr, MachinePointerInfo(SV, 28), false,
4285 false, 4));
4281 MemOps.push_back(DAG.getStore(
4282 Chain, DL, DAG.getConstant(-FPRSize, DL, MVT::i32), VROffsAddr,
4283 MachinePointerInfo(SV, 28), /* Alignment = */ 4));
42864284
42874285 return DAG.getNode(ISD::TokenFactor, DL, MVT::Other, MemOps);
42884286 }
43214319 unsigned Align = Op.getConstantOperandVal(3);
43224320 auto PtrVT = getPointerTy(DAG.getDataLayout());
43234321
4324 SDValue VAList = DAG.getLoad(PtrVT, DL, Chain, Addr, MachinePointerInfo(V),
4325 false, false, false, 0);
4322 SDValue VAList = DAG.getLoad(PtrVT, DL, Chain, Addr, MachinePointerInfo(V));
43264323 Chain = VAList.getValue(1);
43274324
43284325 if (Align > 8) {
43524349 SDValue VANext = DAG.getNode(ISD::ADD, DL, PtrVT, VAList,
43534350 DAG.getConstant(ArgSize, DL, PtrVT));
43544351 // Store the incremented VAList to the legalized pointer
4355 SDValue APStore = DAG.getStore(Chain, DL, VANext, Addr, MachinePointerInfo(V),
4356 false, false, 0);
4352 SDValue APStore =
4353 DAG.getStore(Chain, DL, VANext, Addr, MachinePointerInfo(V));
43574354
43584355 // Load the actual argument out of the pointer VAList
43594356 if (NeedFPTrunc) {
43604357 // Load the value as an f64.
4361 SDValue WideFP = DAG.getLoad(MVT::f64, DL, APStore, VAList,
4362 MachinePointerInfo(), false, false, false, 0);
4358 SDValue WideFP =
4359 DAG.getLoad(MVT::f64, DL, APStore, VAList, MachinePointerInfo());
43634360 // Round the value down to an f32.
43644361 SDValue NarrowFP = DAG.getNode(ISD::FP_ROUND, DL, VT, WideFP.getValue(0),
43654362 DAG.getIntPtrConstant(1, DL));
43684365 return DAG.getMergeValues(Ops, DL);
43694366 }
43704367
4371 return DAG.getLoad(VT, DL, APStore, VAList, MachinePointerInfo(), false,
4372 false, false, 0);
4368 return DAG.getLoad(VT, DL, APStore, VAList, MachinePointerInfo());
43734369 }
43744370
43754371 SDValue AArch64TargetLowering::LowerFRAMEADDR(SDValue Op,
43844380 DAG.getCopyFromReg(DAG.getEntryNode(), DL, AArch64::FP, VT);
43854381 while (Depth--)
43864382 FrameAddr = DAG.getLoad(VT, DL, DAG.getEntryNode(), FrameAddr,
4387 MachinePointerInfo(), false, false, false, 0);
4383 MachinePointerInfo());
43884384 return FrameAddr;
43894385 }
43904386
44154411 SDValue Offset = DAG.getConstant(8, DL, getPointerTy(DAG.getDataLayout()));
44164412 return DAG.getLoad(VT, DL, DAG.getEntryNode(),
44174413 DAG.getNode(ISD::ADD, DL, VT, FrameAddr, Offset),
4418 MachinePointerInfo(), false, false, false, 0);
4414 MachinePointerInfo());
44194415 }
44204416
44214417 // Return LR, which contains the return address. Mark it an implicit live-in.
76637659 !cast(N0)->isVolatile()) {
76647660 LoadSDNode *LN0 = cast(N0);
76657661 SDValue Load = DAG.getLoad(VT, SDLoc(N), LN0->getChain(), LN0->getBasePtr(),
7666 LN0->getPointerInfo(), LN0->isVolatile(),
7667 LN0->isNonTemporal(), LN0->isInvariant(),
7668 LN0->getAlignment());
7662 LN0->getPointerInfo(), LN0->getAlignment(),
7663 LN0->getMemOperand()->getFlags());
76697664
76707665 // Make sure successors of the original load stay after it by updating them
76717666 // to use the new Chain.
87208715 SDValue BasePtr = St->getBasePtr();
87218716 SDValue NewST1 =
87228717 DAG.getStore(St->getChain(), DL, SplatVal, BasePtr, St->getPointerInfo(),
8723 St->isVolatile(), St->isNonTemporal(), St->getAlignment());
8718 St->getAlignment(), St->getMemOperand()->getFlags());
87248719
87258720 unsigned Offset = EltOffset;
87268721 while (--NumVecElts) {
87278722 SDValue OffsetPtr = DAG.getNode(ISD::ADD, DL, MVT::i64, BasePtr,
87288723 DAG.getConstant(Offset, DL, MVT::i64));
87298724 NewST1 = DAG.getStore(NewST1.getValue(0), DL, SplatVal, OffsetPtr,
8730 St->getPointerInfo(), St->isVolatile(),
8731 St->isNonTemporal(), Alignment);
8725 St->getPointerInfo(), Alignment,
8726 St->getMemOperand()->getFlags());
87328727 Offset += EltOffset;
87338728 }
87348729 return NewST1;
87908785 SDValue BasePtr = S->getBasePtr();
87918786 SDValue NewST1 =
87928787 DAG.getStore(S->getChain(), DL, SubVector0, BasePtr, S->getPointerInfo(),
8793 S->isVolatile(), S->isNonTemporal(), S->getAlignment());
8788 S->getAlignment(), S->getMemOperand()->getFlags());
87948789 SDValue OffsetPtr = DAG.getNode(ISD::ADD, DL, MVT::i64, BasePtr,
87958790 DAG.getConstant(8, DL, MVT::i64));
87968791 return DAG.getStore(NewST1.getValue(0), DL, SubVector1, OffsetPtr,
8797 S->getPointerInfo(), S->isVolatile(), S->isNonTemporal(),
8798 S->getAlignment());
8792 S->getPointerInfo(), S->getAlignment(),
8793 S->getMemOperand()->getFlags());
87998794 }
88008795
88018796 /// Target-specific DAG combine function for post-increment LD1 (lane) and
767767 EVT VT = EVT::getEVT(InitTy);
768768 PointerType *PtrTy = PointerType::get(InitTy, AMDGPUAS::PRIVATE_ADDRESS);
769769 return DAG.getStore(Chain, DL, DAG.getConstant(*CI, DL, VT), InitPtr,
770 MachinePointerInfo(UndefValue::get(PtrTy)), false,
771 false, TD.getPrefTypeAlignment(InitTy));
770 MachinePointerInfo(UndefValue::get(PtrTy)),
771 TD.getPrefTypeAlignment(InitTy));
772772 }
773773
774774 if (const ConstantFP *CFP = dyn_cast(Init)) {
775775 EVT VT = EVT::getEVT(CFP->getType());
776776 PointerType *PtrTy = PointerType::get(CFP->getType(), 0);
777777 return DAG.getStore(Chain, DL, DAG.getConstantFP(*CFP, DL, VT), InitPtr,
778 MachinePointerInfo(UndefValue::get(PtrTy)), false,
779 false, TD.getPrefTypeAlignment(CFP->getType()));
778 MachinePointerInfo(UndefValue::get(PtrTy)),
779 TD.getPrefTypeAlignment(CFP->getType()));
780780 }
781781
782782 if (StructType *ST = dyn_cast(InitTy)) {
824824 EVT VT = EVT::getEVT(InitTy);
825825 PointerType *PtrTy = PointerType::get(InitTy, AMDGPUAS::PRIVATE_ADDRESS);
826826 return DAG.getStore(Chain, DL, DAG.getUNDEF(VT), InitPtr,
827 MachinePointerInfo(UndefValue::get(PtrTy)), false,
828 false, TD.getPrefTypeAlignment(InitTy));
827 MachinePointerInfo(UndefValue::get(PtrTy)),
828 TD.getPrefTypeAlignment(InitTy));
829829 }
830830
831831 Init->dump();
10841084 unsigned BaseAlign = Load->getAlignment();
10851085 unsigned HiAlign = MinAlign(BaseAlign, Size);
10861086
1087 SDValue LoLoad
1088 = DAG.getExtLoad(Load->getExtensionType(), SL, LoVT,
1089 Load->getChain(), BasePtr,
1090 SrcValue,
1091 LoMemVT, Load->isVolatile(), Load->isNonTemporal(),
1092 Load->isInvariant(), BaseAlign);
1093
1087 SDValue LoLoad = DAG.getExtLoad(Load->getExtensionType(), SL, LoVT,
1088 Load->getChain(), BasePtr, SrcValue, LoMemVT,
1089 BaseAlign, Load->getMemOperand()->getFlags());
10941090 SDValue HiPtr = DAG.getNode(ISD::ADD, SL, PtrVT, BasePtr,
10951091 DAG.getConstant(Size, SL, PtrVT));
1096
1097 SDValue HiLoad
1098 = DAG.getExtLoad(Load->getExtensionType(), SL, HiVT,
1099 Load->getChain(), HiPtr,
1100 SrcValue.getWithOffset(LoMemVT.getStoreSize()),
1101 HiMemVT, Load->isVolatile(), Load->isNonTemporal(),
1102 Load->isInvariant(), HiAlign);
1092 SDValue HiLoad =
1093 DAG.getExtLoad(Load->getExtensionType(), SL, HiVT, Load->getChain(),
1094 HiPtr, SrcValue.getWithOffset(LoMemVT.getStoreSize()),
1095 HiMemVT, HiAlign, Load->getMemOperand()->getFlags());
11031096
11041097 SDValue Ops[] = {
11051098 DAG.getNode(ISD::CONCAT_VECTORS, SL, VT, LoLoad, HiLoad),
11581151 if (PackedSize < 32) {
11591152 EVT PackedVT = EVT::getIntegerVT(*DAG.getContext(), PackedSize);
11601153 return DAG.getTruncStore(Store->getChain(), DL, PackedValue, Ptr,
1161 Store->getMemOperand()->getPointerInfo(),
1162 PackedVT,
1163 Store->isNonTemporal(), Store->isVolatile(),
1164 Store->getAlignment());
1154 Store->getMemOperand()->getPointerInfo(), PackedVT,
1155 Store->getAlignment(),
1156 Store->getMemOperand()->getFlags());
11651157 }
11661158
11671159 return DAG.getStore(Store->getChain(), DL, PackedValue, Ptr,
11681160 Store->getMemOperand()->getPointerInfo(),
1169 Store->isVolatile(), Store->isNonTemporal(),
1170 Store->getAlignment());
1161 Store->getAlignment(),
1162 Store->getMemOperand()->getFlags());
11711163 }
11721164
11731165 SDValue AMDGPUTargetLowering::SplitVectorStore(SDValue Op,
12041196 unsigned Size = LoMemVT.getStoreSize();
12051197 unsigned HiAlign = MinAlign(BaseAlign, Size);
12061198
1207 SDValue LoStore
1208 = DAG.getTruncStore(Chain, SL, Lo,
1209 BasePtr,
1210 SrcValue,
1211 LoMemVT,
1212 Store->isNonTemporal(),
1213 Store->isVolatile(),
1214 BaseAlign);
1215 SDValue HiStore
1216 = DAG.getTruncStore(Chain, SL, Hi,
1217 HiPtr,
1218 SrcValue.getWithOffset(Size),
1219 HiMemVT,
1220 Store->isNonTemporal(),
1221 Store->isVolatile(),
1222 HiAlign);
1199 SDValue LoStore =
1200 DAG.getTruncStore(Chain, SL, Lo, BasePtr, SrcValue, LoMemVT, BaseAlign,
1201 Store->getMemOperand()->getFlags());
1202 SDValue HiStore =
1203 DAG.getTruncStore(Chain, SL, Hi, HiPtr, SrcValue.getWithOffset(Size),
1204 HiMemVT, HiAlign, Store->getMemOperand()->getFlags());
12231205
12241206 return DAG.getNode(ISD::TokenFactor, SL, MVT::Other, LoStore, HiStore);
12251207 }
10761076
10771077 return DAG.getLoad(VT, DL, DAG.getEntryNode(),
10781078 DAG.getConstant(ByteOffset, DL, MVT::i32), // PTR
1079 MachinePointerInfo(ConstantPointerNull::get(PtrType)),
1080 false, false, false, 0);
1079 MachinePointerInfo(ConstantPointerNull::get(PtrType)));
10811080 }
10821081
10831082 bool R600TargetLowering::isZero(SDValue Op) const {
16451644 if (LoadNode->getExtensionType() == ISD::SEXTLOAD) {
16461645 EVT MemVT = LoadNode->getMemoryVT();
16471646 assert(!MemVT.isVector() && (MemVT == MVT::i16 || MemVT == MVT::i8));
1648 SDValue NewLoad = DAG.getExtLoad(ISD::EXTLOAD, DL, VT, Chain, Ptr,
1649 LoadNode->getPointerInfo(), MemVT,
1650 LoadNode->isVolatile(),
1651 LoadNode->isNonTemporal(),
1652 LoadNode->isInvariant(),
1653 LoadNode->getAlignment());
1647 SDValue NewLoad = DAG.getExtLoad(
1648 ISD::EXTLOAD, DL, VT, Chain, Ptr, LoadNode->getPointerInfo(), MemVT,
1649 LoadNode->getAlignment(), LoadNode->getMemOperand()->getFlags());
16541650 SDValue Res = DAG.getNode(ISD::SIGN_EXTEND_INREG, DL, VT, NewLoad,
16551651 DAG.getValueType(MemVT));
16561652
17931789 unsigned Offset = 36 + VA.getLocMemOffset();
17941790
17951791 MachinePointerInfo PtrInfo(UndefValue::get(PtrTy), PartOffset - ValBase);
1796 SDValue Arg = DAG.getLoad(ISD::UNINDEXED, Ext, VT, DL, Chain,
1797 DAG.getConstant(Offset, DL, MVT::i32),
1798 DAG.getUNDEF(MVT::i32),
1799 PtrInfo,
1800 MemVT, false, true, true, 4);
1792 SDValue Arg = DAG.getLoad(
1793 ISD::UNINDEXED, Ext, VT, DL, Chain,
1794 DAG.getConstant(Offset, DL, MVT::i32), DAG.getUNDEF(MVT::i32), PtrInfo,
1795 MemVT, /* Alignment = */ 4,
1796 MachineMemOperand::MONonTemporal | MachineMemOperand::MOInvariant);
18011797
18021798 // 4 is the preferred alignment for the CONSTANT memory space.
18031799 InVals.push_back(Arg);
576576 ExtTy = ISD::EXTLOAD;
577577
578578 SDValue Ptr = LowerParameterPtr(DAG, SL, Chain, Offset);
579 return DAG.getLoad(ISD::UNINDEXED, ExtTy,
580 VT, SL, Chain, Ptr, PtrOffset, PtrInfo, MemVT,
581 false, // isVolatile
582 true, // isNonTemporal
583 true, // isInvariant
584 Align); // Alignment
579 return DAG.getLoad(ISD::UNINDEXED, ExtTy, VT, SL, Chain, Ptr, PtrOffset,
580 PtrInfo, MemVT, Align, MachineMemOperand::MONonTemporal |
581 MachineMemOperand::MOInvariant);
585582 }
586583
587584 SDValue SITargetLowering::LowerFormalArguments(
14521449 AMDGPUAS::CONSTANT_ADDRESS));
14531450
14541451 MachinePointerInfo PtrInfo(V, StructOffset);
1455 return DAG.getLoad(MVT::i32, SL, QueuePtr.getValue(1), Ptr,
1456 PtrInfo, false,
1457 false, true,
1458 MinAlign(64, StructOffset));
1452 return DAG.getLoad(MVT::i32, SL, QueuePtr.getValue(1), Ptr, PtrInfo,
1453 MinAlign(64, StructOffset),
1454 MachineMemOperand::MOInvariant);
14591455 }
14601456
14611457 SDValue SITargetLowering::lowerADDRSPACECAST(SDValue Op,
15721568 // FIXME: Use a PseudoSourceValue once those can be assigned an address space.
15731569 MachinePointerInfo PtrInfo(UndefValue::get(PtrTy));
15741570
1575 return DAG.getLoad(PtrVT, DL, DAG.getEntryNode(), GOTAddr,
1576 PtrInfo, false, false, true, Align);
1571 return DAG.getLoad(PtrVT, DL, DAG.getEntryNode(), GOTAddr, PtrInfo, Align,
1572 MachineMemOperand::MOInvariant);
15771573 }
15781574
15791575 SDValue SITargetLowering::lowerTRAP(SDValue Op,
15401540 StackPtr, PtrOff);
15411541 return DAG.getStore(
15421542 Chain, dl, Arg, PtrOff,
1543 MachinePointerInfo::getStack(DAG.getMachineFunction(), LocMemOffset),
1544 false, false, 0);
1543 MachinePointerInfo::getStack(DAG.getMachineFunction(), LocMemOffset));
15451544 }
15461545
15471546 void ARMTargetLowering::PassF64ArgInRegs(const SDLoc &dl, SelectionDAG &DAG,
17261725 SDValue AddArg = DAG.getNode(ISD::ADD, dl, PtrVT, Arg, Const);
17271726 SDValue Load = DAG.getLoad(PtrVT, dl, Chain, AddArg,
17281727 MachinePointerInfo(),
1729 false, false, false,
17301728 DAG.InferPtrAlignment(AddArg));
17311729 MemOpChains.push_back(Load.getValue(1));
17321730 RegsToPass.push_back(std::make_pair(j, Load));
18331831 CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr);
18341832 Callee = DAG.getLoad(
18351833 PtrVt, dl, DAG.getEntryNode(), CPAddr,
1836 MachinePointerInfo::getConstantPool(DAG.getMachineFunction()), false,
1837 false, false, 0);
1834 MachinePointerInfo::getConstantPool(DAG.getMachineFunction()));
18381835 } else if (ExternalSymbolSDNode *S=dyn_cast(Callee)) {
18391836 const char *Sym = S->getSymbol();
18401837
18481845 CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr);
18491846 Callee = DAG.getLoad(
18501847 PtrVt, dl, DAG.getEntryNode(), CPAddr,
1851 MachinePointerInfo::getConstantPool(DAG.getMachineFunction()), false,
1852 false, false, 0);
1848 MachinePointerInfo::getConstantPool(DAG.getMachineFunction()));
18531849 }
18541850 } else if (isa(Callee)) {
18551851 // If we're optimizing for minimum size and the function is called three or
18781874 Callee =
18791875 DAG.getLoad(PtrVt, dl, DAG.getEntryNode(), Callee,
18801876 MachinePointerInfo::getGOT(DAG.getMachineFunction()),
1881 false, false, true, 0);
1877 /* Alignment = */ 0, MachineMemOperand::MOInvariant);
18821878 } else if (Subtarget->isTargetCOFF()) {
18831879 assert(Subtarget->isTargetWindows() &&
18841880 "Windows is the only supported COFF target");
18911887 Callee =
18921888 DAG.getLoad(PtrVt, dl, DAG.getEntryNode(),
18931889 DAG.getNode(ARMISD::Wrapper, dl, PtrVt, Callee),
1894 MachinePointerInfo::getGOT(DAG.getMachineFunction()),
1895 false, false, false, 0);
1890 MachinePointerInfo::getGOT(DAG.getMachineFunction()));
18961891 } else {
18971892 Callee = DAG.getTargetGlobalAddress(GV, dl, PtrVt, 0, 0);
18981893 }
19101905 CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr);
19111906 Callee = DAG.getLoad(
19121907 PtrVt, dl, DAG.getEntryNode(), CPAddr,
1913 MachinePointerInfo::getConstantPool(DAG.getMachineFunction()), false,
1914 false, false, 0);
1908 MachinePointerInfo::getConstantPool(DAG.getMachineFunction()));
19151909 SDValue PICLabel = DAG.getConstant(ARMPCLabelIndex, dl, MVT::i32);
19161910 Callee = DAG.getNode(ARMISD::PIC_ADD, dl, PtrVt, Callee, PICLabel);
19171911 } else {
25462540 CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, 4);
25472541 }
25482542 CPAddr = DAG.getNode(ARMISD::Wrapper, DL, PtrVT, CPAddr);
2549 SDValue Result =
2550 DAG.getLoad(PtrVT, DL, DAG.getEntryNode(), CPAddr,
2551 MachinePointerInfo::getConstantPool(DAG.getMachineFunction()),
2552 false, false, false, 0);
2543 SDValue Result = DAG.getLoad(
2544 PtrVT, DL, DAG.getEntryNode(), CPAddr,
2545 MachinePointerInfo::getConstantPool(DAG.getMachineFunction()));
25532546 if (!IsPositionIndependent)
25542547 return Result;
25552548 SDValue PICLabel = DAG.getConstant(ARMPCLabelIndex, DL, MVT::i32);
25962589 SDValue FuncTLVGet =
25972590 DAG.getLoad(MVT::i32, DL, Chain, DescAddr,
25982591 MachinePointerInfo::getGOT(DAG.getMachineFunction()),
2599 false, true, true, 4);
2592 /* Alignment = */ 4, MachineMemOperand::MONonTemporal |
2593 MachineMemOperand::MOInvariant);
26002594 Chain = FuncTLVGet.getValue(1);
26012595
26022596 MachineFunction &F = DAG.getMachineFunction();
26492643 // A pointer to the TLS array is located at offset 0x2c from the TEB.
26502644 SDValue TLSArray =
26512645 DAG.getNode(ISD::ADD, DL, PtrVT, TEB, DAG.getIntPtrConstant(0x2c, DL));
2652 TLSArray = DAG.getLoad(PtrVT, DL, Chain, TLSArray, MachinePointerInfo(),
2653 false, false, false, 0);
2646 TLSArray = DAG.getLoad(PtrVT, DL, Chain, TLSArray, MachinePointerInfo());
26542647
26552648 // The pointer to the thread's TLS data area is at the TLS Index scaled by 4
26562649 // offset into the TLSArray.
26592652 SDValue TLSIndex =
26602653 DAG.getTargetExternalSymbol("_tls_index", PtrVT, ARMII::MO_NO_FLAG);
26612654 TLSIndex = DAG.getNode(ARMISD::Wrapper, DL, PtrVT, TLSIndex);
2662 TLSIndex = DAG.getLoad(PtrVT, DL, Chain, TLSIndex, MachinePointerInfo(),
2663 false, false, false, 0);
2655 TLSIndex = DAG.getLoad(PtrVT, DL, Chain, TLSIndex, MachinePointerInfo());
26642656
26652657 SDValue Slot = DAG.getNode(ISD::SHL, DL, PtrVT, TLSIndex,
26662658 DAG.getConstant(2, DL, MVT::i32));
26672659 SDValue TLS = DAG.getLoad(PtrVT, DL, Chain,
26682660 DAG.getNode(ISD::ADD, DL, PtrVT, TLSArray, Slot),
2669 MachinePointerInfo(), false, false, false, 0);
2661 MachinePointerInfo());
26702662
26712663 // Get the offset of the start of the .tls section (section base)
26722664 const auto *GA = cast(Op);
26732665 auto *CPV = ARMConstantPoolConstant::Create(GA->getGlobal(), ARMCP::SECREL);
2674 SDValue Offset =
2675 DAG.getLoad(PtrVT, DL, Chain,
2676 DAG.getNode(ARMISD::Wrapper, DL, MVT::i32,
2677 DAG.getTargetConstantPool(CPV, PtrVT, 4)),
2678 MachinePointerInfo::getConstantPool(DAG.getMachineFunction()),
2679 false, false, false, 0);
2666 SDValue Offset = DAG.getLoad(
2667 PtrVT, DL, Chain, DAG.getNode(ARMISD::Wrapper, DL, MVT::i32,
2668 DAG.getTargetConstantPool(CPV, PtrVT, 4)),
2669 MachinePointerInfo::getConstantPool(DAG.getMachineFunction()));
26802670
26812671 return DAG.getNode(ISD::ADD, DL, PtrVT, TLS, Offset);
26822672 }
26962686 ARMCP::CPValue, PCAdj, ARMCP::TLSGD, true);
26972687 SDValue Argument = DAG.getTargetConstantPool(CPV, PtrVT, 4);
26982688 Argument = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, Argument);
2699 Argument =
2700 DAG.getLoad(PtrVT, dl, DAG.getEntryNode(), Argument,
2701 MachinePointerInfo::getConstantPool(DAG.getMachineFunction()),
2702 false, false, false, 0);
2689 Argument = DAG.getLoad(
2690 PtrVT, dl, DAG.getEntryNode(), Argument,
2691 MachinePointerInfo::getConstantPool(DAG.getMachineFunction()));
27032692 SDValue Chain = Argument.getValue(1);
27042693
27052694 SDValue PICLabel = DAG.getConstant(ARMPCLabelIndex, dl, MVT::i32);
27502739 Offset = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, Offset);
27512740 Offset = DAG.getLoad(
27522741 PtrVT, dl, Chain, Offset,
2753 MachinePointerInfo::getConstantPool(DAG.getMachineFunction()), false,
2754 false, false, 0);
2742 MachinePointerInfo::getConstantPool(DAG.getMachineFunction()));
27552743 Chain = Offset.getValue(1);
27562744
27572745 SDValue PICLabel = DAG.getConstant(ARMPCLabelIndex, dl, MVT::i32);
27592747
27602748 Offset = DAG.getLoad(
27612749 PtrVT, dl, Chain, Offset,
2762 MachinePointerInfo::getConstantPool(DAG.getMachineFunction()), false,
2763 false, false, 0);
2750 MachinePointerInfo::getConstantPool(DAG.getMachineFunction()));
27642751 } else {
27652752 // local exec model
27662753 assert(model == TLSModel::LocalExec);
27702757 Offset = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, Offset);
27712758 Offset = DAG.getLoad(
27722759 PtrVT, dl, Chain, Offset,
2773 MachinePointerInfo::getConstantPool(DAG.getMachineFunction()), false,
2774 false, false, 0);
2760 MachinePointerInfo::getConstantPool(DAG.getMachineFunction()));
27752761 }
27762762
27772763 // The address of the thread local variable is the add of the thread
28292815 CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr);
28302816 SDValue Result = DAG.getLoad(
28312817 PtrVT, dl, DAG.getEntryNode(), CPAddr,
2832 MachinePointerInfo::getConstantPool(DAG.getMachineFunction()), false,
2833 false, false, 0);
2818 MachinePointerInfo::getConstantPool(DAG.getMachineFunction()));
28342819 SDValue Chain = Result.getValue(1);
28352820 SDValue PICLabel = DAG.getConstant(ARMPCLabelIndex, dl, MVT::i32);
28362821 Result = DAG.getNode(ARMISD::PIC_ADD, dl, PtrVT, Result, PICLabel);
28372822 if (UseGOT_PREL)
2838 Result = DAG.getLoad(PtrVT, dl, Chain, Result,
2839 MachinePointerInfo::getGOT(DAG.getMachineFunction()),
2840 false, false, false, 0);
2823 Result =
2824 DAG.getLoad(PtrVT, dl, Chain, Result,
2825 MachinePointerInfo::getGOT(DAG.getMachineFunction()));
28412826 return Result;
28422827 }
28432828
28542839 CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr);
28552840 return DAG.getLoad(
28562841 PtrVT, dl, DAG.getEntryNode(), CPAddr,
2857 MachinePointerInfo::getConstantPool(DAG.getMachineFunction()), false,
2858 false, false, 0);
2842 MachinePointerInfo::getConstantPool(DAG.getMachineFunction()));
28592843 }
28602844 }
28612845
28782862
28792863 if (Subtarget->isGVIndirectSymbol(GV))
28802864 Result = DAG.getLoad(PtrVT, dl, DAG.getEntryNode(), Result,
2881 MachinePointerInfo::getGOT(DAG.getMachineFunction()),
2882 false, false, false, 0);
2865 MachinePointerInfo::getGOT(DAG.getMachineFunction()));
28832866 return Result;
28842867 }
28852868
29052888 TargetFlags));
29062889 if (GV->hasDLLImportStorageClass())
29072890 Result = DAG.getLoad(PtrVT, DL, DAG.getEntryNode(), Result,
2908 MachinePointerInfo::getGOT(DAG.getMachineFunction()),
2909 false, false, false, 0);
2891 MachinePointerInfo::getGOT(DAG.getMachineFunction()));
29102892 return Result;
29112893 }
29122894
29642946 CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr);
29652947 SDValue Result = DAG.getLoad(
29662948 PtrVT, dl, DAG.getEntryNode(), CPAddr,
2967 MachinePointerInfo::getConstantPool(DAG.getMachineFunction()), false,
2968 false, false, 0);
2949 MachinePointerInfo::getConstantPool(DAG.getMachineFunction()));
29692950
29702951 if (IsPositionIndependent) {
29712952 SDValue PICLabel = DAG.getConstant(ARMPCLabelIndex, dl, MVT::i32);
30843065 SDValue FR = DAG.getFrameIndex(FuncInfo->getVarArgsFrameIndex(), PtrVT);
30853066 const Value *SV = cast(Op.getOperand(2))->getValue();
30863067 return DAG.getStore(Op.getOperand(0), dl, FR, Op.getOperand(1),
3087 MachinePointerInfo(SV), false, false, 0);
3068 MachinePointerInfo(SV));
30883069 }
30893070
30903071 SDValue ARMTargetLowering::GetF64FormalArgument(CCValAssign &VA,
31143095 SDValue FIN = DAG.getFrameIndex(FI, getPointerTy(DAG.getDataLayout()));
31153096 ArgValue2 = DAG.getLoad(
31163097 MVT::i32, dl, Root, FIN,
3117 MachinePointerInfo::getFixedStack(DAG.getMachineFunction(), FI), false,
3118 false, false, 0);
3098 MachinePointerInfo::getFixedStack(DAG.getMachineFunction(), FI));
31193099 } else {
31203100 Reg = MF.addLiveIn(NextVA.getLocReg(), RC);
31213101 ArgValue2 = DAG.getCopyFromReg(Root, dl, Reg, MVT::i32);
31753155 for (unsigned Reg = RBegin, i = 0; Reg < REnd; ++Reg, ++i) {
31763156 unsigned VReg = MF.addLiveIn(Reg, RC);
31773157 SDValue Val = DAG.getCopyFromReg(Chain, dl, VReg, MVT::i32);
3178 SDValue Store =
3179 DAG.getStore(Val.getValue(1), dl, Val, FIN,
3180 MachinePointerInfo(OrigArg, 4 * i), false, false, 0);
3158 SDValue Store = DAG.getStore(Val.getValue(1), dl, Val, FIN,
3159 MachinePointerInfo(OrigArg, 4 * i));
31813160 MemOps.push_back(Store);
31823161 FIN = DAG.getNode(ISD::ADD, dl, PtrVT, FIN, DAG.getConstant(4, dl, PtrVT));
31833162 }
32923271 if (VA.isMemLoc()) {
32933272 int FI = MFI->CreateFixedObject(8, VA.getLocMemOffset(), true);
32943273 SDValue FIN = DAG.getFrameIndex(FI, PtrVT);
3295 ArgValue2 = DAG.getLoad(
3296 MVT::f64, dl, Chain, FIN,
3297 MachinePointerInfo::getFixedStack(DAG.getMachineFunction(), FI),
3298 false, false, false, 0);
3274 ArgValue2 = DAG.getLoad(MVT::f64, dl, Chain, FIN,
3275 MachinePointerInfo::getFixedStack(
3276 DAG.getMachineFunction(), FI));
32993277 } else {
33003278 ArgValue2 = GetF64FormalArgument(VA, ArgLocs[++i],
33013279 Chain, DAG, dl);
33883366
33893367 // Create load nodes to retrieve arguments from the stack.
33903368 SDValue FIN = DAG.getFrameIndex(FI, PtrVT);
3391 InVals.push_back(DAG.getLoad(
3392 VA.getValVT(), dl, Chain, FIN,
3393 MachinePointerInfo::getFixedStack(DAG.getMachineFunction(), FI),
3394 false, false, false, 0));
3369 InVals.push_back(DAG.getLoad(VA.getValVT(), dl, Chain, FIN,
3370 MachinePointerInfo::getFixedStack(
3371 DAG.getMachineFunction(), FI)));
33953372 }
33963373 lastInsIndex = index;
33973374 }
39803957 return DAG.getConstant(0, SDLoc(Op), MVT::i32);
39813958
39823959 if (LoadSDNode *Ld = dyn_cast(Op))
3983 return DAG.getLoad(MVT::i32, SDLoc(Op),
3984 Ld->getChain(), Ld->getBasePtr(), Ld->getPointerInfo(),
3985 Ld->isVolatile(), Ld->isNonTemporal(),
3986 Ld->isInvariant(), Ld->getAlignment());
3960 return DAG.getLoad(MVT::i32, SDLoc(Op), Ld->getChain(), Ld->getBasePtr(),
3961 Ld->getPointerInfo(), Ld->getAlignment(),
3962 Ld->getMemOperand()->getFlags());
39873963
39883964 llvm_unreachable("Unknown VFP cmp argument!");
39893965 }
40003976
40013977 if (LoadSDNode *Ld = dyn_cast(Op)) {
40023978 SDValue Ptr = Ld->getBasePtr();
4003 RetVal1 = DAG.getLoad(MVT::i32, dl,
4004 Ld->getChain(), Ptr,
4005 Ld->getPointerInfo(),
4006 Ld->isVolatile(), Ld->isNonTemporal(),
4007 Ld->isInvariant(), Ld->getAlignment());
3979 RetVal1 =
3980 DAG.getLoad(MVT::i32, dl, Ld->getChain(), Ptr, Ld->getPointerInfo(),
3981 Ld->getAlignment(), Ld->getMemOperand()->getFlags());
40083982
40093983 EVT PtrType = Ptr.getValueType();
40103984 unsigned NewAlign = MinAlign(Ld->getAlignment(), 4);
40113985 SDValue NewPtr = DAG.getNode(ISD::ADD, dl,
40123986 PtrType, Ptr, DAG.getConstant(4, dl, PtrType));
4013 RetVal2 = DAG.getLoad(MVT::i32, dl,
4014 Ld->getChain(), NewPtr,
4015 Ld->getPointerInfo().getWithOffset(4),
4016 Ld->isVolatile(), Ld->isNonTemporal(),
4017 Ld->isInvariant(), NewAlign);
3987 RetVal2 = DAG.getLoad(MVT::i32, dl, Ld->getChain(), NewPtr,
3988 Ld->getPointerInfo().getWithOffset(4), NewAlign,
3989 Ld->getMemOperand()->getFlags());
40183990 return;
40193991 }
40203992
41514123 if (isPositionIndependent()) {
41524124 Addr =
41534125 DAG.getLoad((EVT)MVT::i32, dl, Chain, Addr,
4154 MachinePointerInfo::getJumpTable(DAG.getMachineFunction()),
4155 false, false, false, 0);
4126 MachinePointerInfo::getJumpTable(DAG.getMachineFunction()));
41564127 Chain = Addr.getValue(1);
41574128 Addr = DAG.getNode(ISD::ADD, dl, PTy, Addr, Table);
41584129 return DAG.getNode(ARMISD::BR_JT, dl, MVT::Other, Chain, Addr, JTI);
41594130 } else {
41604131 Addr =
41614132 DAG.getLoad(PTy, dl, Chain, Addr,
4162 MachinePointerInfo::getJumpTable(DAG.getMachineFunction()),
4163 false, false, false, 0);
4133 MachinePointerInfo::getJumpTable(DAG.getMachineFunction()));
41644134 Chain = Addr.getValue(1);
41654135 return DAG.getNode(ARMISD::BR_JT, dl, MVT::Other, Chain, Addr, JTI);
41664136 }
43544324 SDValue Offset = DAG.getConstant(4, dl, MVT::i32);
43554325 return DAG.getLoad(VT, dl, DAG.getEntryNode(),
43564326 DAG.getNode(ISD::ADD, dl, VT, FrameAddr, Offset),
4357 MachinePointerInfo(), false, false, false, 0);
4327 MachinePointerInfo());
43584328 }
43594329
43604330 // Return LR, which contains the return address. Mark it an implicit live-in.
43764346 SDValue FrameAddr = DAG.getCopyFromReg(DAG.getEntryNode(), dl, FrameReg, VT);
43774347 while (Depth--)
43784348 FrameAddr = DAG.getLoad(VT, dl, DAG.getEntryNode(), FrameAddr,
4379 MachinePointerInfo(),
4380 false, false, false, 0);
4349 MachinePointerInfo());
43814350 return FrameAddr;
43824351 }
43834352
65696538 // The load already has the right type.
65706539 if (ExtendedTy == LD->getMemoryVT())
65716540 return DAG.getLoad(LD->getMemoryVT(), SDLoc(LD), LD->getChain(),
6572 LD->getBasePtr(), LD->getPointerInfo(), LD->isVolatile(),
6573 LD->isNonTemporal(), LD->isInvariant(),
6574 LD->getAlignment());
6541 LD->getBasePtr(), LD->getPointerInfo(),
6542 LD->getAlignment(), LD->getMemOperand()->getFlags());
65756543
65766544 // We need to create a zextload/sextload. We cannot just create a load
65776545 // followed by a zext/zext node because LowerMUL is also run during normal
65786546 // operation legalization where we can't create illegal types.
65796547 return DAG.getExtLoad(LD->getExtensionType(), SDLoc(LD), ExtendedTy,
65806548 LD->getChain(), LD->getBasePtr(), LD->getPointerInfo(),
6581 LD->getMemoryVT(), LD->isVolatile(), LD->isInvariant(),
6582 LD->isNonTemporal(), LD->getAlignment());
6549 LD->getMemoryVT(), LD->getAlignment(),
6550 LD->getMemOperand()->getFlags());
65836551 }
65846552
65856553 /// SkipExtensionForVMULL - For a node that is a SIGN_EXTEND, ZERO_EXTEND,
69886956 if (!ShouldUseSRet)
69896957 return CallResult.first;
69906958
6991 SDValue LoadSin = DAG.getLoad(ArgVT, dl, CallResult.second, SRet,
6992 MachinePointerInfo(), false, false, false, 0);
6959 SDValue LoadSin =
6960 DAG.getLoad(ArgVT, dl, CallResult.second, SRet, MachinePointerInfo());
69936961
69946962 // Address of cos field.
69956963 SDValue Add = DAG.getNode(ISD::ADD, dl, PtrVT, SRet,
69966964 DAG.getIntPtrConstant(ArgVT.getStoreSize(), dl));
6997 SDValue LoadCos = DAG.getLoad(ArgVT, dl, LoadSin.getValue(1), Add,
6998 MachinePointerInfo(), false, false, false, 0);
6965 SDValue LoadCos =
6966 DAG.getLoad(ArgVT, dl, LoadSin.getValue(1), Add, MachinePointerInfo());
69996967
70006968 SDVTList Tys = DAG.getVTList(ArgVT, ArgVT);
70016969 return DAG.getNode(ISD::MERGE_VALUES, dl, Tys,
96609628 SelectionDAG &DAG = DCI.DAG;
96619629 SDLoc DL(LD);
96629630 SDValue BasePtr = LD->getBasePtr();
9663 SDValue NewLD1 = DAG.getLoad(MVT::i32, DL, LD->getChain(), BasePtr,