diff options
author | Nikita Popov <npopov@redhat.com> | 2025-08-15 18:06:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-08-15 18:06:07 +0200 |
commit | 01bc7421855889dcc3b10a131928e3a4a8e4b38c (patch) | |
tree | 80bbb9dd9cd8717e5d9bc654bceadad42164d907 /llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | |
parent | 1d1e52e614f95eed5ee440b43fa1992e46976629 (diff) | |
download | llvm-01bc7421855889dcc3b10a131928e3a4a8e4b38c.zip llvm-01bc7421855889dcc3b10a131928e3a4a8e4b38c.tar.gz llvm-01bc7421855889dcc3b10a131928e3a4a8e4b38c.tar.bz2 |
[CodeGen] Give ArgListEntry a proper constructor (NFC) (#153817)
This ensures that the required fields are set, and also makes the
construction more convenient.
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 115 |
1 files changed, 31 insertions, 84 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 4b7fc45..84282d8 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -2576,18 +2576,12 @@ bool SelectionDAG::expandMultipleResultFPLibCall( } TargetLowering::ArgListTy Args; - auto AddArgListEntry = [&](SDValue Node, Type *Ty) { - TargetLowering::ArgListEntry Entry{}; - Entry.Ty = Ty; - Entry.Node = Node; - Args.push_back(Entry); - }; // Pass the arguments. for (const SDValue &Op : Node->op_values()) { EVT ArgVT = Op.getValueType(); Type *ArgTy = ArgVT.getTypeForEVT(Ctx); - AddArgListEntry(Op, ArgTy); + Args.emplace_back(Op, ArgTy); } // Pass the output pointers. @@ -2599,7 +2593,7 @@ bool SelectionDAG::expandMultipleResultFPLibCall( EVT ResVT = Node->getValueType(ResNo); SDValue ResultPtr = ST ? ST->getBasePtr() : CreateStackTemporary(ResVT); ResultPtrs[ResNo] = ResultPtr; - AddArgListEntry(ResultPtr, PointerTy); + Args.emplace_back(ResultPtr, PointerTy); } SDLoc DL(Node); @@ -2608,7 +2602,7 @@ bool SelectionDAG::expandMultipleResultFPLibCall( if (VD && VD->isMasked()) { EVT MaskVT = TLI->getSetCCResultType(getDataLayout(), Ctx, VT); SDValue Mask = getBoolConstant(true, DL, MaskVT, VT); - AddArgListEntry(Mask, MaskVT.getTypeForEVT(Ctx)); + Args.emplace_back(Mask, MaskVT.getTypeForEVT(Ctx)); } Type *RetType = CallRetResNo.has_value() @@ -9019,18 +9013,11 @@ SelectionDAG::getMemcmp(SDValue Chain, const SDLoc &dl, SDValue Mem0, if (!LibCallName) return {}; - // Emit a library call. - auto GetEntry = [](Type *Ty, SDValue &SDV) { - TargetLowering::ArgListEntry E; - E.Ty = Ty; - E.Node = SDV; - return E; - }; - PointerType *PT = PointerType::getUnqual(*getContext()); TargetLowering::ArgListTy Args = { - GetEntry(PT, Mem0), GetEntry(PT, Mem1), - GetEntry(getDataLayout().getIntPtrType(*getContext()), Size)}; + {Mem0, PT}, + {Mem1, PT}, + {Size, getDataLayout().getIntPtrType(*getContext())}}; TargetLowering::CallLoweringInfo CLI(*this); bool IsTailCall = false; @@ -9101,13 +9088,10 @@ SDValue SelectionDAG::getMemcpy( // Emit a library call. TargetLowering::ArgListTy Args; - TargetLowering::ArgListEntry Entry; - Entry.Ty = PointerType::getUnqual(*getContext()); - Entry.Node = Dst; Args.push_back(Entry); - Entry.Node = Src; Args.push_back(Entry); - - Entry.Ty = getDataLayout().getIntPtrType(*getContext()); - Entry.Node = Size; Args.push_back(Entry); + Type *PtrTy = PointerType::getUnqual(*getContext()); + Args.emplace_back(Dst, PtrTy); + Args.emplace_back(Src, PtrTy); + Args.emplace_back(Size, getDataLayout().getIntPtrType(*getContext())); // FIXME: pass in SDLoc TargetLowering::CallLoweringInfo CLI(*this); bool IsTailCall = false; @@ -9145,17 +9129,10 @@ SDValue SelectionDAG::getAtomicMemcpy(SDValue Chain, const SDLoc &dl, MachinePointerInfo SrcPtrInfo) { // Emit a library call. TargetLowering::ArgListTy Args; - TargetLowering::ArgListEntry Entry; - Entry.Ty = getDataLayout().getIntPtrType(*getContext()); - Entry.Node = Dst; - Args.push_back(Entry); - - Entry.Node = Src; - Args.push_back(Entry); - - Entry.Ty = SizeTy; - Entry.Node = Size; - Args.push_back(Entry); + Type *ArgTy = getDataLayout().getIntPtrType(*getContext()); + Args.emplace_back(Dst, ArgTy); + Args.emplace_back(Src, ArgTy); + Args.emplace_back(Size, SizeTy); RTLIB::Libcall LibraryCall = RTLIB::getMEMCPY_ELEMENT_UNORDERED_ATOMIC(ElemSz); @@ -9218,13 +9195,10 @@ SDValue SelectionDAG::getMemmove(SDValue Chain, const SDLoc &dl, SDValue Dst, // Emit a library call. TargetLowering::ArgListTy Args; - TargetLowering::ArgListEntry Entry; - Entry.Ty = PointerType::getUnqual(*getContext()); - Entry.Node = Dst; Args.push_back(Entry); - Entry.Node = Src; Args.push_back(Entry); - - Entry.Ty = getDataLayout().getIntPtrType(*getContext()); - Entry.Node = Size; Args.push_back(Entry); + Type *PtrTy = PointerType::getUnqual(*getContext()); + Args.emplace_back(Dst, PtrTy); + Args.emplace_back(Src, PtrTy); + Args.emplace_back(Size, getDataLayout().getIntPtrType(*getContext())); // FIXME: pass in SDLoc TargetLowering::CallLoweringInfo CLI(*this); @@ -9262,17 +9236,10 @@ SDValue SelectionDAG::getAtomicMemmove(SDValue Chain, const SDLoc &dl, MachinePointerInfo SrcPtrInfo) { // Emit a library call. TargetLowering::ArgListTy Args; - TargetLowering::ArgListEntry Entry; - Entry.Ty = getDataLayout().getIntPtrType(*getContext()); - Entry.Node = Dst; - Args.push_back(Entry); - - Entry.Node = Src; - Args.push_back(Entry); - - Entry.Ty = SizeTy; - Entry.Node = Size; - Args.push_back(Entry); + Type *IntPtrTy = getDataLayout().getIntPtrType(*getContext()); + Args.emplace_back(Dst, IntPtrTy); + Args.emplace_back(Src, IntPtrTy); + Args.emplace_back(Size, SizeTy); RTLIB::Libcall LibraryCall = RTLIB::getMEMMOVE_ELEMENT_UNORDERED_ATOMIC(ElemSz); @@ -9349,28 +9316,20 @@ SDValue SelectionDAG::getMemset(SDValue Chain, const SDLoc &dl, SDValue Dst, const char *BzeroName = getTargetLoweringInfo().getLibcallName(RTLIB::BZERO); - // Helper function to create an Entry from Node and Type. - const auto CreateEntry = [](SDValue Node, Type *Ty) { - TargetLowering::ArgListEntry Entry; - Entry.Node = Node; - Entry.Ty = Ty; - return Entry; - }; - bool UseBZero = isNullConstant(Src) && BzeroName; // If zeroing out and bzero is present, use it. if (UseBZero) { TargetLowering::ArgListTy Args; - Args.push_back(CreateEntry(Dst, PointerType::getUnqual(Ctx))); - Args.push_back(CreateEntry(Size, DL.getIntPtrType(Ctx))); + Args.emplace_back(Dst, PointerType::getUnqual(Ctx)); + Args.emplace_back(Size, DL.getIntPtrType(Ctx)); CLI.setLibCallee( TLI->getLibcallCallingConv(RTLIB::BZERO), Type::getVoidTy(Ctx), getExternalSymbol(BzeroName, TLI->getPointerTy(DL)), std::move(Args)); } else { TargetLowering::ArgListTy Args; - Args.push_back(CreateEntry(Dst, PointerType::getUnqual(Ctx))); - Args.push_back(CreateEntry(Src, Src.getValueType().getTypeForEVT(Ctx))); - Args.push_back(CreateEntry(Size, DL.getIntPtrType(Ctx))); + Args.emplace_back(Dst, PointerType::getUnqual(Ctx)); + Args.emplace_back(Src, Src.getValueType().getTypeForEVT(Ctx)); + Args.emplace_back(Size, DL.getIntPtrType(Ctx)); CLI.setLibCallee(TLI->getLibcallCallingConv(RTLIB::MEMSET), Dst.getValueType().getTypeForEVT(Ctx), getExternalSymbol(TLI->getLibcallName(RTLIB::MEMSET), @@ -9399,18 +9358,9 @@ SDValue SelectionDAG::getAtomicMemset(SDValue Chain, const SDLoc &dl, MachinePointerInfo DstPtrInfo) { // Emit a library call. TargetLowering::ArgListTy Args; - TargetLowering::ArgListEntry Entry; - Entry.Ty = getDataLayout().getIntPtrType(*getContext()); - Entry.Node = Dst; - Args.push_back(Entry); - - Entry.Ty = Type::getInt8Ty(*getContext()); - Entry.Node = Value; - Args.push_back(Entry); - - Entry.Ty = SizeTy; - Entry.Node = Size; - Args.push_back(Entry); + Args.emplace_back(Dst, getDataLayout().getIntPtrType(*getContext())); + Args.emplace_back(Value, Type::getInt8Ty(*getContext())); + Args.emplace_back(Size, SizeTy); RTLIB::Libcall LibraryCall = RTLIB::getMEMSET_ELEMENT_UNORDERED_ATOMIC(ElemSz); @@ -14065,10 +14015,7 @@ SDValue SelectionDAG::makeStateFunctionCall(unsigned LibFunc, SDValue Ptr, const SDLoc &DLoc) { assert(InChain.getValueType() == MVT::Other && "Expected token chain"); TargetLowering::ArgListTy Args; - TargetLowering::ArgListEntry Entry; - Entry.Node = Ptr; - Entry.Ty = Ptr.getValueType().getTypeForEVT(*getContext()); - Args.push_back(Entry); + Args.emplace_back(Ptr, Ptr.getValueType().getTypeForEVT(*getContext())); RTLIB::Libcall LC = static_cast<RTLIB::Libcall>(LibFunc); SDValue Callee = getExternalSymbol(TLI->getLibcallName(LC), TLI->getPointerTy(getDataLayout())); |