[cfe-commits] r69552 - in /cfe/trunk: include/clang/Basic/TargetInfo.h lib/Basic/TargetInfo.cpp lib/Basic/Targets.cpp

Eli Friedman eli.friedman at gmail.com
Sun Apr 19 14:38:35 PDT 2009


Author: efriedma
Date: Sun Apr 19 16:38:35 2009
New Revision: 69552

URL: http://llvm.org/viewvc/llvm-project?rev=69552&view=rev
Log:
Add target property for whether thread-local storage is supported.  
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.


Modified:
    cfe/trunk/include/clang/Basic/TargetInfo.h
    cfe/trunk/lib/Basic/TargetInfo.cpp
    cfe/trunk/lib/Basic/Targets.cpp

Modified: cfe/trunk/include/clang/Basic/TargetInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TargetInfo.h?rev=69552&r1=69551&r2=69552&view=diff

==============================================================================
--- cfe/trunk/include/clang/Basic/TargetInfo.h (original)
+++ cfe/trunk/include/clang/Basic/TargetInfo.h Sun Apr 19 16:38:35 2009
@@ -36,6 +36,7 @@
   // 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 @@
     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;

Modified: cfe/trunk/lib/Basic/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/TargetInfo.cpp?rev=69552&r1=69551&r2=69552&view=diff

==============================================================================
--- cfe/trunk/lib/Basic/TargetInfo.cpp (original)
+++ cfe/trunk/lib/Basic/TargetInfo.cpp Sun Apr 19 16:38:35 2009
@@ -23,6 +23,7 @@
   // 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;

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=69552&r1=69551&r2=69552&view=diff

==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Sun Apr 19 16:38:35 2009
@@ -718,6 +718,7 @@
     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 @@
 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 @@
 // 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 @@
 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 @@
   class PIC16TargetInfo : public TargetInfo{
   public:
     PIC16TargetInfo(const std::string& triple) : TargetInfo(triple) {
+      TLSSupported = false;
       IntWidth = 16;
       LongWidth = LongLongWidth = 32;
       PointerWidth = 16;





More information about the cfe-commits mailing list