]> granicus.if.org Git - clang/commitdiff
Add target property for whether thread-local storage is supported.
authorEli Friedman <eli.friedman@gmail.com>
Sun, 19 Apr 2009 21:38:35 +0000 (21:38 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Sun, 19 Apr 2009 21:38:35 +0000 (21:38 +0000)
Let me know if I messed up for some target.  Note that for Windows, we
should be able to support it (MSVC supports "__declspec(thread)"), but
I'm pretty sure LLVM doesn't know how to generate the correct code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69552 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/TargetInfo.h
lib/Basic/TargetInfo.cpp
lib/Basic/Targets.cpp

index 8018a17c9e07def44f63f7e9ba0a34e449254cfe..96811f0e6016f06fb044c387c20bcd6221e0e21b 100644 (file)
@@ -36,6 +36,7 @@ protected:
   // Target values set by the ctor of the actual target implementation.  Default
   // values are specified by the TargetInfo constructor.
   bool CharIsSigned;
+  bool TLSSupported;
   unsigned char PointerWidth, PointerAlign;
   unsigned char WCharWidth, WCharAlign;
   unsigned char IntWidth, IntAlign;
@@ -311,6 +312,11 @@ public:
     return RegParmMax;
   }
 
+  // isTLSSupported - Whether the target supports thread-local storage
+  unsigned isTLSSupported() const {
+    return TLSSupported;
+  }
+
 protected:
   virtual uint64_t getPointerWidthV(unsigned AddrSpace) const {
     return PointerWidth;
index 923a75d622817c528f9c8e88eecb140c360593a6..b66e26f3a9716d9310ff4d4d451de31b1b17de44 100644 (file)
@@ -23,6 +23,7 @@ TargetInfo::TargetInfo(const std::string &T) : Triple(T) {
   // like PPC or SPARC.
   // These should be overridden by concrete targets as needed.
   CharIsSigned = true;
+  TLSSupported = true;
   PointerWidth = PointerAlign = 32;
   WCharWidth = WCharAlign = 32;
   IntWidth = IntAlign = 32;
index fa23ba916214e0c1e4ba008fa81996255213e8c8..c392e58b48674849897a2c322a1a3b801c34f30c 100644 (file)
@@ -718,6 +718,7 @@ public:
     DescriptionString = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-"
                         "i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-"
                         "a0:0:64-f80:128:128";
+    TLSSupported = false;
   }
 
   virtual const char *getStringSymbolPrefix(bool IsConstant) const { 
@@ -801,6 +802,7 @@ class WindowsX86_32TargetInfo : public X86_32TargetInfo {
 public:
   WindowsX86_32TargetInfo(const std::string& triple)
     : X86_32TargetInfo(triple) {
+    TLSSupported = false;
     // FIXME: Fix wchar_t.
     // FIXME: We should probably enable -fms-extensions by default for
     // this target.
@@ -879,8 +881,9 @@ namespace {
 // x86-64 Darwin (OS X) target
 class DarwinX86_64TargetInfo : public X86_64TargetInfo {
 public:
-  DarwinX86_64TargetInfo(const std::string& triple) :
-    X86_64TargetInfo(triple) {}
+  DarwinX86_64TargetInfo(const std::string& triple) : X86_64TargetInfo(triple) {
+    TLSSupported = false;
+  }
 
   virtual const char *getStringSymbolPrefix(bool IsConstant) const { 
     return IsConstant ? "\01LC" : "\01lC";
@@ -1012,7 +1015,9 @@ public:
 namespace {
 class DarwinARMTargetInfo : public ARMTargetInfo {
 public:
-  DarwinARMTargetInfo(const std::string& triple) : ARMTargetInfo(triple) {}
+  DarwinARMTargetInfo(const std::string& triple) : ARMTargetInfo(triple) {
+    TLSSupported = false;
+  }
 
   virtual void getTargetDefines(const LangOptions &Opts,
                                 std::vector<char> &Defines) const {
@@ -1155,6 +1160,7 @@ namespace {
   class PIC16TargetInfo : public TargetInfo{
   public:
     PIC16TargetInfo(const std::string& triple) : TargetInfo(triple) {
+      TLSSupported = false;
       IntWidth = 16;
       LongWidth = LongLongWidth = 32;
       PointerWidth = 16;