diff options
Diffstat (limited to 'llvm/lib/Target/X86')
-rw-r--r-- | llvm/lib/Target/X86/X86JITInfo.cpp | 10 | ||||
-rw-r--r-- | llvm/lib/Target/X86/X86JITInfo.h | 11 |
2 files changed, 20 insertions, 1 deletions
diff --git a/llvm/lib/Target/X86/X86JITInfo.cpp b/llvm/lib/Target/X86/X86JITInfo.cpp index 7b3a0703277..f8761dc87e2 100644 --- a/llvm/lib/Target/X86/X86JITInfo.cpp +++ b/llvm/lib/Target/X86/X86JITInfo.cpp @@ -518,3 +518,13 @@ void X86JITInfo::relocate(void *Function, MachineRelocation *MR, } } } + +char* X86JITInfo::allocateThreadLocalMemory(size_t size) { +#if defined(X86_32_JIT) && !defined(__APPLE__) && !defined(_MSC_VER) + TLSOffset -= size; + return TLSOffset; +#else + assert(0 && "Cannot allocate thread local storage on this arch!\n"); + return 0; +#endif +} diff --git a/llvm/lib/Target/X86/X86JITInfo.h b/llvm/lib/Target/X86/X86JITInfo.h index f9fcefecff5..6b8d197846b 100644 --- a/llvm/lib/Target/X86/X86JITInfo.h +++ b/llvm/lib/Target/X86/X86JITInfo.h @@ -23,8 +23,12 @@ namespace llvm { class X86JITInfo : public TargetJITInfo { X86TargetMachine &TM; intptr_t PICBase; + char* TLSOffset; public: - explicit X86JITInfo(X86TargetMachine &tm) : TM(tm) {useGOT = 0;} + explicit X86JITInfo(X86TargetMachine &tm) : TM(tm) { + useGOT = 0; + TLSOffset = 0; + } /// replaceMachineCodeForFunction - Make it so that calling the function /// whose machine code is at OLD turns into a call to NEW, perhaps by @@ -56,6 +60,11 @@ namespace llvm { /// referenced global symbols. virtual void relocate(void *Function, MachineRelocation *MR, unsigned NumRelocs, unsigned char* GOTBase); + + /// allocateThreadLocalMemory - Each target has its own way of + /// handling thread local variables. This method returns a value only + /// meaningful to the target. + virtual char* allocateThreadLocalMemory(size_t size); /// setPICBase / getPICBase - Getter / setter of PICBase, used to compute /// PIC jumptable entry. |