aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2009-04-19 21:38:35 +0000
committerEli Friedman <eli.friedman@gmail.com>2009-04-19 21:38:35 +0000
commitb030f0272500c6c5602f587ac029ee0dc0e5a05c (patch)
tree558d1e4760d28ff1f8ed6c8d8995aab35f146e66
parentf545be5552b6fd40a4c766fbf82dab0ab5305790 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69552 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Basic/TargetInfo.h6
-rw-r--r--lib/Basic/TargetInfo.cpp1
-rw-r--r--lib/Basic/Targets.cpp12
3 files changed, 16 insertions, 3 deletions
diff --git a/include/clang/Basic/TargetInfo.h b/include/clang/Basic/TargetInfo.h
index 8018a17c9e..96811f0e60 100644
--- a/include/clang/Basic/TargetInfo.h
+++ b/include/clang/Basic/TargetInfo.h
@@ -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;
diff --git a/lib/Basic/TargetInfo.cpp b/lib/Basic/TargetInfo.cpp
index 923a75d622..b66e26f3a9 100644
--- a/lib/Basic/TargetInfo.cpp
+++ b/lib/Basic/TargetInfo.cpp
@@ -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;
diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
index fa23ba9162..c392e58b48 100644
--- a/lib/Basic/Targets.cpp
+++ b/lib/Basic/Targets.cpp
@@ -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;