From c6acb4eb0f29aa651304ccc6221450afcce6702a Mon Sep 17 00:00:00 2001 From: Sergei Barannikov Date: Thu, 15 Sep 2022 13:42:47 -0400 Subject: [PATCH] [SDAG] Add `getCALLSEQ_END` overload taking `uint64_t`s All in-tree targets pass pointer-sized ConstantSDNodes to the method. This overload reduced amount of boilerplate code a bit. This also makes getCALLSEQ_END consistent with getCALLSEQ_START, which already takes uint64_ts. --- llvm/include/llvm/CodeGen/SelectionDAG.h | 7 +++++++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 3 +-- llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 5 ++--- llvm/lib/Target/AArch64/AArch64ISelLowering.cpp | 10 +++------- llvm/lib/Target/AMDGPU/SIISelLowering.cpp | 13 +++---------- llvm/lib/Target/ARC/ARCISelLowering.cpp | 4 +--- llvm/lib/Target/ARM/ARMISelLowering.cpp | 7 ++----- llvm/lib/Target/AVR/AVRISelLowering.cpp | 3 +-- llvm/lib/Target/BPF/BPFISelLowering.cpp | 4 +--- llvm/lib/Target/CSKY/CSKYISelLowering.cpp | 3 +-- llvm/lib/Target/Hexagon/HexagonISelLowering.cpp | 3 +-- llvm/lib/Target/Lanai/LanaiISelLowering.cpp | 6 +----- llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp | 3 +-- llvm/lib/Target/M68k/M68kISelLowering.cpp | 12 ++++-------- llvm/lib/Target/MSP430/MSP430ISelLowering.cpp | 3 +-- llvm/lib/Target/Mips/MipsISelLowering.cpp | 4 +--- llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp | 5 ++--- llvm/lib/Target/PowerPC/PPCISelLowering.cpp | 7 ++----- llvm/lib/Target/RISCV/RISCVISelLowering.cpp | 5 +---- llvm/lib/Target/Sparc/SparcISelLowering.cpp | 9 +++------ llvm/lib/Target/SystemZ/SystemZISelLowering.cpp | 5 +---- llvm/lib/Target/VE/VEISelLowering.cpp | 10 +++------- llvm/lib/Target/X86/X86ISelLowering.cpp | 16 ++++------------ llvm/lib/Target/XCore/XCoreISelLowering.cpp | 4 +--- 24 files changed, 48 insertions(+), 103 deletions(-) diff --git a/llvm/include/llvm/CodeGen/SelectionDAG.h b/llvm/include/llvm/CodeGen/SelectionDAG.h index 0d88f55..6e50b90 100644 --- a/llvm/include/llvm/CodeGen/SelectionDAG.h +++ b/llvm/include/llvm/CodeGen/SelectionDAG.h @@ -978,6 +978,13 @@ public: return getNode(ISD::CALLSEQ_END, DL, NodeTys, Ops); } + SDValue getCALLSEQ_END(SDValue Chain, uint64_t Size1, uint64_t Size2, + SDValue Glue, const SDLoc &DL) { + return getCALLSEQ_END( + Chain, getIntPtrConstant(Size1, DL, /*isTarget=*/true), + getIntPtrConstant(Size2, DL, /*isTarget=*/true), Glue, DL); + } + /// Return true if the result of this operation is always undefined. bool isUndef(unsigned Opcode, ArrayRef Ops); diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index ab60e3d..291c11c 100644 --- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -1719,8 +1719,7 @@ void SelectionDAGLegalize::ExpandDYNAMIC_STACKALLOC(SDNode* Node, DAG.getConstant(-Alignment.value(), dl, VT)); Chain = DAG.getCopyToReg(Chain, dl, SPReg, Tmp1); // Output chain - Tmp2 = DAG.getCALLSEQ_END(Chain, DAG.getIntPtrConstant(0, dl, true), - DAG.getIntPtrConstant(0, dl, true), SDValue(), dl); + Tmp2 = DAG.getCALLSEQ_END(Chain, 0, 0, SDValue(), dl); Results.push_back(Tmp1); Results.push_back(Tmp2); diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index 30ee596..14bd53b 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -9380,12 +9380,11 @@ void SelectionDAGBuilder::visitStackmap(const CallInst &CI) { assert(CI.getType()->isVoidTy() && "Stackmap cannot return a value."); - SDValue Chain, InFlag, Callee, NullPtr; + SDValue Chain, InFlag, Callee; SmallVector Ops; SDLoc DL = getCurSDLoc(); Callee = getValue(CI.getCalledOperand()); - NullPtr = DAG.getIntPtrConstant(0, DL, true); // The stackmap intrinsic only records the live variables (the arguments // passed to it) and emits NOPS (if requested). Unlike the patchpoint @@ -9428,7 +9427,7 @@ void SelectionDAGBuilder::visitStackmap(const CallInst &CI) { Chain = DAG.getNode(ISD::STACKMAP, DL, NodeTys, Ops); InFlag = Chain.getValue(1); - Chain = DAG.getCALLSEQ_END(Chain, NullPtr, NullPtr, InFlag, DL); + Chain = DAG.getCALLSEQ_END(Chain, 0, 0, InFlag, DL); // Stackmaps don't generate values, so nothing goes into the NodeMap. diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp index 944c8ba..f1c48f9 100644 --- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp +++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp @@ -7050,8 +7050,7 @@ AArch64TargetLowering::LowerCall(CallLoweringInfo &CLI, // we've carefully laid out the parameters so that when sp is reset they'll be // in the correct location. if (IsTailCall && !IsSibCall) { - Chain = DAG.getCALLSEQ_END(Chain, DAG.getIntPtrConstant(0, DL, true), - DAG.getIntPtrConstant(0, DL, true), InFlag, DL); + Chain = DAG.getCALLSEQ_END(Chain, 0, 0, InFlag, DL); InFlag = Chain.getValue(1); } @@ -7142,9 +7141,7 @@ AArch64TargetLowering::LowerCall(CallLoweringInfo &CLI, uint64_t CalleePopBytes = DoesCalleeRestoreStack(CallConv, TailCallOpt) ? alignTo(NumBytes, 16) : 0; - Chain = DAG.getCALLSEQ_END(Chain, DAG.getIntPtrConstant(NumBytes, DL, true), - DAG.getIntPtrConstant(CalleePopBytes, DL, true), - InFlag, DL); + Chain = DAG.getCALLSEQ_END(Chain, NumBytes, CalleePopBytes, InFlag, DL); if (!Ins.empty()) InFlag = Chain.getValue(1); @@ -12583,8 +12580,7 @@ AArch64TargetLowering::LowerDYNAMIC_STACKALLOC(SDValue Op, DAG.getConstant(-(uint64_t)Align->value(), dl, VT)); Chain = DAG.getCopyToReg(Chain, dl, AArch64::SP, SP); - Chain = DAG.getCALLSEQ_END(Chain, DAG.getIntPtrConstant(0, dl, true), - DAG.getIntPtrConstant(0, dl, true), SDValue(), dl); + Chain = DAG.getCALLSEQ_END(Chain, 0, 0, SDValue(), dl); SDValue Ops[2] = {SP, Chain}; return DAG.getMergeValues(Ops, dl); diff --git a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp index 3979ff1..23278a9 100644 --- a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp +++ b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp @@ -3296,10 +3296,7 @@ SDValue SITargetLowering::LowerCall(CallLoweringInfo &CLI, // we've carefully laid out the parameters so that when sp is reset they'll be // in the correct location. if (IsTailCall && !IsSibCall) { - Chain = DAG.getCALLSEQ_END(Chain, - DAG.getTargetConstant(NumBytes, DL, MVT::i32), - DAG.getTargetConstant(0, DL, MVT::i32), - InFlag, DL); + Chain = DAG.getCALLSEQ_END(Chain, NumBytes, 0, InFlag, DL); InFlag = Chain.getValue(1); } @@ -3354,9 +3351,7 @@ SDValue SITargetLowering::LowerCall(CallLoweringInfo &CLI, InFlag = Call.getValue(1); uint64_t CalleePopBytes = NumBytes; - Chain = DAG.getCALLSEQ_END(Chain, DAG.getTargetConstant(0, DL, MVT::i32), - DAG.getTargetConstant(CalleePopBytes, DL, MVT::i32), - InFlag, DL); + Chain = DAG.getCALLSEQ_END(Chain, 0, CalleePopBytes, InFlag, DL); if (!Ins.empty()) InFlag = Chain.getValue(1); @@ -3411,9 +3406,7 @@ SDValue SITargetLowering::lowerDYNAMIC_STACKALLOCImpl( } Chain = DAG.getCopyToReg(Chain, dl, SPReg, Tmp1); // Output chain - Tmp2 = DAG.getCALLSEQ_END( - Chain, DAG.getIntPtrConstant(0, dl, true), - DAG.getIntPtrConstant(0, dl, true), SDValue(), dl); + Tmp2 = DAG.getCALLSEQ_END(Chain, 0, 0, SDValue(), dl); return DAG.getMergeValues({Tmp1, Tmp2}, dl); } diff --git a/llvm/lib/Target/ARC/ARCISelLowering.cpp b/llvm/lib/Target/ARC/ARCISelLowering.cpp index 2160d18..ad63e0c 100644 --- a/llvm/lib/Target/ARC/ARCISelLowering.cpp +++ b/llvm/lib/Target/ARC/ARCISelLowering.cpp @@ -288,7 +288,6 @@ SDValue ARCTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI, // Get a count of how many bytes are to be pushed on the stack. unsigned NumBytes = RetCCInfo.getNextStackOffset(); - auto PtrVT = getPointerTy(DAG.getDataLayout()); Chain = DAG.getCALLSEQ_START(Chain, NumBytes, 0, dl); @@ -392,8 +391,7 @@ SDValue ARCTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI, Glue = Chain.getValue(1); // Create the CALLSEQ_END node. - Chain = DAG.getCALLSEQ_END(Chain, DAG.getConstant(NumBytes, dl, PtrVT, true), - DAG.getConstant(0, dl, PtrVT, true), Glue, dl); + Chain = DAG.getCALLSEQ_END(Chain, NumBytes, 0, Glue, dl); Glue = Chain.getValue(1); // Handle result values, copying them out of physregs into vregs that we diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp index a113108..0cc97e3 100644 --- a/llvm/lib/Target/ARM/ARMISelLowering.cpp +++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp @@ -2778,8 +2778,7 @@ ARMTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI, // we've carefully laid out the parameters so that when sp is reset they'll be // in the correct location. if (isTailCall && !isSibCall) { - Chain = DAG.getCALLSEQ_END(Chain, DAG.getIntPtrConstant(0, dl, true), - DAG.getIntPtrConstant(0, dl, true), InFlag, dl); + Chain = DAG.getCALLSEQ_END(Chain, 0, 0, InFlag, dl); InFlag = Chain.getValue(1); } @@ -2840,9 +2839,7 @@ ARMTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI, uint64_t CalleePopBytes = canGuaranteeTCO(CallConv, TailCallOpt) ? alignTo(NumBytes, 16) : -1ULL; - Chain = DAG.getCALLSEQ_END(Chain, DAG.getIntPtrConstant(NumBytes, dl, true), - DAG.getIntPtrConstant(CalleePopBytes, dl, true), - InFlag, dl); + Chain = DAG.getCALLSEQ_END(Chain, NumBytes, CalleePopBytes, InFlag, dl); if (!Ins.empty()) InFlag = Chain.getValue(1); diff --git a/llvm/lib/Target/AVR/AVRISelLowering.cpp b/llvm/lib/Target/AVR/AVRISelLowering.cpp index 8f7fa72..0e8b512 100644 --- a/llvm/lib/Target/AVR/AVRISelLowering.cpp +++ b/llvm/lib/Target/AVR/AVRISelLowering.cpp @@ -1520,8 +1520,7 @@ SDValue AVRTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI, InFlag = Chain.getValue(1); // Create the CALLSEQ_END node. - Chain = DAG.getCALLSEQ_END(Chain, DAG.getIntPtrConstant(NumBytes, DL, true), - DAG.getIntPtrConstant(0, DL, true), InFlag, DL); + Chain = DAG.getCALLSEQ_END(Chain, NumBytes, 0, InFlag, DL); if (!Ins.empty()) { InFlag = Chain.getValue(1); diff --git a/llvm/lib/Target/BPF/BPFISelLowering.cpp b/llvm/lib/Target/BPF/BPFISelLowering.cpp index 16876e7..c5666b3 100644 --- a/llvm/lib/Target/BPF/BPFISelLowering.cpp +++ b/llvm/lib/Target/BPF/BPFISelLowering.cpp @@ -486,9 +486,7 @@ SDValue BPFTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI, InFlag = Chain.getValue(1); // Create the CALLSEQ_END node. - Chain = DAG.getCALLSEQ_END( - Chain, DAG.getConstant(NumBytes, CLI.DL, PtrVT, true), - DAG.getConstant(0, CLI.DL, PtrVT, true), InFlag, CLI.DL); + Chain = DAG.getCALLSEQ_END(Chain, NumBytes, 0, InFlag, CLI.DL); InFlag = Chain.getValue(1); // Handle result values, copying them out of physregs into vregs that we diff --git a/llvm/lib/Target/CSKY/CSKYISelLowering.cpp b/llvm/lib/Target/CSKY/CSKYISelLowering.cpp index 012de34..eaf64c5 100644 --- a/llvm/lib/Target/CSKY/CSKYISelLowering.cpp +++ b/llvm/lib/Target/CSKY/CSKYISelLowering.cpp @@ -702,8 +702,7 @@ SDValue CSKYTargetLowering::LowerCall(CallLoweringInfo &CLI, Glue = Chain.getValue(1); // Mark the end of the call, which is glued to the call itself. - Chain = DAG.getCALLSEQ_END(Chain, DAG.getConstant(NumBytes, DL, PtrVT, true), - DAG.getConstant(0, DL, PtrVT, true), Glue, DL); + Chain = DAG.getCALLSEQ_END(Chain, NumBytes, 0, Glue, DL); Glue = Chain.getValue(1); // Assign locations to each value returned by this call. diff --git a/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp b/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp index f9bd442..f3e1239 100644 --- a/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp +++ b/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp @@ -612,8 +612,7 @@ HexagonTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI, Glue = Chain.getValue(1); // Create the CALLSEQ_END node. - Chain = DAG.getCALLSEQ_END(Chain, DAG.getIntPtrConstant(NumBytes, dl, true), - DAG.getIntPtrConstant(0, dl, true), Glue, dl); + Chain = DAG.getCALLSEQ_END(Chain, NumBytes, 0, Glue, dl); Glue = Chain.getValue(1); // Handle result values, copying them out of physregs into vregs that we diff --git a/llvm/lib/Target/Lanai/LanaiISelLowering.cpp b/llvm/lib/Target/Lanai/LanaiISelLowering.cpp index 832cafb..b80c68e 100644 --- a/llvm/lib/Target/Lanai/LanaiISelLowering.cpp +++ b/llvm/lib/Target/Lanai/LanaiISelLowering.cpp @@ -761,11 +761,7 @@ SDValue LanaiTargetLowering::LowerCCCCallTo( InFlag = Chain.getValue(1); // Create the CALLSEQ_END node. - Chain = DAG.getCALLSEQ_END( - Chain, - DAG.getConstant(NumBytes, DL, getPointerTy(DAG.getDataLayout()), true), - DAG.getConstant(0, DL, getPointerTy(DAG.getDataLayout()), true), InFlag, - DL); + Chain = DAG.getCALLSEQ_END(Chain, NumBytes, 0, InFlag, DL); InFlag = Chain.getValue(1); // Handle result values, copying them out of physregs into vregs that we diff --git a/llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp b/llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp index 113f8b2..df55dfd 100644 --- a/llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp +++ b/llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp @@ -1664,8 +1664,7 @@ LoongArchTargetLowering::LowerCall(CallLoweringInfo &CLI, Glue = Chain.getValue(1); // Mark the end of the call, which is glued to the call itself. - Chain = DAG.getCALLSEQ_END(Chain, DAG.getConstant(NumBytes, DL, PtrVT, true), - DAG.getConstant(0, DL, PtrVT, true), Glue, DL); + Chain = DAG.getCALLSEQ_END(Chain, NumBytes, 0, Glue, DL); Glue = Chain.getValue(1); // Assign locations to each value returned by this call. diff --git a/llvm/lib/Target/M68k/M68kISelLowering.cpp b/llvm/lib/Target/M68k/M68kISelLowering.cpp index 3cc0c7f..82b4e7a 100644 --- a/llvm/lib/Target/M68k/M68kISelLowering.cpp +++ b/llvm/lib/Target/M68k/M68kISelLowering.cpp @@ -765,9 +765,7 @@ SDValue M68kTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI, SmallVector Ops; if (!IsSibcall && IsTailCall) { - Chain = DAG.getCALLSEQ_END(Chain, - DAG.getIntPtrConstant(NumBytesToPop, DL, true), - DAG.getIntPtrConstant(0, DL, true), InFlag, DL); + Chain = DAG.getCALLSEQ_END(Chain, NumBytesToPop, 0, InFlag, DL); InFlag = Chain.getValue(1); } @@ -821,9 +819,8 @@ SDValue M68kTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI, // Returns a flag for retval copy to use. if (!IsSibcall) { - Chain = DAG.getCALLSEQ_END( - Chain, DAG.getIntPtrConstant(NumBytesToPop, DL, true), - DAG.getIntPtrConstant(NumBytesForCalleeToPop, DL, true), InFlag, DL); + Chain = DAG.getCALLSEQ_END(Chain, NumBytesToPop, NumBytesForCalleeToPop, + InFlag, DL); InFlag = Chain.getValue(1); } @@ -3241,8 +3238,7 @@ SDValue M68kTargetLowering::LowerDYNAMIC_STACKALLOC(SDValue Op, Chain = DAG.getCopyToReg(Chain, DL, SPReg, Result); // Output chain } - Chain = DAG.getCALLSEQ_END(Chain, DAG.getIntPtrConstant(0, DL, true), - DAG.getIntPtrConstant(0, DL, true), SDValue(), DL); + Chain = DAG.getCALLSEQ_END(Chain, 0, 0, SDValue(), DL); SDValue Ops[2] = {Result, Chain}; return DAG.getMergeValues(Ops, DL); diff --git a/llvm/lib/Target/MSP430/MSP430ISelLowering.cpp b/llvm/lib/Target/MSP430/MSP430ISelLowering.cpp index 334ba26..76653f3 100644 --- a/llvm/lib/Target/MSP430/MSP430ISelLowering.cpp +++ b/llvm/lib/Target/MSP430/MSP430ISelLowering.cpp @@ -919,8 +919,7 @@ SDValue MSP430TargetLowering::LowerCCCCallTo( InFlag = Chain.getValue(1); // Create the CALLSEQ_END node. - Chain = DAG.getCALLSEQ_END(Chain, DAG.getConstant(NumBytes, dl, PtrVT, true), - DAG.getConstant(0, dl, PtrVT, true), InFlag, dl); + Chain = DAG.getCALLSEQ_END(Chain, NumBytes, 0, InFlag, dl); InFlag = Chain.getValue(1); // Handle result values, copying them out of physregs into vregs that we diff --git a/llvm/lib/Target/Mips/MipsISelLowering.cpp b/llvm/lib/Target/Mips/MipsISelLowering.cpp index 3aee676..521bd6a 100644 --- a/llvm/lib/Target/Mips/MipsISelLowering.cpp +++ b/llvm/lib/Target/Mips/MipsISelLowering.cpp @@ -3250,7 +3250,6 @@ MipsTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI, // byval arguments to the stack. unsigned StackAlignment = TFL->getStackAlignment(); NextStackOffset = alignTo(NextStackOffset, StackAlignment); - SDValue NextStackOffsetVal = DAG.getIntPtrConstant(NextStackOffset, DL, true); if (!(IsTailCall || MemcpyInByVal)) Chain = DAG.getCALLSEQ_START(Chain, NextStackOffset, 0, DL); @@ -3481,8 +3480,7 @@ MipsTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI, // Create the CALLSEQ_END node in the case of where it is not a call to // memcpy. if (!(MemcpyInByVal)) { - Chain = DAG.getCALLSEQ_END(Chain, NextStackOffsetVal, - DAG.getIntPtrConstant(0, DL, true), InFlag, DL); + Chain = DAG.getCALLSEQ_END(Chain, NextStackOffset, 0, InFlag, DL); InFlag = Chain.getValue(1); } diff --git a/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp b/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp index ab2340f..f8d581f 100644 --- a/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp +++ b/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp @@ -1891,9 +1891,8 @@ SDValue NVPTXTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI, } } - Chain = DAG.getCALLSEQ_END( - Chain, DAG.getIntPtrConstant(UniqueCallSite, dl, true), - DAG.getIntPtrConstant(UniqueCallSite + 1, dl, true), InFlag, dl); + Chain = + DAG.getCALLSEQ_END(Chain, UniqueCallSite, UniqueCallSite + 1, InFlag, dl); InFlag = Chain.getValue(1); // Append ProxyReg instructions to the chain to make sure that `callseq_end` diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp index 0366c08..a139532 100644 --- a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp +++ b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp @@ -5109,8 +5109,7 @@ PrepareTailCall(SelectionDAG &DAG, SDValue &InFlag, SDValue &Chain, Chain = EmitTailCallStoreFPAndRetAddr(DAG, Chain, LROp, FPOp, SPDiff, dl); // Emit callseq_end just before tailcall node. - Chain = DAG.getCALLSEQ_END(Chain, DAG.getIntPtrConstant(NumBytes, dl, true), - DAG.getIntPtrConstant(0, dl, true), InFlag, dl); + Chain = DAG.getCALLSEQ_END(Chain, NumBytes, 0, InFlag, dl); InFlag = Chain.getValue(1); } @@ -5621,9 +5620,7 @@ SDValue PPCTargetLowering::FinishCall( ? NumBytes : 0; - Chain = DAG.getCALLSEQ_END(Chain, DAG.getIntPtrConstant(NumBytes, dl, true), - DAG.getIntPtrConstant(BytesCalleePops, dl, true), - Glue, dl); + Chain = DAG.getCALLSEQ_END(Chain, NumBytes, BytesCalleePops, Glue, dl); Glue = Chain.getValue(1); return LowerCallResult(Chain, Glue, CFlags.CallConv, CFlags.IsVarArg, Ins, dl, diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp index ed58a2e..1d5cd3e 100644 --- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp +++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp @@ -12054,10 +12054,7 @@ SDValue RISCVTargetLowering::LowerCall(CallLoweringInfo &CLI, Glue = Chain.getValue(1); // Mark the end of the call, which is glued to the call itself. - Chain = DAG.getCALLSEQ_END(Chain, - DAG.getConstant(NumBytes, DL, PtrVT, true), - DAG.getConstant(0, DL, PtrVT, true), - Glue, DL); + Chain = DAG.getCALLSEQ_END(Chain, NumBytes, 0, Glue, DL); Glue = Chain.getValue(1); // Assign locations to each value returned by this call. diff --git a/llvm/lib/Target/Sparc/SparcISelLowering.cpp b/llvm/lib/Target/Sparc/SparcISelLowering.cpp index 2cb74e7..184722e 100644 --- a/llvm/lib/Target/Sparc/SparcISelLowering.cpp +++ b/llvm/lib/Target/Sparc/SparcISelLowering.cpp @@ -1018,8 +1018,7 @@ SparcTargetLowering::LowerCall_32(TargetLowering::CallLoweringInfo &CLI, Chain = DAG.getNode(SPISD::CALL, dl, NodeTys, Ops); InFlag = Chain.getValue(1); - Chain = DAG.getCALLSEQ_END(Chain, DAG.getIntPtrConstant(ArgsSize, dl, true), - DAG.getIntPtrConstant(0, dl, true), InFlag, dl); + Chain = DAG.getCALLSEQ_END(Chain, ArgsSize, 0, InFlag, dl); InFlag = Chain.getValue(1); // Assign locations to each value returned by this call. @@ -1324,8 +1323,7 @@ SparcTargetLowering::LowerCall_64(TargetLowering::CallLoweringInfo &CLI, InGlue = Chain.getValue(1); // Revert the stack pointer immediately after the call. - Chain = DAG.getCALLSEQ_END(Chain, DAG.getIntPtrConstant(ArgsSize, DL, true), - DAG.getIntPtrConstant(0, DL, true), InGlue, DL); + Chain = DAG.getCALLSEQ_END(Chain, ArgsSize, 0, InGlue, DL); InGlue = Chain.getValue(1); // Now extract the return values. This is more or less the same as @@ -2125,8 +2123,7 @@ SDValue SparcTargetLowering::LowerGlobalTLSAddress(SDValue Op, InFlag}; Chain = DAG.getNode(SPISD::TLS_CALL, DL, NodeTys, Ops); InFlag = Chain.getValue(1); - Chain = DAG.getCALLSEQ_END(Chain, DAG.getIntPtrConstant(1, DL, true), - DAG.getIntPtrConstant(0, DL, true), InFlag, DL); + Chain = DAG.getCALLSEQ_END(Chain, 1, 0, InFlag, DL); InFlag = Chain.getValue(1); SDValue Ret = DAG.getCopyFromReg(Chain, DL, SP::O0, PtrVT, InFlag); diff --git a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp index 5cb3f03..7614cd2 100644 --- a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp +++ b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp @@ -1854,10 +1854,7 @@ SystemZTargetLowering::LowerCall(CallLoweringInfo &CLI, Glue = Chain.getValue(1); // Mark the end of the call, which is glued to the call itself. - Chain = DAG.getCALLSEQ_END(Chain, - DAG.getConstant(NumBytes, DL, PtrVT, true), - DAG.getConstant(0, DL, PtrVT, true), - Glue, DL); + Chain = DAG.getCALLSEQ_END(Chain, NumBytes, 0, Glue, DL); Glue = Chain.getValue(1); // Assign locations to each value returned by this call. diff --git a/llvm/lib/Target/VE/VEISelLowering.cpp b/llvm/lib/Target/VE/VEISelLowering.cpp index 75e3c97..f013984 100644 --- a/llvm/lib/Target/VE/VEISelLowering.cpp +++ b/llvm/lib/Target/VE/VEISelLowering.cpp @@ -768,8 +768,7 @@ SDValue VETargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI, InGlue = Chain.getValue(1); // Revert the stack pointer immediately after the call. - Chain = DAG.getCALLSEQ_END(Chain, DAG.getIntPtrConstant(ArgsSize, DL, true), - DAG.getIntPtrConstant(0, DL, true), InGlue, DL); + Chain = DAG.getCALLSEQ_END(Chain, ArgsSize, 0, InGlue, DL); InGlue = Chain.getValue(1); // Now extract the return values. This is more or less the same as @@ -1274,9 +1273,7 @@ VETargetLowering::lowerToTLSGeneralDynamicModel(SDValue Op, Chain = DAG.getCALLSEQ_START(Chain, 64, 0, DL); SDValue Args[] = {Chain, Label, DAG.getRegisterMask(Mask), Chain.getValue(1)}; Chain = DAG.getNode(VEISD::GETTLSADDR, DL, NodeTys, Args); - Chain = DAG.getCALLSEQ_END(Chain, DAG.getIntPtrConstant(64, DL, true), - DAG.getIntPtrConstant(0, DL, true), - Chain.getValue(1), DL); + Chain = DAG.getCALLSEQ_END(Chain, 64, 0, Chain.getValue(1), DL); Chain = DAG.getCopyFromReg(Chain, DL, VE::SX0, PtrVT, Chain.getValue(1)); // GETTLSADDR will be codegen'ed as call. Inform MFI that function has calls. @@ -1680,8 +1677,7 @@ SDValue VETargetLowering::lowerDYNAMIC_STACKALLOC(SDValue Op, DAG.getConstant(~(Alignment->value() - 1ULL), DL, VT)); } // Chain = Result.getValue(1); - Chain = DAG.getCALLSEQ_END(Chain, DAG.getIntPtrConstant(0, DL, true), - DAG.getIntPtrConstant(0, DL, true), SDValue(), DL); + Chain = DAG.getCALLSEQ_END(Chain, 0, 0, SDValue(), DL); SDValue Ops[2] = {Result, Chain}; return DAG.getMergeValues(Ops, DL); diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index b4b1122..7abdef5 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -4753,9 +4753,7 @@ X86TargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI, SmallVector Ops; if (!IsSibcall && isTailCall && !IsMustTail) { - Chain = DAG.getCALLSEQ_END(Chain, - DAG.getIntPtrConstant(NumBytesToPop, dl, true), - DAG.getIntPtrConstant(0, dl, true), InFlag, dl); + Chain = DAG.getCALLSEQ_END(Chain, NumBytesToPop, 0, InFlag, dl); InFlag = Chain.getValue(1); } @@ -4894,10 +4892,7 @@ X86TargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI, // Returns a flag for retval copy to use. if (!IsSibcall) { - Chain = DAG.getCALLSEQ_END(Chain, - DAG.getIntPtrConstant(NumBytesToPop, dl, true), - DAG.getIntPtrConstant(NumBytesForCalleeToPop, dl, - true), + Chain = DAG.getCALLSEQ_END(Chain, NumBytesToPop, NumBytesForCalleeToPop, InFlag, dl); InFlag = Chain.getValue(1); } @@ -20611,9 +20606,7 @@ X86TargetLowering::LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const { Chain = DAG.getCALLSEQ_START(Chain, 0, 0, DL); SDValue Args[] = { Chain, Offset }; Chain = DAG.getNode(X86ISD::TLSCALL, DL, NodeTys, Args); - Chain = DAG.getCALLSEQ_END(Chain, DAG.getIntPtrConstant(0, DL, true), - DAG.getIntPtrConstant(0, DL, true), - Chain.getValue(1), DL); + Chain = DAG.getCALLSEQ_END(Chain, 0, 0, Chain.getValue(1), DL); // TLSCALL will be codegen'ed as call. Inform MFI that function has calls. MachineFrameInfo &MFI = DAG.getMachineFunction().getFrameInfo(); @@ -26036,8 +26029,7 @@ X86TargetLowering::LowerDYNAMIC_STACKALLOC(SDValue Op, Result = SP; } - Chain = DAG.getCALLSEQ_END(Chain, DAG.getIntPtrConstant(0, dl, true), - DAG.getIntPtrConstant(0, dl, true), SDValue(), dl); + Chain = DAG.getCALLSEQ_END(Chain, 0, 0, SDValue(), dl); SDValue Ops[2] = {Result, Chain}; return DAG.getMergeValues(Ops, dl); diff --git a/llvm/lib/Target/XCore/XCoreISelLowering.cpp b/llvm/lib/Target/XCore/XCoreISelLowering.cpp index 84b74c9..8cc05fd 100644 --- a/llvm/lib/Target/XCore/XCoreISelLowering.cpp +++ b/llvm/lib/Target/XCore/XCoreISelLowering.cpp @@ -1128,7 +1128,6 @@ SDValue XCoreTargetLowering::LowerCCCCallTo( // Get a count of how many bytes are to be pushed on the stack. unsigned NumBytes = RetCCInfo.getNextStackOffset(); - auto PtrVT = getPointerTy(DAG.getDataLayout()); Chain = DAG.getCALLSEQ_START(Chain, NumBytes, 0, dl); @@ -1217,8 +1216,7 @@ SDValue XCoreTargetLowering::LowerCCCCallTo( InFlag = Chain.getValue(1); // Create the CALLSEQ_END node. - Chain = DAG.getCALLSEQ_END(Chain, DAG.getConstant(NumBytes, dl, PtrVT, true), - DAG.getConstant(0, dl, PtrVT, true), InFlag, dl); + Chain = DAG.getCALLSEQ_END(Chain, NumBytes, 0, InFlag, dl); InFlag = Chain.getValue(1); // Handle result values, copying them out of physregs into vregs that we -- 2.7.4