summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSanjoy Das <sanjoy@playingwithpointers.com>2016-03-16 20:49:31 +0000
committerSanjoy Das <sanjoy@playingwithpointers.com>2016-03-16 20:49:31 +0000
commit19c61598337befbdd275d23cb7cf450e012da314 (patch)
tree164b4560832c761758227166e5fa8bc0af48f4ed
parentaa0cae6208c67da94ee9efbd16e374df0d638080 (diff)
downloadbcm5719-llvm-19c61598337befbdd275d23cb7cf450e012da314.tar.gz
bcm5719-llvm-19c61598337befbdd275d23cb7cf450e012da314.zip
[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
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp31
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h20
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp10
3 files changed, 31 insertions, 30 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 8ec3387b599..cade049e9d2 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -6896,16 +6896,16 @@ SDValue SelectionDAGBuilder::lowerRangeToAssertZExt(SelectionDAG &DAG,
return DAG.getMergeValues(Ops, SL);
}
-/// \brief Lower an argument list according to the target calling convention.
-///
-/// \return A tuple of <return-value, token-chain>
+/// \brief Populate a CallLowerinInfo (into \p CLI) based on the properties of
+/// the call being lowered.
///
/// This is a helper for lowering intrinsics that follow a target calling
/// convention or require stack pointer adjustment. Only a subset of the
/// intrinsic's operands need to participate in the calling convention.
-std::pair<SDValue, SDValue> SelectionDAGBuilder::lowerCallOperands(
- ImmutableCallSite CS, unsigned ArgIdx, unsigned NumArgs, SDValue Callee,
- Type *ReturnTy, const BasicBlock *EHPadBB, bool IsPatchPoint) {
+void SelectionDAGBuilder::populateCallLoweringInfo(
+ TargetLowering::CallLoweringInfo &CLI, ImmutableCallSite CS,
+ unsigned ArgIdx, unsigned NumArgs, SDValue Callee, Type *ReturnTy,
+ bool IsPatchPoint) {
TargetLowering::ArgListTy Args;
Args.reserve(NumArgs);
@@ -6924,12 +6924,12 @@ std::pair<SDValue, SDValue> SelectionDAGBuilder::lowerCallOperands(
Args.push_back(Entry);
}
- TargetLowering::CallLoweringInfo CLI(DAG);
- CLI.setDebugLoc(getCurSDLoc()).setChain(getRoot())
- .setCallee(CS.getCallingConv(), ReturnTy, Callee, std::move(Args), NumArgs)
- .setDiscardResult(CS->use_empty()).setIsPatchPoint(IsPatchPoint);
-
- return lowerInvokable(CLI, EHPadBB);
+ CLI.setDebugLoc(getCurSDLoc())
+ .setChain(getRoot())
+ .setCallee(CS.getCallingConv(), ReturnTy, Callee, std::move(Args),
+ NumArgs)
+ .setDiscardResult(CS->use_empty())
+ .setIsPatchPoint(IsPatchPoint);
}
/// \brief Add a stack map intrinsic call's live variable operands to a stackmap
@@ -7070,8 +7070,11 @@ void SelectionDAGBuilder::visitPatchpoint(ImmutableCallSite CS,
unsigned NumCallArgs = IsAnyRegCC ? 0 : NumArgs;
Type *ReturnTy =
IsAnyRegCC ? Type::getVoidTy(*DAG.getContext()) : CS->getType();
- std::pair<SDValue, SDValue> Result = lowerCallOperands(
- CS, NumMetaOpers, NumCallArgs, Callee, ReturnTy, EHPadBB, true);
+
+ TargetLowering::CallLoweringInfo CLI(DAG);
+ populateCallLoweringInfo(CLI, CS, NumMetaOpers, NumCallArgs, Callee, ReturnTy,
+ true);
+ std::pair<SDValue, SDValue> Result = lowerInvokable(CLI, EHPadBB);
SDNode *CallEnd = Result.second.getNode();
if (HasDef && (CallEnd->getOpcode() == ISD::CopyFromReg))
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
index 0e8230d39cd..941a0c070ec 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
@@ -713,14 +713,14 @@ public:
SDValue lowerRangeToAssertZExt(SelectionDAG &DAG, const Instruction &I,
SDValue Op);
- std::pair<SDValue, SDValue> lowerCallOperands(
- ImmutableCallSite CS,
- unsigned ArgIdx,
- unsigned NumArgs,
- SDValue Callee,
- Type *ReturnTy,
- const BasicBlock *EHPadBB = nullptr,
- bool IsPatchPoint = false);
+ void populateCallLoweringInfo(TargetLowering::CallLoweringInfo &CLI,
+ ImmutableCallSite CS, unsigned ArgIdx,
+ unsigned NumArgs, SDValue Callee,
+ Type *ReturnTy, bool IsPatchPoint);
+
+ std::pair<SDValue, SDValue>
+ lowerInvokable(TargetLowering::CallLoweringInfo &CLI,
+ const BasicBlock *EHPadBB = nullptr);
/// UpdateSplitBlock - When an MBB was split during scheduling, update the
/// references that need to refer to the last resulting block.
@@ -731,10 +731,6 @@ public:
void LowerStatepoint(ImmutableStatepoint Statepoint,
const BasicBlock *EHPadBB = nullptr);
private:
- std::pair<SDValue, SDValue>
- lowerInvokable(TargetLowering::CallLoweringInfo &CLI,
- const BasicBlock *EHPadBB = nullptr);
-
// Terminator instructions.
void visitRet(const ReturnInst &I);
void visitBr(const BranchInst &I);
diff --git a/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
index 9d20d0a26f3..ff0136816c4 100644
--- a/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
@@ -311,11 +311,13 @@ lowerCallFromStatepoint(ImmutableStatepoint ISP, const BasicBlock *EHPadBB,
Type *DefTy = ISP.getActualReturnType();
bool HasDef = !DefTy->isVoidTy();
+ TargetLowering::CallLoweringInfo CLI(Builder.DAG);
+ Builder.populateCallLoweringInfo(
+ CLI, ISP.getCallSite(), ImmutableStatepoint::CallArgsBeginPos,
+ ISP.getNumCallArgs(), ActualCallee, DefTy, false);
+
SDValue ReturnValue, CallEndVal;
- std::tie(ReturnValue, CallEndVal) = Builder.lowerCallOperands(
- ISP.getCallSite(), ImmutableStatepoint::CallArgsBeginPos,
- ISP.getNumCallArgs(), ActualCallee, DefTy, EHPadBB,
- false /* IsPatchPoint */);
+ std::tie(ReturnValue, CallEndVal) = Builder.lowerInvokable(CLI, EHPadBB);
SDNode *CallEnd = CallEndVal.getNode();
OpenPOWER on IntegriCloud