From 789acfb63d66b724c431bea498a89ebe61c33bc0 Mon Sep 17 00:00:00 2001 From: Hans Wennborg Date: Fri, 1 Jun 2012 16:27:21 +0000 Subject: 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. llvm-svn: 157818 --- llvm/lib/Target/X86/X86TargetMachine.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'llvm/lib/Target/X86/X86TargetMachine.cpp') diff --git a/llvm/lib/Target/X86/X86TargetMachine.cpp b/llvm/lib/Target/X86/X86TargetMachine.cpp index 89c388415bd..c066a5603db 100644 --- a/llvm/lib/Target/X86/X86TargetMachine.cpp +++ b/llvm/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()); -- cgit v1.2.3