Skip to content

Commit 19c6159

Browse files
committed
[SelectionDAG] Extract out populateCallLoweringInfo; NFC
SelectionDAGBuilder::populateCallLoweringInfo is now used instead of SelectionDAGBuilder::lowerCallOperands. The populateCallLoweringInfo interface is more composable in face of design changes like http://reviews.llvm.org/D18106 llvm-svn: 263663
1 parent aa0cae6 commit 19c6159

File tree

3 files changed

+31
-30
lines changed

3 files changed

+31
-30
lines changed

llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6896,16 +6896,16 @@ SDValue SelectionDAGBuilder::lowerRangeToAssertZExt(SelectionDAG &DAG,
68966896
return DAG.getMergeValues(Ops, SL);
68976897
}
68986898

6899-
/// \brief Lower an argument list according to the target calling convention.
6900-
///
6901-
/// \return A tuple of <return-value, token-chain>
6899+
/// \brief Populate a CallLowerinInfo (into \p CLI) based on the properties of
6900+
/// the call being lowered.
69026901
///
69036902
/// This is a helper for lowering intrinsics that follow a target calling
69046903
/// convention or require stack pointer adjustment. Only a subset of the
69056904
/// intrinsic's operands need to participate in the calling convention.
6906-
std::pair<SDValue, SDValue> SelectionDAGBuilder::lowerCallOperands(
6907-
ImmutableCallSite CS, unsigned ArgIdx, unsigned NumArgs, SDValue Callee,
6908-
Type *ReturnTy, const BasicBlock *EHPadBB, bool IsPatchPoint) {
6905+
void SelectionDAGBuilder::populateCallLoweringInfo(
6906+
TargetLowering::CallLoweringInfo &CLI, ImmutableCallSite CS,
6907+
unsigned ArgIdx, unsigned NumArgs, SDValue Callee, Type *ReturnTy,
6908+
bool IsPatchPoint) {
69096909
TargetLowering::ArgListTy Args;
69106910
Args.reserve(NumArgs);
69116911

@@ -6924,12 +6924,12 @@ std::pair<SDValue, SDValue> SelectionDAGBuilder::lowerCallOperands(
69246924
Args.push_back(Entry);
69256925
}
69266926

6927-
TargetLowering::CallLoweringInfo CLI(DAG);
6928-
CLI.setDebugLoc(getCurSDLoc()).setChain(getRoot())
6929-
.setCallee(CS.getCallingConv(), ReturnTy, Callee, std::move(Args), NumArgs)
6930-
.setDiscardResult(CS->use_empty()).setIsPatchPoint(IsPatchPoint);
6931-
6932-
return lowerInvokable(CLI, EHPadBB);
6927+
CLI.setDebugLoc(getCurSDLoc())
6928+
.setChain(getRoot())
6929+
.setCallee(CS.getCallingConv(), ReturnTy, Callee, std::move(Args),
6930+
NumArgs)
6931+
.setDiscardResult(CS->use_empty())
6932+
.setIsPatchPoint(IsPatchPoint);
69336933
}
69346934

69356935
/// \brief Add a stack map intrinsic call's live variable operands to a stackmap
@@ -7070,8 +7070,11 @@ void SelectionDAGBuilder::visitPatchpoint(ImmutableCallSite CS,
70707070
unsigned NumCallArgs = IsAnyRegCC ? 0 : NumArgs;
70717071
Type *ReturnTy =
70727072
IsAnyRegCC ? Type::getVoidTy(*DAG.getContext()) : CS->getType();
7073-
std::pair<SDValue, SDValue> Result = lowerCallOperands(
7074-
CS, NumMetaOpers, NumCallArgs, Callee, ReturnTy, EHPadBB, true);
7073+
7074+
TargetLowering::CallLoweringInfo CLI(DAG);
7075+
populateCallLoweringInfo(CLI, CS, NumMetaOpers, NumCallArgs, Callee, ReturnTy,
7076+
true);
7077+
std::pair<SDValue, SDValue> Result = lowerInvokable(CLI, EHPadBB);
70757078

70767079
SDNode *CallEnd = Result.second.getNode();
70777080
if (HasDef && (CallEnd->getOpcode() == ISD::CopyFromReg))

llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -713,14 +713,14 @@ class SelectionDAGBuilder {
713713
SDValue lowerRangeToAssertZExt(SelectionDAG &DAG, const Instruction &I,
714714
SDValue Op);
715715

716-
std::pair<SDValue, SDValue> lowerCallOperands(
717-
ImmutableCallSite CS,
718-
unsigned ArgIdx,
719-
unsigned NumArgs,
720-
SDValue Callee,
721-
Type *ReturnTy,
722-
const BasicBlock *EHPadBB = nullptr,
723-
bool IsPatchPoint = false);
716+
void populateCallLoweringInfo(TargetLowering::CallLoweringInfo &CLI,
717+
ImmutableCallSite CS, unsigned ArgIdx,
718+
unsigned NumArgs, SDValue Callee,
719+
Type *ReturnTy, bool IsPatchPoint);
720+
721+
std::pair<SDValue, SDValue>
722+
lowerInvokable(TargetLowering::CallLoweringInfo &CLI,
723+
const BasicBlock *EHPadBB = nullptr);
724724

725725
/// UpdateSplitBlock - When an MBB was split during scheduling, update the
726726
/// references that need to refer to the last resulting block.
@@ -731,10 +731,6 @@ class SelectionDAGBuilder {
731731
void LowerStatepoint(ImmutableStatepoint Statepoint,
732732
const BasicBlock *EHPadBB = nullptr);
733733
private:
734-
std::pair<SDValue, SDValue>
735-
lowerInvokable(TargetLowering::CallLoweringInfo &CLI,
736-
const BasicBlock *EHPadBB = nullptr);
737-
738734
// Terminator instructions.
739735
void visitRet(const ReturnInst &I);
740736
void visitBr(const BranchInst &I);

llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -311,11 +311,13 @@ lowerCallFromStatepoint(ImmutableStatepoint ISP, const BasicBlock *EHPadBB,
311311
Type *DefTy = ISP.getActualReturnType();
312312
bool HasDef = !DefTy->isVoidTy();
313313

314+
TargetLowering::CallLoweringInfo CLI(Builder.DAG);
315+
Builder.populateCallLoweringInfo(
316+
CLI, ISP.getCallSite(), ImmutableStatepoint::CallArgsBeginPos,
317+
ISP.getNumCallArgs(), ActualCallee, DefTy, false);
318+
314319
SDValue ReturnValue, CallEndVal;
315-
std::tie(ReturnValue, CallEndVal) = Builder.lowerCallOperands(
316-
ISP.getCallSite(), ImmutableStatepoint::CallArgsBeginPos,
317-
ISP.getNumCallArgs(), ActualCallee, DefTy, EHPadBB,
318-
false /* IsPatchPoint */);
320+
std::tie(ReturnValue, CallEndVal) = Builder.lowerInvokable(CLI, EHPadBB);
319321

320322
SDNode *CallEnd = CallEndVal.getNode();
321323

0 commit comments

Comments
 (0)