perf: Key the interpreter symbol cache by Name rather than FastString
[ghc.git] / m4 / ghc_llvm_target.m4
blob52d6674db37dc30d956c7ea57aad403e5bc0a0be
1 # GHC_LLVM_TARGET(target, target_cpu, target_vendor, target_os, llvm_target_var)
2 # --------------------------------
3 # converts the canonicalized target into something llvm can understand
4 AC_DEFUN([GHC_LLVM_TARGET], [
5   llvm_target_cpu=$2
6   case "$1" in
7     *-freebsd*-gnueabihf)
8       llvm_target_vendor="unknown"
9       llvm_target_os="freebsd-gnueabihf"
10       ;;
11     *-hardfloat-*eabi)
12       llvm_target_vendor="unknown"
13       llvm_target_os="$4""hf"
14       ;;
15     *-mingw32|*-mingw64|*-msys)
16       llvm_target_vendor="unknown"
17       llvm_target_os="windows-gnu"
18       ;;
19     # apple is a bit about their naming scheme for
20     # aarch64; and clang on macOS doesn't know that
21     # aarch64 would be arm64. So for LLVM we'll need
22     # to call it arm64; while we'll refer to it internally
23     # as aarch64 for consistency and sanity.
24     aarch64-apple-*|arm64-apple-*)
25       llvm_target_cpu="arm64"
26       GHC_CONVERT_VENDOR([$3],[llvm_target_vendor])
27       GHC_CONVERT_OS([$4],[$2],[llvm_target_os])
28       ;;
29     *)
30       GHC_CONVERT_VENDOR([$3],[llvm_target_vendor])
31       GHC_CONVERT_OS([$4],[$2],[llvm_target_os])
32       ;;
33   esac
34   case "$4" in
35       # retain any android and gnueabi linux flavours
36       # for the LLVM Target. Otherwise these would be
37       # turned into just `-linux` and fail to be found
38       # in the `llvm-targets` file.
39       *-android*|*-gnueabi*|*-musleabi*)
40         GHC_CONVERT_VENDOR([$3],[llvm_target_vendor])
41         llvm_target_os="$4"
42         ;;
43   esac
44   $5="$llvm_target_cpu-$llvm_target_vendor-$llvm_target_os"
47 # GHC_LLVM_TARGET_SET_VAR
48 # -----------------------
49 # Sets the cannonical target variable. This stub exists so other macros can
50 # require it.
51 AC_DEFUN([GHC_LLVM_TARGET_SET_VAR], [
52   AC_REQUIRE([FPTOOLS_SET_PLATFORMS_VARS])
53   if test "$bootstrap_llvm_target" != ""
54   then
55     LlvmTarget=$bootstrap_llvm_target
56   else
57     GHC_LLVM_TARGET([$target],[$target_cpu],[$target_vendor],[$target_os],[LlvmTarget])
58   fi