diff options
author | Hans Wennborg <hans@hanshq.net> | 2012-06-23 11:51:46 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2012-06-23 11:51:46 +0000 |
commit | d3b01bc7c6735a78ebdff0071647a15de5716bc7 (patch) | |
tree | 1bea08b4886b9dac974ae24ea644795b8b2fd0f6 /clang/lib/CodeGen/CodeGenModule.h | |
parent | cbe34b4cc98148b386a0c96cd195e7f62f52a6e3 (diff) | |
download | bcm5719-llvm-d3b01bc7c6735a78ebdff0071647a15de5716bc7.tar.gz bcm5719-llvm-d3b01bc7c6735a78ebdff0071647a15de5716bc7.zip |
Support the tls_model attribute (PR9788)
This adds support for the tls_model attribute. This allows the user to
choose a TLS model that is better than what LLVM would select by
default. For example, a variable might be declared as:
__thread int x __attribute__((tls_model("initial-exec")));
if it will not be used in a shared library that is dlopen'ed.
This depends on LLVM r159077.
llvm-svn: 159078
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.h')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h index 8f3bd78ac42..d1ecfec78a7 100644 --- a/clang/lib/CodeGen/CodeGenModule.h +++ b/clang/lib/CodeGen/CodeGenModule.h @@ -496,6 +496,15 @@ public: llvm_unreachable("unknown visibility!"); } + static llvm::GlobalVariable::ThreadLocalMode GetLLVMTLSModel(StringRef S) { + return llvm::StringSwitch<llvm::GlobalVariable::ThreadLocalMode>(S) + .Case("global-dynamic", llvm::GlobalVariable::GeneralDynamicTLSModel) + .Case("local-dynamic", llvm::GlobalVariable::LocalDynamicTLSModel) + .Case("initial-exec", llvm::GlobalVariable::InitialExecTLSModel) + .Case("local-exec", llvm::GlobalVariable::LocalExecTLSModel) + .Default(llvm::GlobalVariable::NotThreadLocal); + } + llvm::Constant *GetAddrOfGlobal(GlobalDecl GD) { if (isa<CXXConstructorDecl>(GD.getDecl())) return GetAddrOfCXXConstructor(cast<CXXConstructorDecl>(GD.getDecl()), |