about summary refs log tree commit diff
path: root/pkgs/development/compilers/llvm/common.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/compilers/llvm/common.nix')
-rw-r--r--pkgs/development/compilers/llvm/common.nix20
1 files changed, 20 insertions, 0 deletions
diff --git a/pkgs/development/compilers/llvm/common.nix b/pkgs/development/compilers/llvm/common.nix
new file mode 100644
index 000000000000..27f48ff3f113
--- /dev/null
+++ b/pkgs/development/compilers/llvm/common.nix
@@ -0,0 +1,20 @@
+{ lib }:
+
+rec {
+  llvmBackend = platform:
+    if builtins.typeOf platform == "string" then
+      platform
+    else if platform.parsed.cpu.family == "x86" then
+      "X86"
+    else if platform.parsed.cpu.name == "aarch64" then
+      "AArch64"
+    else if platform.parsed.cpu.family == "arm" then
+      "ARM"
+    else if platform.parsed.cpu.family == "mips" then
+      "Mips"
+    else
+      throw "Unsupported system";
+
+  llvmBackendList = platforms:
+    lib.concatStringsSep ";" (map llvmBackend platforms);
+}