From 66af1399963a1872e520d1dbd1c94fd43e65082d Mon Sep 17 00:00:00 2001 From: Cheng Shao Date: Mon, 12 Sep 2022 13:55:05 +0000 Subject: 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 --- configure.ac | 2 ++ 1 file changed, 2 insertions(+) (limited to 'configure.ac') 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])]) -- cgit v1.2.1