Date: Sat, 10 Sep 2016 15:38:46 +0000 (UTC) From: Dimitry Andric <dim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r305680 - in projects/clang390-import/contrib/llvm: lib/Target/PowerPC tools/clang/include/clang/Driver Message-ID: <201609101538.u8AFcktD093648@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dim Date: Sat Sep 10 15:38:46 2016 New Revision: 305680 URL: https://svnweb.freebsd.org/changeset/base/305680 Log: Pull in r280040 from upstream llvm trunk (by Hal Finkel): [PowerPC] Add support for -mlongcall The "long call" option forces the use of the indirect calling sequence for all calls (even those that don't really need it). GCC provides this option; This is helpful, under certain circumstances, for building very-large binaries, and some other specialized use cases. Fixes PR19098. Pull in r280041 from upstream clang trunk (by Hal Finkel): [PowerPC] Add support for -mlongcall Add support for GCC's PowerPC -mlongcall option; the backend supports the corresponding target feature as of r280040. Fixes PR19098. Modified: projects/clang390-import/contrib/llvm/lib/Target/PowerPC/PPC.td projects/clang390-import/contrib/llvm/lib/Target/PowerPC/PPCISelLowering.cpp projects/clang390-import/contrib/llvm/lib/Target/PowerPC/PPCSubtarget.cpp projects/clang390-import/contrib/llvm/lib/Target/PowerPC/PPCSubtarget.h projects/clang390-import/contrib/llvm/tools/clang/include/clang/Driver/Options.td Modified: projects/clang390-import/contrib/llvm/lib/Target/PowerPC/PPC.td ============================================================================== --- projects/clang390-import/contrib/llvm/lib/Target/PowerPC/PPC.td Sat Sep 10 09:37:41 2016 (r305679) +++ projects/clang390-import/contrib/llvm/lib/Target/PowerPC/PPC.td Sat Sep 10 15:38:46 2016 (r305680) @@ -136,6 +136,8 @@ def FeatureInvariantFunctionDescriptors SubtargetFeature<"invariant-function-descriptors", "HasInvariantFunctionDescriptors", "true", "Assume function descriptors are invariant">; +def FeatureLongCall : SubtargetFeature<"longcall", "UseLongCalls", "true", + "Always use indirect calls">; def FeatureHTM : SubtargetFeature<"htm", "HasHTM", "true", "Enable Hardware Transactional Memory instructions">; def FeatureMFTB : SubtargetFeature<"", "FeatureMFTB", "true", Modified: projects/clang390-import/contrib/llvm/lib/Target/PowerPC/PPCISelLowering.cpp ============================================================================== --- projects/clang390-import/contrib/llvm/lib/Target/PowerPC/PPCISelLowering.cpp Sat Sep 10 09:37:41 2016 (r305679) +++ projects/clang390-import/contrib/llvm/lib/Target/PowerPC/PPCISelLowering.cpp Sat Sep 10 15:38:46 2016 (r305680) @@ -4680,7 +4680,9 @@ PPCTargetLowering::LowerCall(TargetLower ImmutableCallSite *CS = CLI.CS; if (isTailCall) { - if (Subtarget.isSVR4ABI() && Subtarget.isPPC64()) + if (Subtarget.useLongCalls() && !(CS && CS->isMustTailCall())) + isTailCall = false; + else if (Subtarget.isSVR4ABI() && Subtarget.isPPC64()) isTailCall = IsEligibleForTailCallOptimization_64SVR4(Callee, CallConv, CS, isVarArg, Outs, Ins, DAG); @@ -4710,6 +4712,13 @@ PPCTargetLowering::LowerCall(TargetLower report_fatal_error("failed to perform tail call elimination on a call " "site marked musttail"); + // When long calls (i.e. indirect calls) are always used, calls are always + // made via function pointer. If we have a function name, first translate it + // into a pointer. + if (Subtarget.useLongCalls() && isa<GlobalAddressSDNode>(Callee) && + !isTailCall) + Callee = LowerGlobalAddress(Callee, DAG); + if (Subtarget.isSVR4ABI()) { if (Subtarget.isPPC64()) return LowerCall_64SVR4(Chain, Callee, CallConv, isVarArg, Modified: projects/clang390-import/contrib/llvm/lib/Target/PowerPC/PPCSubtarget.cpp ============================================================================== --- projects/clang390-import/contrib/llvm/lib/Target/PowerPC/PPCSubtarget.cpp Sat Sep 10 09:37:41 2016 (r305679) +++ projects/clang390-import/contrib/llvm/lib/Target/PowerPC/PPCSubtarget.cpp Sat Sep 10 15:38:46 2016 (r305680) @@ -105,6 +105,7 @@ void PPCSubtarget::initializeEnvironment HasFusion = false; HasFloat128 = false; IsISA3_0 = false; + UseLongCalls = false; HasPOPCNTD = POPCNTD_Unavailable; } Modified: projects/clang390-import/contrib/llvm/lib/Target/PowerPC/PPCSubtarget.h ============================================================================== --- projects/clang390-import/contrib/llvm/lib/Target/PowerPC/PPCSubtarget.h Sat Sep 10 09:37:41 2016 (r305679) +++ projects/clang390-import/contrib/llvm/lib/Target/PowerPC/PPCSubtarget.h Sat Sep 10 15:38:46 2016 (r305680) @@ -132,6 +132,7 @@ protected: bool HasFusion; bool HasFloat128; bool IsISA3_0; + bool UseLongCalls; POPCNTDKind HasPOPCNTD; @@ -275,6 +276,7 @@ public: bool hasFusion() const { return HasFusion; } bool hasFloat128() const { return HasFloat128; } bool isISA3_0() const { return IsISA3_0; } + bool useLongCalls() const { return UseLongCalls; } POPCNTDKind hasPOPCNTD() const { return HasPOPCNTD; } Modified: projects/clang390-import/contrib/llvm/tools/clang/include/clang/Driver/Options.td ============================================================================== --- projects/clang390-import/contrib/llvm/tools/clang/include/clang/Driver/Options.td Sat Sep 10 09:37:41 2016 (r305679) +++ projects/clang390-import/contrib/llvm/tools/clang/include/clang/Driver/Options.td Sat Sep 10 15:38:46 2016 (r305680) @@ -1574,6 +1574,10 @@ def mfloat128: Flag<["-"], "mfloat128">, Group<m_ppc_Features_Group>; def mno_float128 : Flag<["-"], "mno-float128">, Group<m_ppc_Features_Group>; +def mlongcall: Flag<["-"], "mlongcall">, + Group<m_ppc_Features_Group>; +def mno_longcall : Flag<["-"], "mno-longcall">, + Group<m_ppc_Features_Group>; def faltivec : Flag<["-"], "faltivec">, Group<f_Group>, Flags<[CC1Option]>, HelpText<"Enable AltiVec vector initializer syntax">;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201609101538.u8AFcktD093648>