summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorCheng Shao <astrohavoc@gmail.com>2022-09-12 13:55:05 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-10-11 12:49:59 -0400
commit66af1399963a1872e520d1dbd1c94fd43e65082d (patch)
treed9b2ab22c705a238ad7497a26a53a6b9a083dc28 /configure.ac
parent284cf387537110ce9139bf6ed0841c8f4f41db2a (diff)
downloadhaskell-66af1399963a1872e520d1dbd1c94fd43e65082d.tar.gz
CmmToC: emit explicit tail calls when the C compiler supports it
Clang 13+ supports annotating a return statement using the musttail attribute, which guarantees that it lowers to a tail call if compilation succeeds. This patch takes advantage of that feature for the unregisterised code generator. The configure script tests availability of the musttail attribute, if it's available, the Cmm tail calls will become C tail calls that avoids the mini interpreter trampoline overhead. Nothing is affected if the musttail attribute is not supported. Clang documentation: https://clang.llvm.org/docs/AttributeReference.html#musttail
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac2
1 files changed, 2 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index f4c66de811..28f954a9a3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -996,6 +996,8 @@ fi
FP_VISIBILITY_HIDDEN
+FP_MUSTTAIL
+
dnl ** check for librt
AC_CHECK_LIB([rt], [clock_gettime])
AC_CHECK_LIB([rt], [clock_gettime], [AC_SUBST([CabalHaveLibrt], [True])], [AC_SUBST([CabalHaveLibrt], [False])])