guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/07: gnu: clang: Move compiler-cpu-architectures to llvm-meta.scm.


From: guix-commits
Subject: 02/07: gnu: clang: Move compiler-cpu-architectures to llvm-meta.scm.
Date: Sun, 10 Mar 2024 06:51:43 -0400 (EDT)

efraim pushed a commit to branch master
in repository guix.

commit a3d2dde5b0dd40cf98acb6120fa048135c2e2be0
Author: Efraim Flashner <efraim@flashner.co.il>
AuthorDate: Sun Mar 10 10:27:02 2024 +0200

    gnu: clang: Move compiler-cpu-architectures to llvm-meta.scm.
    
    * gnu/packages/llvm.scm (clang-properties): Extract
    compiler-cpu-architectures and move ...
    * gnu/packages/llvm-meta.scm: ... to here.
    * gnu/packages/zig.scm (zig-0.9, zig-0.10)[properties]: Use
    clang-compiler-cpu-architectures.
    * gnu/local.mk (GNU_SYSTEM_MODULES): Register new file.
    
    Change-Id: Ie0bedbd6e2927eaa05024685cc66375ea278e4c2
---
 gnu/local.mk               |  1 +
 gnu/packages/llvm-meta.scm | 94 ++++++++++++++++++++++++++++++++++++++++++++++
 gnu/packages/llvm.scm      | 74 ++----------------------------------
 gnu/packages/zig.scm       |  7 ++--
 4 files changed, 103 insertions(+), 73 deletions(-)

diff --git a/gnu/local.mk b/gnu/local.mk
index 174c4c30e2..1aa413ebbe 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -425,6 +425,7 @@ GNU_SYSTEM_MODULES =                                \
   %D%/packages/lisp-check.scm                  \
   %D%/packages/lisp-xyz.scm                    \
   %D%/packages/llvm.scm                                \
+  %D%/packages/llvm-meta.scm                   \
   %D%/packages/lout.scm                                \
   %D%/packages/logging.scm                     \
   %D%/packages/logo.scm                                \
diff --git a/gnu/packages/llvm-meta.scm b/gnu/packages/llvm-meta.scm
new file mode 100644
index 0000000000..ea184806e5
--- /dev/null
+++ b/gnu/packages/llvm-meta.scm
@@ -0,0 +1,94 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2024 Efraim Flashner <efraim@flashner.co.il>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages llvm-meta)
+  #:use-module (guix utils)
+  #:export (clang-compiler-cpu-architectures))
+
+(define (clang-compiler-cpu-architectures version)
+  "Return package properties for Clang VERSION."
+  `((compiler-cpu-architectures
+      ;; These lists were obtained by running:
+      ;;
+      ;; guix shell clang -- llc -march=x86-64 -mattr=help
+      ;;
+      ;; and then filtering against clang/test/Misc/target-invalid-cpu-note.c
+      ("powerpc64le"
+       ,@(if (version>=? version "11.0")
+           '("power8" "power9" "power10" "powerpc64le")))
+      ("x86_64"
+       ,@(cond
+           ((version>=? version "17.0")
+            '("nocona" "core2" "penryn" "bonnell" "atom" "silvermont" "slm"
+              "goldmont" "goldmont-plus" "tremont" "nehalem" "corei7" 
"westmere"
+              "sandybridge" "corei7-avx" "ivybridge" "core-avx-i" "haswell"
+              "core-avx2" "broadwell" "skylake" "skylake-avx512" "skx"
+              "cascadelake" "cooperlake" "cannonlake" "icelake-client"
+              "rocketlake" "icelake-server" "tigerlake" "sapphirerapids"
+              "alderlake" "raptorlake" "meteorlake" "sierraforest" "grandridge"
+              "graniterapids" "graniterapids-d" "emeraldrapids" "knl" "knm" 
"k8"
+              "athlon64" "athlon-fx" "opteron" "k8-sse3" "athlon64-sse3"
+              "opteron-sse3" "amdfam10" "barcelona" "btver1" "btver2" "bdver1"
+              "bdver2" "bdver3" "bdver4" "znver1" "znver2" "znver3" "znver4"
+              "x86-64" "x86-64-v2" "x86-64-v3" "x86-64-v4"))
+           ((version>=? version "16.0")
+            '("nocona" "core2" "penryn" "bonnell" "atom" "silvermont" "slm"
+              "goldmont" "goldmont-plus" "tremont" "nehalem" "corei7" 
"westmere"
+              "sandybridge" "corei7-avx" "ivybridge" "core-avx-i" "haswell"
+              "core-avx2" "broadwell" "skylake" "skylake-avx512" "skx"
+              "cascadelake" "cooperlake" "cannonlake" "icelake-client"
+              "rocketlake" "icelake-server" "tigerlake" "sapphirerapids"
+              "alderlake" "raptorlake" "meteorlake" "sierraforest" "grandridge"
+              "graniterapids" "emeraldrapids" "knl" "knm" "k8" "athlon64"
+              "athlon-fx" "opteron" "k8-sse3" "athlon64-sse3" "opteron-sse3"
+              "amdfam10" "barcelona" "btver1" "btver2" "bdver1" "bdver2"
+              "bdver3" "bdver4" "znver1" "znver2" "znver3" "znver4" "x86-64"
+              "x86-64-v2" "x86-64-v3" "x86-64-v4"))
+           ((version>=? version "15.0")
+            '("nocona" "core2" "penryn" "bonnell" "atom" "silvermont" "slm"
+              "goldmont" "goldmont-plus" "tremont" "nehalem" "corei7" 
"westmere"
+              "sandybridge" "corei7-avx" "ivybridge" "core-avx-i" "haswell"
+              "core-avx2" "broadwell" "skylake" "skylake-avx512" "skx"
+              "cascadelake" "cooperlake" "cannonlake" "icelake-client"
+              "rocketlake" "icelake-server" "tigerlake" "sapphirerapids"
+              "alderlake" "knl" "knm" "k8" "athlon64" "athlon-fx" "opteron"
+              "k8-sse3" "athlon64-sse3" "opteron-sse3" "amdfam10" "barcelona"
+              "btver1" "btver2" "bdver1" "bdver2" "bdver3" "bdver4" "znver1"
+              "znver2" "znver3" "x86-64" "x86-64-v2" "x86-64-v3" "x86-64-v4"))
+           ((version>=? version "13.0")
+            '("nocona" "core2" "penryn" "bonnell" "atom" "silvermont" "slm"
+              "goldmont" "goldmont-plus" "tremont" "nehalem" "corei7" 
"westmere"
+              "sandybridge" "corei7-avx" "ivybridge" "core-avx-i" "haswell"
+              "core-avx2" "broadwell" "skylake" "skylake-avx512" "skx"
+              "cascadelake" "cooperlake" "cannonlake" "icelake-client"
+              "rocketlake" "icelake-server" "tigerlake" "sapphirerapids"
+              "alderlake" "knl" "knm" "k8" "athlon64" "athlon-fx" "opteron"
+              "k8-sse3" "athlon64-sse3" "opteron-sse3" "amdfam10" "barcelona"
+              "btver1" "btver2" "bdver1" "bdver2" "bdver3" "bdver4" "znver1"
+              "znver2" "znver3" "x86-64" "x86-64-v2" "x86-64-v3" "x86-64-v4"))
+           ((version>=? version "9.0")
+            '("atom" "silvermont" "slm" "goldmont" "goldmont-plus" "tremont"
+              "nehalem" "corei7" "westmere" "sandybridge" "corei7-avx"
+              "ivybridge" "core-avx-i" "haswell" "core-avx2" "broadwell"
+              "skylake" "skylake-avx512" "skx" "cascadelake" "cooperlake"
+              "cannonlake" "icelake-client" "icelake-server" "knl" "knm" "k8"
+              "athlon64" "athlon-fx" "opteron" "k8-sse3" "athlon64-sse3"
+              "opteron-sse3" "amdfam10" "barcelona" "btver1" "btver2" "bdver1"
+              "bdver2" "bdver3" "bdver4" "znver1" "znver2" "x86-64"))
+           (else '()))))))
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index c002f62cac..ab30675d5c 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -7,7 +7,7 @@
 ;;; Copyright © 2017 Roel Janssen <roel@gnu.org>
 ;;; Copyright © 2018–2022 Marius Bakke <mbakke@fastmail.com>
 ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
-;;; Copyright © 2018, 2021-2024 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2018, 2021-2023 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2018 Tim Gesthuizen <tim.gesthuizen@yahoo.de>
 ;;; Copyright © 2018 Pierre Neidhardt <mail@ambrevar.xyz>
 ;;; Copyright © 2019 Rutger Helling <rhelling@mykolab.com>
@@ -65,6 +65,7 @@
   #:use-module (gnu packages compression)
   #:use-module (gnu packages libedit)
   #:use-module (gnu packages libffi)
+  #:use-module (gnu packages llvm-meta)
   #:use-module (gnu packages lua)
   #:use-module (gnu packages mpi)
   #:use-module (gnu packages ncurses)
@@ -79,8 +80,7 @@
   #:use-module (srfi srfi-1)
   #:use-module (ice-9 match)
   #:export (make-lld-wrapper
-            system->llvm-target
-            clang-properties))
+            system->llvm-target))
 
 (define* (system->llvm-target #:optional
                               (system (or (and=> (%current-target-system)
@@ -481,73 +481,7 @@ code analysis tools.")
 
 (define (clang-properties version)
   "Return package properties for Clang VERSION."
-  `((compiler-cpu-architectures
-      ("powerpc64le"
-       ;; This list was obtained from clang/test/Misc/target-invalid-cpu-note.c
-       ;; and then trimmed down.
-       ,@(if (version>=? version "11.0")
-             '("power8" "power9" "power10" "powerpc64le")))
-      ("x86_64"
-       ;; This list was obtained from clang/test/Misc/target-invalid-cpu-note.c
-       ,@(cond
-           ((version>=? version "17.0")
-            '("nocona" "core2" "penryn" "bonnell" "atom" "silvermont" "slm"
-              "goldmont" "goldmont-plus" "tremont" "nehalem" "corei7" 
"westmere"
-              "sandybridge" "corei7-avx" "ivybridge" "core-avx-i" "haswell"
-              "core-avx2" "broadwell" "skylake" "skylake-avx512" "skx"
-              "cascadelake" "cooperlake" "cannonlake" "icelake-client"
-              "rocketlake" "icelake-server" "tigerlake" "sapphirerapids"
-              "alderlake" "raptorlake" "meteorlake" "sierraforest" "grandridge"
-              "graniterapids" "graniterapids-d" "emeraldrapids" "knl" "knm" 
"k8"
-              "athlon64" "athlon-fx" "opteron" "k8-sse3" "athlon64-sse3"
-              "opteron-sse3" "amdfam10" "barcelona" "btver1" "btver2" "bdver1"
-              "bdver2" "bdver3" "bdver4" "znver1" "znver2" "znver3" "znver4"
-              "x86-64" "x86-64-v2" "x86-64-v3" "x86-64-v4"))
-           ((version>=? version "16.0")
-            '("nocona" "core2" "penryn" "bonnell" "atom" "silvermont" "slm"
-              "goldmont" "goldmont-plus" "tremont" "nehalem" "corei7" 
"westmere"
-              "sandybridge" "corei7-avx" "ivybridge" "core-avx-i" "haswell"
-              "core-avx2" "broadwell" "skylake" "skylake-avx512" "skx"
-              "cascadelake" "cooperlake" "cannonlake" "icelake-client"
-              "rocketlake" "icelake-server" "tigerlake" "sapphirerapids"
-              "alderlake" "raptorlake" "meteorlake" "sierraforest" "grandridge"
-              "graniterapids" "emeraldrapids" "knl" "knm" "k8" "athlon64"
-              "athlon-fx" "opteron" "k8-sse3" "athlon64-sse3" "opteron-sse3"
-              "amdfam10" "barcelona" "btver1" "btver2" "bdver1" "bdver2"
-              "bdver3" "bdver4" "znver1" "znver2" "znver3" "znver4" "x86-64"
-              "x86-64-v2" "x86-64-v3" "x86-64-v4"))
-           ((version>=? version "15.0")
-            '("nocona" "core2" "penryn" "bonnell" "atom" "silvermont" "slm"
-              "goldmont" "goldmont-plus" "tremont" "nehalem" "corei7" 
"westmere"
-              "sandybridge" "corei7-avx" "ivybridge" "core-avx-i" "haswell"
-              "core-avx2" "broadwell" "skylake" "skylake-avx512" "skx"
-              "cascadelake" "cooperlake" "cannonlake" "icelake-client"
-              "rocketlake" "icelake-server" "tigerlake" "sapphirerapids"
-              "alderlake" "knl" "knm" "k8" "athlon64" "athlon-fx" "opteron"
-              "k8-sse3" "athlon64-sse3" "opteron-sse3" "amdfam10" "barcelona"
-              "btver1" "btver2" "bdver1" "bdver2" "bdver3" "bdver4" "znver1"
-              "znver2" "znver3" "x86-64" "x86-64-v2" "x86-64-v3" "x86-64-v4"))
-           ((version>=? version "13.0")
-            '("nocona" "core2" "penryn" "bonnell" "atom" "silvermont" "slm"
-              "goldmont" "goldmont-plus" "tremont" "nehalem" "corei7" 
"westmere"
-              "sandybridge" "corei7-avx" "ivybridge" "core-avx-i" "haswell"
-              "core-avx2" "broadwell" "skylake" "skylake-avx512" "skx"
-              "cascadelake" "cooperlake" "cannonlake" "icelake-client"
-              "rocketlake" "icelake-server" "tigerlake" "sapphirerapids"
-              "alderlake" "knl" "knm" "k8" "athlon64" "athlon-fx" "opteron"
-              "k8-sse3" "athlon64-sse3" "opteron-sse3" "amdfam10" "barcelona"
-              "btver1" "btver2" "bdver1" "bdver2" "bdver3" "bdver4" "znver1"
-              "znver2" "znver3" "x86-64" "x86-64-v2" "x86-64-v3" "x86-64-v4"))
-           ((version>=? version "9.0")
-            '("atom" "silvermont" "slm" "goldmont" "goldmont-plus" "tremont"
-              "nehalem" "corei7" "westmere" "sandybridge" "corei7-avx"
-              "ivybridge" "core-avx-i" "haswell" "core-avx2" "broadwell"
-              "skylake" "skylake-avx512" "skx" "cascadelake" "cooperlake"
-              "cannonlake" "icelake-client" "icelake-server" "knl" "knm" "k8"
-              "athlon64" "athlon-fx" "opteron" "k8-sse3" "athlon64-sse3"
-              "opteron-sse3" "amdfam10" "barcelona" "btver1" "btver2" "bdver1"
-              "bdver2" "bdver3" "bdver4" "znver1" "znver2" "x86-64"))
-           (else '()))))))
+  `((clang-compiler-cpu-architectures version)))
 
 (define-public (make-clang-toolchain clang libomp)
   (package
diff --git a/gnu/packages/zig.scm b/gnu/packages/zig.scm
index c9c3ddca62..6e399dfce3 100644
--- a/gnu/packages/zig.scm
+++ b/gnu/packages/zig.scm
@@ -28,7 +28,8 @@
   #:use-module (guix build-system cmake)
   #:use-module (gnu packages)
   #:use-module (gnu packages compression)
-  #:use-module (gnu packages llvm))
+  #:use-module (gnu packages llvm)
+  #:use-module (gnu packages llvm-meta))
 
 (define-public zig-0.9
   (package
@@ -130,7 +131,7 @@ toolchain.  Among other features it provides
     (supported-systems %64bit-supported-systems)
     ;; Stage3 can take a lot of time and isn't verbose.
     (properties `((max-silent-time . 9600)
-                  ,@(clang-properties "13")))
+                  ,@(clang-compiler-cpu-architectures "13")))
     (license license:expat)))
 
 (define-public zig-0.10
@@ -195,6 +196,6 @@ toolchain.  Among other features it provides
      (modify-inputs (package-native-inputs zig-0.9)
        (replace "llvm" llvm-15)))
     (properties `((max-silent-time . 9600)
-                  ,@(clang-properties "15")))))
+                  ,@(clang-compiler-cpu-architectures "15")))))
 
 (define-public zig zig-0.10)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]