[llvm] 7316b0d - gn build: Add support for building the AArch64 LSE builtins.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 13 13:15:57 PDT 2022


Author: Peter Collingbourne
Date: 2022-06-13T13:15:29-07:00
New Revision: 7316b0d54c3d00d9142c881f0c3f400b664c30b4

URL: https://github.com/llvm/llvm-project/commit/7316b0d54c3d00d9142c881f0c3f400b664c30b4
DIFF: https://github.com/llvm/llvm-project/commit/7316b0d54c3d00d9142c881f0c3f400b664c30b4.diff

LOG: gn build: Add support for building the AArch64 LSE builtins.

Differential Revision: https://reviews.llvm.org/D127560

Added: 
    

Modified: 
    llvm/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn

Removed: 
    


################################################################################
diff  --git a/llvm/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn b/llvm/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn
index 0248511dfb8a0..6a78b2b903d94 100644
--- a/llvm/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn
+++ b/llvm/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn
@@ -6,6 +6,54 @@ declare_args() {
   compiler_rt_exclude_atomic_builtin = true
 }
 
+lse_targets = []
+
+if (current_cpu == "arm64") {
+  foreach(pat,
+          [
+            "cas",
+            "swp",
+            "ldadd",
+            "ldclr",
+            "ldeor",
+            "ldset",
+          ]) {
+    foreach(size,
+            [
+              "1",
+              "2",
+              "4",
+              "8",
+              "16",
+            ]) {
+      foreach(model,
+              [
+                "1",
+                "2",
+                "3",
+                "4",
+              ]) {
+        if (pat == "cas" || size != "16") {
+          source_set("lse_${pat}_${size}_${model}") {
+            # Assign to sources like this to hide from
+            # sync_source_lists_from_cmake.py which won't find the source file
+            # on the CMake side.
+            lse_file = "aarch64/lse.S"
+            sources = [ lse_file ]
+            include_dirs = [ "." ]
+            defines = [
+              "L_$pat",
+              "SIZE=$size",
+              "MODEL=$model",
+            ]
+          }
+          lse_targets += [ ":lse_${pat}_${size}_${model}" ]
+        }
+      }
+    }
+  }
+}
+
 static_library("builtins") {
   output_dir = crt_current_out_dir
   if (current_os == "mac") {
@@ -518,6 +566,8 @@ static_library("builtins") {
   if (!compiler_rt_exclude_atomic_builtin) {
     sources += [ "atomic.c" ]
   }
+
+  deps = lse_targets
 }
 
 # Currently unused but necessary to make sync_source_lists_from_cmake.py happy.


        


More information about the llvm-commits mailing list