summaryrefslogtreecommitdiff
path: root/lib/Target/NVPTX
diff options
context:
space:
mode:
authorJustin Holewinski <jholewinski@nvidia.com>2012-05-25 16:35:28 +0000
committerJustin Holewinski <jholewinski@nvidia.com>2012-05-25 16:35:28 +0000
commitd2ea0e10cbd158c93fb870cdd03001b9cd1156b8 (patch)
tree23c71d3dd7985b432383022f937a2ec7815fd17c /lib/Target/NVPTX
parentf755e0001a4c45c0ea11bb1e3be8d52b324766e7 (diff)
downloadllvm-d2ea0e10cbd158c93fb870cdd03001b9cd1156b8.tar.gz
llvm-d2ea0e10cbd158c93fb870cdd03001b9cd1156b8.tar.bz2
llvm-d2ea0e10cbd158c93fb870cdd03001b9cd1156b8.tar.xz
Change interface for TargetLowering::LowerCallTo and TargetLowering::LowerCall
to pass around a struct instead of a large set of individual values. This cleans up the interface and allows more information to be added to the struct for future targets without requiring changes to each and every target. NV_CONTRIB git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157479 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/NVPTX')
-rw-r--r--lib/Target/NVPTX/NVPTXISelLowering.cpp47
-rw-r--r--lib/Target/NVPTX/NVPTXISelLowering.h13
2 files changed, 24 insertions, 36 deletions
diff --git a/lib/Target/NVPTX/NVPTXISelLowering.cpp b/lib/Target/NVPTX/NVPTXISelLowering.cpp
index d517e8117b..6ea10ea14a 100644
--- a/lib/Target/NVPTX/NVPTXISelLowering.cpp
+++ b/lib/Target/NVPTX/NVPTXISelLowering.cpp
@@ -438,17 +438,21 @@ std::string NVPTXTargetLowering::getPrototype(Type *retTy,
}
-#if 0
SDValue
-NVPTXTargetLowering::LowerCall(SDValue Chain, SDValue Callee,
- CallingConv::ID CallConv, bool isVarArg,
- bool doesNotRet, bool &isTailCall,
- const SmallVectorImpl<ISD::OutputArg> &Outs,
- const SmallVectorImpl<SDValue> &OutVals,
- const SmallVectorImpl<ISD::InputArg> &Ins,
- DebugLoc dl, SelectionDAG &DAG,
- SmallVectorImpl<SDValue> &InVals, Type *retTy,
- const ArgListTy &Args) const {
+NVPTXTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
+ SmallVectorImpl<SDValue> &InVals) const {
+ SelectionDAG &DAG = CLI.DAG;
+ DebugLoc &dl = CLI.DL;
+ SmallVector<ISD::OutputArg, 32> &Outs = CLI.Outs;
+ SmallVector<SDValue, 32> &OutVals = CLI.OutVals;
+ SmallVector<ISD::InputArg, 32> &Ins = CLI.Ins;
+ SDValue Chain = CLI.Chain;
+ SDValue Callee = CLI.Callee;
+ bool &isTailCall = CLI.IsTailCall;
+ ArgListTy &Args = CLI.Args;
+ Type *retTy = CLI.RetTy;
+ ImmutableCallSite *CS = CLI.CS;
+
bool isABI = (nvptxSubtarget.getSmVersion() >= 20);
SDValue tempChain = Chain;
@@ -649,20 +653,14 @@ NVPTXTargetLowering::LowerCall(SDValue Chain, SDValue Callee,
InFlag = Chain.getValue(1);
}
else {
- // @TODO: Re-enable getAlign calls. We do not have the
- // ImmutableCallSite object here anymore.
- //if (Func) { // direct call
- //if (!llvm::getAlign(*(CS->getCalledFunction()), 0, retAlignment))
- //retAlignment = TD->getABITypeAlignment(retTy);
- //}
- //else { // indirect call
- //const CallInst *CallI = dyn_cast<CallInst>(CS->getInstruction());
- //if (!llvm::getAlign(*CallI, 0, retAlignment))
- //retAlignment = TD->getABITypeAlignment(retTy);
- //}
- // @TODO: Remove this hack!
- // Functions with explicit alignment metadata will be broken, for now.
- retAlignment = 16;
+ if (Func) { // direct call
+ if (!llvm::getAlign(*(CS->getCalledFunction()), 0, retAlignment))
+ retAlignment = getTargetData()->getABITypeAlignment(retTy);
+ } else { // indirect call
+ const CallInst *CallI = dyn_cast<CallInst>(CS->getInstruction());
+ if (!llvm::getAlign(*CallI, 0, retAlignment))
+ retAlignment = getTargetData()->getABITypeAlignment(retTy);
+ }
SDVTList DeclareRetVTs = DAG.getVTList(MVT::Other, MVT::Glue);
SDValue DeclareRetOps[] = { Chain, DAG.getConstant(retAlignment,
MVT::i32),
@@ -823,7 +821,6 @@ NVPTXTargetLowering::LowerCall(SDValue Chain, SDValue Callee,
isTailCall = false;
return Chain;
}
-#endif
// By default CONCAT_VECTORS is lowered by ExpandVectorBuildThroughStack()
// (see LegalizeDAG.cpp). This is slow and uses local memory.
diff --git a/lib/Target/NVPTX/NVPTXISelLowering.h b/lib/Target/NVPTX/NVPTXISelLowering.h
index 5707ad75c8..86246e6449 100644
--- a/lib/Target/NVPTX/NVPTXISelLowering.h
+++ b/lib/Target/NVPTX/NVPTXISelLowering.h
@@ -105,17 +105,8 @@ public:
SelectionDAG &DAG,
SmallVectorImpl<SDValue> &InVals) const;
- // This will be re-added once the necessary changes to LowerCallTo are
- // upstreamed.
- // virtual SDValue
- // LowerCall(SDValue Chain, SDValue Callee, CallingConv::ID CallConv,
- // bool isVarArg, bool doesNotRet, bool &isTailCall,
- // const SmallVectorImpl<ISD::OutputArg> &Outs,
- // const SmallVectorImpl<SDValue> &OutVals,
- // const SmallVectorImpl<ISD::InputArg> &Ins,
- // DebugLoc dl, SelectionDAG &DAG,
- // SmallVectorImpl<SDValue> &InVals,
- // Type *retTy, const ArgListTy &Args) const;
+ virtual SDValue
+ LowerCall(CallLoweringInfo &CLI, SmallVectorImpl<SDValue> &InVals) const;
std::string getPrototype(Type *, const ArgListTy &,
const SmallVectorImpl<ISD::OutputArg> &,