aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/X86/X86TargetMachine.cpp
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2012-06-01 16:27:21 +0000
committerHans Wennborg <hans@hanshq.net>2012-06-01 16:27:21 +0000
commitf0234fcbc9be9798c10dedc3e3c134b7afbc6511 (patch)
tree58aa8ee7a2be4159fbbbfe5085f56ea7eee31b1e /lib/Target/X86/X86TargetMachine.cpp
parent6bb5c0074dc4cede2ad8efd420ec91288f91b012 (diff)
Implement the local-dynamic TLS model for x86 (PR3985)
This implements codegen support for accesses to thread-local variables using the local-dynamic model, and adds a clean-up pass so that the base address for the TLS block can be re-used between local-dynamic access on an execution path. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157818 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/X86TargetMachine.cpp')
-rw-r--r--lib/Target/X86/X86TargetMachine.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Target/X86/X86TargetMachine.cpp b/lib/Target/X86/X86TargetMachine.cpp
index 89c388415b..c066a5603d 100644
--- a/lib/Target/X86/X86TargetMachine.cpp
+++ b/lib/Target/X86/X86TargetMachine.cpp
@@ -147,6 +147,10 @@ bool X86PassConfig::addInstSelector() {
// Install an instruction selector.
PM->add(createX86ISelDag(getX86TargetMachine(), getOptLevel()));
+ // For ELF, cleanup any local-dynamic TLS accesses.
+ if (getX86Subtarget().isTargetELF() && getOptLevel() != CodeGenOpt::None)
+ PM->add(createCleanupLocalDynamicTLSPass());
+
// For 32-bit, prepend instructions to set the "global base reg" for PIC.
if (!getX86Subtarget().is64Bit())
PM->add(createGlobalBaseRegPass());