[llvm-commits] [126020] Add TLS support, patch by Lauro, thanks!

clattner at apple.com clattner at apple.com
Thu Apr 12 11:50:47 PDT 2007


Revision: 126020
Author:   clattner
Date:     2007-04-12 11:50:47 -0700 (Thu, 12 Apr 2007)

Log Message:
-----------
Add TLS support, patch by Lauro, thanks!

Modified Paths:
--------------
    apple-local/branches/llvm/gcc/llvm-backend.cpp

Modified: apple-local/branches/llvm/gcc/llvm-backend.cpp
===================================================================
--- apple-local/branches/llvm/gcc/llvm-backend.cpp	2007-04-12 18:36:45 UTC (rev 126019)
+++ apple-local/branches/llvm/gcc/llvm-backend.cpp	2007-04-12 18:50:47 UTC (rev 126020)
@@ -538,8 +538,6 @@
 
   // FIXME: Support alignment on globals: DECL_ALIGN.
   // FIXME: DECL_PRESERVE_P indicates the var is marked with attribute 'used'.
-  if (TREE_CODE(decl) == VAR_DECL && DECL_THREAD_LOCAL(decl))
-    sorry("thread-local data not supported by LLVM yet!");
 
   // Global register variables don't turn into LLVM GlobalVariables.
   if (TREE_CODE(decl) == VAR_DECL && DECL_REGISTER(decl))
@@ -589,7 +587,11 @@
  
   // Set the initializer.
   GV->setInitializer(Init);
-  
+
+  // Set thread local (TLS)
+  if (TREE_CODE(decl) == VAR_DECL && DECL_THREAD_LOCAL(decl))
+    GV->setThreadLocal(true);
+
   // Set the linkage.
   if (!TREE_PUBLIC(decl)) {
     GV->setLinkage(GlobalValue::InternalLinkage);
@@ -876,6 +878,10 @@
       }
     }
 
+    // Set thread local (TLS)
+    if (TREE_CODE(decl) == VAR_DECL && DECL_THREAD_LOCAL(decl))
+      GV->setThreadLocal(true);
+
     SET_DECL_LLVM(decl, GV);
   }
   timevar_pop(TV_LLVM_GLOBALS);





More information about the llvm-commits mailing list