llvm.org GIT mirror llvm / 32c7e44
DAG: allow DAG pointer size different from memory representation. In preparation for supporting ILP32 on AArch64, this modifies the SelectionDAG builder code so that pointers are allowed to have a larger type when "live" in the DAG compared to memory. Pointers get zero-extended whenever they are loaded, and truncated prior to stores. In addition, a few not quite so obvious locations need updating: * A GEP that has not been marked inbounds needs to enforce the IR-documented 2s-complement wrapping at the memory pointer size. Inbounds GEPs are undefined if they overflow the address space, so no additional operations are needed. * Signed comparisons would give incorrect results if performed on the zero-extended values. This shouldn't affect CodeGen for now, but will become active when the AArch64 ILP32 support is committed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359676 91177308-0d34-0410-b5e6-96231b3b80d8 Tim Northover 1 year, 1 month ago
7 changed file(s) with 179 addition(s) and 49 deletion(s). Raw diff Collapse all Expand all
7373 SmallVectorImpl *Offsets = nullptr,
7474 uint64_t StartingOffset = 0);
7575
76 /// Variant of ComputeValueVTs that also produces the memory VTs.
77 void ComputeValueVTs(const TargetLowering &TLI, const DataLayout &DL, Type *Ty,
78 SmallVectorImpl &ValueVTs,
79 SmallVectorImpl *MemVTs,
80 SmallVectorImpl *Offsets = nullptr,
81 uint64_t StartingOffset = 0);
82
7683 /// computeValueLLTs - Given an LLVM IR type, compute a sequence of
7784 /// LLTs that represent all the individual underlying
7885 /// non-aggregate types that comprise it.
793793 /// value assuming it was the smaller SrcTy value.
794794 SDValue getZeroExtendInReg(SDValue Op, const SDLoc &DL, EVT VT);
795795
796 /// Convert Op, which must be of integer type, to the integer type VT, by
797 /// either truncating it or performing either zero or sign extension as
798 /// appropriate extension for the pointer's semantics.
799 SDValue getPtrExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT);
800
801 /// Return the expression required to extend the Op as a pointer value
802 /// assuming it was the smaller SrcTy value. This may be either a zero extend
803 /// or a sign extend.
804 SDValue getPtrExtendInReg(SDValue Op, const SDLoc &DL, EVT VT);
805
796806 /// Convert Op, which must be of integer type, to the integer type VT,
797807 /// by using an extension appropriate for the target's
798808 /// BooleanContent for type OpVT or truncating it.
237237 /// Return the pointer type for the given address space, defaults to
238238 /// the pointer type from the data layout.
239239 /// FIXME: The default needs to be removed once all the code is updated.
240 MVT getPointerTy(const DataLayout &DL, uint32_t AS = 0) const {
240 virtual MVT getPointerTy(const DataLayout &DL, uint32_t AS = 0) const {
241 return MVT::getIntegerVT(DL.getPointerSizeInBits(AS));
242 }
243
244 /// Return the in-memory pointer type for the given address space, defaults to
245 /// the pointer type from the data layout. FIXME: The default needs to be
246 /// removed once all the code is updated.
247 MVT getPointerMemTy(const DataLayout &DL, uint32_t AS = 0) const {
241248 return MVT::getIntegerVT(DL.getPointerSizeInBits(AS));
242249 }
243250
11781185 }
11791186 return EVT::getEVT(Ty, AllowUnknown);
11801187 }
1188
1189 EVT getMemValueType(const DataLayout &DL, Type *Ty,
1190 bool AllowUnknown = false) const {
1191 // Lower scalar pointers to native pointer types.
1192 if (PointerType *PTy = dyn_cast(Ty))
1193 return getPointerMemTy(DL, PTy->getAddressSpace());
1194 else if (VectorType *VTy = dyn_cast(Ty)) {
1195 Type *Elm = VTy->getElementType();
1196 if (PointerType *PT = dyn_cast(Elm)) {
1197 EVT PointerTy(getPointerMemTy(DL, PT->getAddressSpace()));
1198 Elm = PointerTy.getTypeForEVT(Ty->getContext());
1199 }
1200 return EVT::getVectorVT(Ty->getContext(), EVT::getEVT(Elm, false),
1201 VTy->getNumElements());
1202 }
1203
1204 return getValueType(DL, Ty, AllowUnknown);
1205 }
1206
11811207
11821208 /// Return the MVT corresponding to this LLVM type. See getValueType.
11831209 MVT getSimpleValueType(const DataLayout &DL, Type *Ty,
8181 ///
8282 void llvm::ComputeValueVTs(const TargetLowering &TLI, const DataLayout &DL,
8383 Type *Ty, SmallVectorImpl &ValueVTs,
84 SmallVectorImpl *MemVTs,
8485 SmallVectorImpl *Offsets,
8586 uint64_t StartingOffset) {
8687 // Given a struct type, recursively traverse the elements.
9091 EI = EB,
9192 EE = STy->element_end();
9293 EI != EE; ++EI)
93 ComputeValueVTs(TLI, DL, *EI, ValueVTs, Offsets,
94 ComputeValueVTs(TLI, DL, *EI, ValueVTs, MemVTs, Offsets,
9495 StartingOffset + SL->getElementOffset(EI - EB));
9596 return;
9697 }
99100 Type *EltTy = ATy->getElementType();
100101 uint64_t EltSize = DL.getTypeAllocSize(EltTy);
101102 for (unsigned i = 0, e = ATy->getNumElements(); i != e; ++i)
102 ComputeValueVTs(TLI, DL, EltTy, ValueVTs, Offsets,
103 ComputeValueVTs(TLI, DL, EltTy, ValueVTs, MemVTs, Offsets,
103104 StartingOffset + i * EltSize);
104105 return;
105106 }
108109 return;
109110 // Base case: we can get an EVT for this LLVM IR type.
110111 ValueVTs.push_back(TLI.getValueType(DL, Ty));
112 if (MemVTs)
113 MemVTs->push_back(TLI.getMemValueType(DL, Ty));
111114 if (Offsets)
112115 Offsets->push_back(StartingOffset);
116 }
117
118 void llvm::ComputeValueVTs(const TargetLowering &TLI, const DataLayout &DL,
119 Type *Ty, SmallVectorImpl &ValueVTs,
120 SmallVectorImpl *Offsets,
121 uint64_t StartingOffset) {
122 return ComputeValueVTs(TLI, DL, Ty, ValueVTs, /*MemVTs=*/nullptr, Offsets,
123 StartingOffset);
113124 }
114125
115126 void llvm::computeValueLLTs(const DataLayout &DL, Type &Ty,
359359 /// Get the iX type with the same bitwidth as T.
360360 IntegerType *AtomicExpand::getCorrespondingIntegerType(Type *T,
361361 const DataLayout &DL) {
362 EVT VT = TLI->getValueType(DL, T);
362 EVT VT = TLI->getMemValueType(DL, T);
363363 unsigned BitWidth = VT.getStoreSizeInBits();
364364 assert(BitWidth == VT.getSizeInBits() && "must be a power of two");
365365 return IntegerType::get(T->getContext(), BitWidth);
11441144 getConstant(Imm, DL, Op.getValueType()));
11451145 }
11461146
1147 SDValue SelectionDAG::getPtrExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT) {
1148 // Only unsigned pointer semantics are supported right now. In the future this
1149 // might delegate to TLI to check pointer signedness.
1150 return getZExtOrTrunc(Op, DL, VT);
1151 }
1152
1153 SDValue SelectionDAG::getPtrExtendInReg(SDValue Op, const SDLoc &DL, EVT VT) {
1154 // Only unsigned pointer semantics are supported right now. In the future this
1155 // might delegate to TLI to check pointer signedness.
1156 return getZeroExtendInReg(Op, DL, VT);
1157 }
1158
11471159 /// getNOT - Create a bitwise NOT operation as (XOR Val, -1).
11481160 SDValue SelectionDAG::getNOT(const SDLoc &DL, SDValue Val, EVT VT) {
11491161 EVT EltVT = VT.getScalarType();
17861786 DemoteReg, PtrValueVTs[0]);
17871787 SDValue RetOp = getValue(I.getOperand(0));
17881788
1789 SmallVector ValueVTs;
1789 SmallVector ValueVTs, MemVTs;
17901790 SmallVector Offsets;
1791 ComputeValueVTs(TLI, DL, I.getOperand(0)->getType(), ValueVTs, &Offsets);
1791 ComputeValueVTs(TLI, DL, I.getOperand(0)->getType(), ValueVTs, &MemVTs,
1792 &Offsets);
17921793 unsigned NumValues = ValueVTs.size();
17931794
17941795 SmallVector Chains(NumValues);
17961797 // An aggregate return value cannot wrap around the address space, so
17971798 // offsets to its parts don't wrap either.
17981799 SDValue Ptr = DAG.getObjectPtrOffset(getCurSDLoc(), RetPtr, Offsets[i]);
1799 Chains[i] = DAG.getStore(
1800 Chain, getCurSDLoc(), SDValue(RetOp.getNode(), RetOp.getResNo() + i),
1800
1801 SDValue Val = RetOp.getValue(i);
1802 if (MemVTs[i] != ValueVTs[i])
1803 Val = DAG.getPtrExtOrTrunc(Val, getCurSDLoc(), MemVTs[i]);
1804 Chains[i] = DAG.getStore(Chain, getCurSDLoc(), Val,
18011805 // FIXME: better loc info would be nice.
18021806 Ptr, MachinePointerInfo::getUnknownStack(DAG.getMachineFunction()));
18031807 }
23092313 return;
23102314 }
23112315
2316 auto &TLI = DAG.getTargetLoweringInfo();
2317 EVT MemVT = TLI.getMemValueType(DAG.getDataLayout(), CB.CmpLHS->getType());
2318
23122319 // Build the setcc now.
23132320 if (!CB.CmpMHS) {
23142321 // Fold "(X == true)" to X and "(X == false)" to !X to
23202327 CB.CC == ISD::SETEQ) {
23212328 SDValue True = DAG.getConstant(1, dl, CondLHS.getValueType());
23222329 Cond = DAG.getNode(ISD::XOR, dl, CondLHS.getValueType(), CondLHS, True);
2323 } else
2324 Cond = DAG.getSetCC(dl, MVT::i1, CondLHS, getValue(CB.CmpRHS), CB.CC);
2330 } else {
2331 SDValue CondRHS = getValue(CB.CmpRHS);
2332
2333 // If a pointer's DAG type is larger than its memory type then the DAG
2334 // values are zero-extended. This breaks signed comparisons so truncate
2335 // back to the underlying type before doing the compare.
2336 if (CondLHS.getValueType() != MemVT) {
2337 CondLHS = DAG.getPtrExtOrTrunc(CondLHS, getCurSDLoc(), MemVT);
2338 CondRHS = DAG.getPtrExtOrTrunc(CondRHS, getCurSDLoc(), MemVT);
2339 }
2340 Cond = DAG.getSetCC(dl, MVT::i1, CondLHS, CondRHS, CB.CC);
2341 }
23252342 } else {
23262343 assert(CB.CC == ISD::SETLE && "Can handle only LE ranges now");
23272344
24472464 SDValue &Chain) {
24482465 const TargetLowering &TLI = DAG.getTargetLoweringInfo();
24492466 EVT PtrTy = TLI.getPointerTy(DAG.getDataLayout());
2467 EVT PtrMemTy = TLI.getPointerMemTy(DAG.getDataLayout());
24502468 MachineFunction &MF = DAG.getMachineFunction();
24512469 Value *Global = TLI.getSDagStackGuard(*MF.getFunction().getParent());
24522470 MachineSDNode *Node =
24592477 MPInfo, Flags, PtrTy.getSizeInBits() / 8, DAG.getEVTAlignment(PtrTy));
24602478 DAG.setNodeMemRefs(Node, {MemRef});
24612479 }
2480 if (PtrTy != PtrMemTy)
2481 return DAG.getPtrExtOrTrunc(SDValue(Node, 0), DL, PtrMemTy);
24622482 return SDValue(Node, 0);
24632483 }
24642484
24742494 // First create the loads to the guard/stack slot for the comparison.
24752495 const TargetLowering &TLI = DAG.getTargetLoweringInfo();
24762496 EVT PtrTy = TLI.getPointerTy(DAG.getDataLayout());
2497 EVT PtrMemTy = TLI.getPointerMemTy(DAG.getDataLayout());
24772498
24782499 MachineFrameInfo &MFI = ParentBB->getParent()->getFrameInfo();
24792500 int FI = MFI.getStackProtectorIndex();
24862507
24872508 // Generate code to load the content of the guard slot.
24882509 SDValue GuardVal = DAG.getLoad(
2489 PtrTy, dl, DAG.getEntryNode(), StackSlotPtr,
2510 PtrMemTy, dl, DAG.getEntryNode(), StackSlotPtr,
24902511 MachinePointerInfo::getFixedStack(DAG.getMachineFunction(), FI), Align,
24912512 MachineMemOperand::MOVolatile);
24922513
25292550 const Value *IRGuard = TLI.getSDagStackGuard(M);
25302551 SDValue GuardPtr = getValue(IRGuard);
25312552
2532 Guard =
2533 DAG.getLoad(PtrTy, dl, Chain, GuardPtr, MachinePointerInfo(IRGuard, 0),
2534 Align, MachineMemOperand::MOVolatile);
2553 Guard = DAG.getLoad(PtrMemTy, dl, Chain, GuardPtr,
2554 MachinePointerInfo(IRGuard, 0), Align,
2555 MachineMemOperand::MOVolatile);
25352556 }
25362557
25372558 // Perform the comparison via a subtract/getsetcc.
31963217 SDValue Op2 = getValue(I.getOperand(1));
31973218 ISD::CondCode Opcode = getICmpCondCode(predicate);
31983219
3220 auto &TLI = DAG.getTargetLoweringInfo();
3221 EVT MemVT =
3222 TLI.getMemValueType(DAG.getDataLayout(), I.getOperand(0)->getType());
3223
3224 // If a pointer's DAG type is larger than its memory type then the DAG values
3225 // are zero-extended. This breaks signed comparisons so truncate back to the
3226 // underlying type before doing the compare.
3227 if (Op1.getValueType() != MemVT) {
3228 Op1 = DAG.getPtrExtOrTrunc(Op1, getCurSDLoc(), MemVT);
3229 Op2 = DAG.getPtrExtOrTrunc(Op2, getCurSDLoc(), MemVT);
3230 }
3231
31993232 EVT DestVT = DAG.getTargetLoweringInfo().getValueType(DAG.getDataLayout(),
32003233 I.getType());
32013234 setValue(&I, DAG.getSetCC(getCurSDLoc(), DestVT, Op1, Op2, Opcode));
34383471 // What to do depends on the size of the integer and the size of the pointer.
34393472 // We can either truncate, zero extend, or no-op, accordingly.
34403473 SDValue N = getValue(I.getOperand(0));
3474 auto &TLI = DAG.getTargetLoweringInfo();
34413475 EVT DestVT = DAG.getTargetLoweringInfo().getValueType(DAG.getDataLayout(),
34423476 I.getType());
3443 setValue(&I, DAG.getZExtOrTrunc(N, getCurSDLoc(), DestVT));
3477 EVT PtrMemVT =
3478 TLI.getMemValueType(DAG.getDataLayout(), I.getOperand(0)->getType());
3479 N = DAG.getPtrExtOrTrunc(N, getCurSDLoc(), PtrMemVT);
3480 N = DAG.getZExtOrTrunc(N, getCurSDLoc(), DestVT);
3481 setValue(&I, N);
34443482 }
34453483
34463484 void SelectionDAGBuilder::visitIntToPtr(const User &I) {
34473485 // What to do depends on the size of the integer and the size of the pointer.
34483486 // We can either truncate, zero extend, or no-op, accordingly.
34493487 SDValue N = getValue(I.getOperand(0));
3450 EVT DestVT = DAG.getTargetLoweringInfo().getValueType(DAG.getDataLayout(),
3451 I.getType());
3452 setValue(&I, DAG.getZExtOrTrunc(N, getCurSDLoc(), DestVT));
3488 auto &TLI = DAG.getTargetLoweringInfo();
3489 EVT DestVT = TLI.getValueType(DAG.getDataLayout(), I.getType());
3490 EVT PtrMemVT = TLI.getMemValueType(DAG.getDataLayout(), I.getType());
3491 N = DAG.getZExtOrTrunc(N, getCurSDLoc(), PtrMemVT);
3492 N = DAG.getPtrExtOrTrunc(N, getCurSDLoc(), DestVT);
3493 setValue(&I, N);
34533494 }
34543495
34553496 void SelectionDAGBuilder::visitBitCast(const User &I) {
38013842 unsigned AS = Op0->getType()->getScalarType()->getPointerAddressSpace();
38023843 SDValue N = getValue(Op0);
38033844 SDLoc dl = getCurSDLoc();
3845 auto &TLI = DAG.getTargetLoweringInfo();
3846 MVT PtrTy = TLI.getPointerTy(DAG.getDataLayout(), AS);
3847 MVT PtrMemTy = TLI.getPointerMemTy(DAG.getDataLayout(), AS);
38043848
38053849 // Normalize Vector GEP - all scalar operands should be converted to the
38063850 // splat vector.
38573901 SDNodeFlags Flags;
38583902 if (Offs.isNonNegative() && cast(I).isInBounds())
38593903 Flags.setNoUnsignedWrap(true);
3904
3905 OffsVal = DAG.getSExtOrTrunc(OffsVal, dl, N.getValueType());
38603906
38613907 N = DAG.getNode(ISD::ADD, dl, N.getValueType(), N, OffsVal, Flags);
38623908 continue;
38833929 N.getValueType(), IdxN,
38843930 DAG.getConstant(Amt, dl, IdxN.getValueType()));
38853931 } else {
3886 SDValue Scale = DAG.getConstant(ElementSize, dl, IdxN.getValueType());
3932 SDValue Scale = DAG.getConstant(ElementSize.getZExtValue(), dl,
3933 IdxN.getValueType());
38873934 IdxN = DAG.getNode(ISD::MUL, dl,
38883935 N.getValueType(), IdxN, Scale);
38893936 }
38933940 N.getValueType(), N, IdxN);
38943941 }
38953942 }
3943
3944 if (PtrMemTy != PtrTy && !cast(I).isInBounds())
3945 N = DAG.getPtrExtendInReg(N, dl, PtrMemTy);
38963946
38973947 setValue(&I, N);
38983948 }
39854035 I.getAAMetadata(AAInfo);
39864036 const MDNode *Ranges = I.getMetadata(LLVMContext::MD_range);
39874037
3988 SmallVector ValueVTs;
4038 SmallVector ValueVTs, MemVTs;
39894039 SmallVector Offsets;
3990 ComputeValueVTs(TLI, DAG.getDataLayout(), Ty, ValueVTs, &Offsets);
4040 ComputeValueVTs(TLI, DAG.getDataLayout(), Ty, ValueVTs, &MemVTs, &Offsets);
39914041 unsigned NumValues = ValueVTs.size();
39924042 if (NumValues == 0)
39934043 return;
40534103 MMOFlags |= MachineMemOperand::MODereferenceable;
40544104 MMOFlags |= TLI.getMMOFlags(I);
40554105
4056 SDValue L = DAG.getLoad(ValueVTs[i], dl, Root, A,
4106 SDValue L = DAG.getLoad(MemVTs[i], dl, Root, A,
40574107 MachinePointerInfo(SV, Offsets[i]), Alignment,
40584108 MMOFlags, AAInfo, Ranges);
4109 Chains[ChainI] = L.getValue(1);
4110
4111 if (MemVTs[i] != ValueVTs[i])
4112 L = DAG.getZExtOrTrunc(L, dl, ValueVTs[i]);
40594113
40604114 Values[i] = L;
4061 Chains[ChainI] = L.getValue(1);
40624115 }
40634116
40644117 if (!ConstantMemory) {
41574210 }
41584211 }
41594212
4160 SmallVector ValueVTs;
4213 SmallVector ValueVTs, MemVTs;
41614214 SmallVector Offsets;
41624215 ComputeValueVTs(DAG.getTargetLoweringInfo(), DAG.getDataLayout(),
4163 SrcV->getType(), ValueVTs, &Offsets);
4216 SrcV->getType(), ValueVTs, &MemVTs, &Offsets);
41644217 unsigned NumValues = ValueVTs.size();
41654218 if (NumValues == 0)
41664219 return;
42024255 }
42034256 SDValue Add = DAG.getNode(ISD::ADD, dl, PtrVT, Ptr,
42044257 DAG.getConstant(Offsets[i], dl, PtrVT), Flags);
4205 SDValue St = DAG.getStore(
4206 Root, dl, SDValue(Src.getNode(), Src.getResNo() + i), Add,
4207 MachinePointerInfo(PtrV, Offsets[i]), Alignment, MMOFlags, AAInfo);
4258 SDValue Val = SDValue(Src.getNode(), Src.getResNo() + i);
4259 if (MemVTs[i] != ValueVTs[i])
4260 Val = DAG.getPtrExtOrTrunc(Val, dl, MemVTs[i]);
4261 SDValue St =
4262 DAG.getStore(Root, dl, Val, Add, MachinePointerInfo(PtrV, Offsets[i]),
4263 Alignment, MMOFlags, AAInfo);
42084264 Chains[ChainI] = St;
42094265 }
42104266
45894645
45904646 const TargetLowering &TLI = DAG.getTargetLoweringInfo();
45914647 EVT VT = TLI.getValueType(DAG.getDataLayout(), I.getType());
4648 EVT MemVT = TLI.getMemValueType(DAG.getDataLayout(), I.getType());
45924649
45934650 if (!TLI.supportsUnalignedAtomics() &&
4594 I.getAlignment() < VT.getStoreSize())
4651 I.getAlignment() < MemVT.getSizeInBits() / 8)
45954652 report_fatal_error("Cannot generate unaligned atomic load");
45964653
45974654 auto Flags = MachineMemOperand::MOLoad;
46074664 MachineMemOperand *MMO =
46084665 DAG.getMachineFunction().
46094666 getMachineMemOperand(MachinePointerInfo(I.getPointerOperand()),
4610 Flags, VT.getStoreSize(),
4667 Flags, MemVT.getStoreSize(),
46114668 I.getAlignment() ? I.getAlignment() :
4612 DAG.getEVTAlignment(VT),
4669 DAG.getEVTAlignment(MemVT),
46134670 AAMDNodes(), nullptr, SSID, Order);
46144671
46154672 InChain = TLI.prepareVolatileOrAtomicLoad(InChain, dl, DAG);
46164673 SDValue L =
4617 DAG.getAtomic(ISD::ATOMIC_LOAD, dl, VT, VT, InChain,
4674 DAG.getAtomic(ISD::ATOMIC_LOAD, dl, MemVT, MemVT, InChain,
46184675 getValue(I.getPointerOperand()), MMO);
46194676
46204677 SDValue OutChain = L.getValue(1);
4678 if (MemVT != VT)
4679 L = DAG.getPtrExtOrTrunc(L, dl, VT);
46214680
46224681 setValue(&I, L);
46234682 DAG.setRoot(OutChain);
46324691 SDValue InChain = getRoot();
46334692
46344693 const TargetLowering &TLI = DAG.getTargetLoweringInfo();
4635 EVT VT =
4636 TLI.getValueType(DAG.getDataLayout(), I.getValueOperand()->getType());
4637
4638 if (I.getAlignment() < VT.getStoreSize())
4694 EVT MemVT =
4695 TLI.getMemValueType(DAG.getDataLayout(), I.getValueOperand()->getType());
4696
4697 if (I.getAlignment() < MemVT.getSizeInBits() / 8)
46394698 report_fatal_error("Cannot generate unaligned atomic store");
46404699
46414700 auto Flags = MachineMemOperand::MOStore;
46464705 MachineFunction &MF = DAG.getMachineFunction();
46474706 MachineMemOperand *MMO =
46484707 MF.getMachineMemOperand(MachinePointerInfo(I.getPointerOperand()), Flags,
4649 VT.getStoreSize(), I.getAlignment(), AAMDNodes(),
4708 MemVT.getStoreSize(), I.getAlignment(), AAMDNodes(),
46504709 nullptr, SSID, Ordering);
4651 SDValue OutChain =
4652 DAG.getAtomic(ISD::ATOMIC_STORE, dl, VT, InChain,
4653 getValue(I.getPointerOperand()), getValue(I.getValueOperand()),
4654 MMO);
4710
4711 SDValue Val = DAG.getPtrExtOrTrunc(getValue(I.getValueOperand()), dl, MemVT);
4712 SDValue OutChain = DAG.getAtomic(ISD::ATOMIC_STORE, dl, MemVT, InChain,
4713 getValue(I.getPointerOperand()), Val, MMO);
46554714
46564715
46574716 DAG.setRoot(OutChain);
62256284 EVT ResTy = TLI.getValueType(DAG.getDataLayout(), I.getType());
62266285 // Result type for @llvm.get.dynamic.area.offset should match PtrTy for
62276286 // target.
6228 if (PtrTy != ResTy)
6287 if (PtrTy.getSizeInBits() < ResTy.getSizeInBits())
62296288 report_fatal_error("Wrong result type for @llvm.get.dynamic.area.offset"
62306289 " intrinsic!");
62316290 Res = DAG.getNode(ISD::GET_DYNAMIC_AREA_OFFSET, sdl, DAG.getVTList(ResTy),
76887747 MachineFunction &MF = DAG.getMachineFunction();
76897748 int SSFI = MF.getFrameInfo().CreateStackObject(TySize, Align, false);
76907749 SDValue StackSlot = DAG.getFrameIndex(SSFI, TLI.getFrameIndexTy(DL));
7691 Chain = DAG.getStore(Chain, Location, OpInfo.CallOperand, StackSlot,
7692 MachinePointerInfo::getFixedStack(MF, SSFI));
7750 Chain = DAG.getTruncStore(Chain, Location, OpInfo.CallOperand, StackSlot,
7751 MachinePointerInfo::getFixedStack(MF, SSFI),
7752 TLI.getMemValueType(DL, Ty));
76937753 OpInfo.CallOperand = StackSlot;
76947754
76957755 return Chain;
83418401 void SelectionDAGBuilder::visitVAArg(const VAArgInst &I) {
83428402 const TargetLowering &TLI = DAG.getTargetLoweringInfo();
83438403 const DataLayout &DL = DAG.getDataLayout();
8344 SDValue V = DAG.getVAArg(TLI.getValueType(DAG.getDataLayout(), I.getType()),
8345 getCurSDLoc(), getRoot(), getValue(I.getOperand(0)),
8346 DAG.getSrcValue(I.getOperand(0)),
8347 DL.getABITypeAlignment(I.getType()));
8404 SDValue V = DAG.getVAArg(
8405 TLI.getMemValueType(DAG.getDataLayout(), I.getType()), getCurSDLoc(),
8406 getRoot(), getValue(I.getOperand(0)), DAG.getSrcValue(I.getOperand(0)),
8407 DL.getABITypeAlignment(I.getType()));
8408 DAG.setRoot(V.getValue(1));
8409
8410 if (I.getType()->isPointerTy())
8411 V = DAG.getPtrExtOrTrunc(
8412 V, getCurSDLoc(), TLI.getValueType(DAG.getDataLayout(), I.getType()));
83488413 setValue(&I, V);
8349 DAG.setRoot(V.getValue(1));
83508414 }
83518415
83528416 void SelectionDAGBuilder::visitVAEnd(const CallInst &I) {