diff options
| author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2017-08-03 23:32:41 +0000 |
|---|---|---|
| committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2017-08-03 23:32:41 +0000 |
| commit | a176cc5b93075eec2bfdaf6c357b1ba216aab006 (patch) | |
| tree | f8da4f67e84f87b03ca97c5510cff38271c5d51d /llvm/lib/Target/AMDGPU | |
| parent | a202538bfa722d0b2392de691213ede0aa477680 (diff) | |
| download | bcm5719-llvm-a176cc5b93075eec2bfdaf6c357b1ba216aab006.tar.gz bcm5719-llvm-a176cc5b93075eec2bfdaf6c357b1ba216aab006.zip | |
AMDGPU: Don't use report_fatal_error for unsupported call types
llvm-svn: 310004
Diffstat (limited to 'llvm/lib/Target/AMDGPU')
| -rw-r--r-- | llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp | 12 | ||||
| -rw-r--r-- | llvm/lib/Target/AMDGPU/AMDGPUISelLowering.h | 4 | ||||
| -rw-r--r-- | llvm/lib/Target/AMDGPU/SIISelLowering.cpp | 22 |
3 files changed, 29 insertions, 9 deletions
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp b/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp index 4f65b40ece5..6597f79057d 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp @@ -1001,8 +1001,9 @@ CCAssignFn *AMDGPUTargetLowering::CCAssignFnForReturn(CallingConv::ID CC, return AMDGPUCallLowering::CCAssignFnForReturn(CC, IsVarArg); } -SDValue AMDGPUTargetLowering::LowerCall(CallLoweringInfo &CLI, - SmallVectorImpl<SDValue> &InVals) const { +SDValue AMDGPUTargetLowering::lowerUnhandledCall(CallLoweringInfo &CLI, + SmallVectorImpl<SDValue> &InVals, + StringRef Reason) const { SDValue Callee = CLI.Callee; SelectionDAG &DAG = CLI.DAG; @@ -1016,7 +1017,7 @@ SDValue AMDGPUTargetLowering::LowerCall(CallLoweringInfo &CLI, FuncName = G->getGlobal()->getName(); DiagnosticInfoUnsupported NoCalls( - Fn, "unsupported call to function " + FuncName, CLI.DL.getDebugLoc()); + Fn, Reason + FuncName, CLI.DL.getDebugLoc()); DAG.getContext()->diagnose(NoCalls); if (!CLI.IsTailCall) { @@ -1027,6 +1028,11 @@ SDValue AMDGPUTargetLowering::LowerCall(CallLoweringInfo &CLI, return DAG.getEntryNode(); } +SDValue AMDGPUTargetLowering::LowerCall(CallLoweringInfo &CLI, + SmallVectorImpl<SDValue> &InVals) const { + return lowerUnhandledCall(CLI, InVals, "unsupported call to function "); +} + SDValue AMDGPUTargetLowering::LowerDYNAMIC_STACKALLOC(SDValue Op, SelectionDAG &DAG) const { const Function &Fn = *DAG.getMachineFunction().getFunction(); diff --git a/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.h b/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.h index 46c81f91d60..0a7d02e4b12 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.h +++ b/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.h @@ -171,6 +171,10 @@ public: const SmallVectorImpl<ISD::OutputArg> &Outs, const SmallVectorImpl<SDValue> &OutVals, const SDLoc &DL, SelectionDAG &DAG) const override; + + SDValue lowerUnhandledCall(CallLoweringInfo &CLI, + SmallVectorImpl<SDValue> &InVals, + StringRef Reason) const; SDValue LowerCall(CallLoweringInfo &CLI, SmallVectorImpl<SDValue> &InVals) const override; diff --git a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp index 68881ef2767..cec3abb4551 100644 --- a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp +++ b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp @@ -1888,8 +1888,7 @@ void SITargetLowering::passSpecialInputs( return; const Function *CalleeFunc = CLI.CS.getCalledFunction(); - if (!CalleeFunc) - report_fatal_error("indirect calls not handled"); + assert(CalleeFunc); SelectionDAG &DAG = CLI.DAG; const SDLoc &DL = CLI.DL; @@ -1976,13 +1975,24 @@ SDValue SITargetLowering::LowerCall(CallLoweringInfo &CLI, bool IsThisReturn = false; MachineFunction &MF = DAG.getMachineFunction(); - // TODO: Implement tail calls. - IsTailCall = false; + if (IsVarArg) { + return lowerUnhandledCall(CLI, InVals, + "unsupported call to variadic function "); + } + + if (!CLI.CS.getCalledFunction()) { + return lowerUnhandledCall(CLI, InVals, + "unsupported indirect call to function "); + } - if (IsVarArg || MF.getTarget().Options.GuaranteedTailCallOpt) { - report_fatal_error("varargs and tail calls not implemented"); + if (IsTailCall && MF.getTarget().Options.GuaranteedTailCallOpt) { + return lowerUnhandledCall(CLI, InVals, + "unsupported required tail call to function "); } + // TODO: Implement tail calls. + IsTailCall = false; + if (GlobalAddressSDNode *GA = dyn_cast<GlobalAddressSDNode>(Callee)) { // FIXME: Remove this hack for function pointer types. const GlobalValue *GV = GA->getGlobal(); |

