LLVM
8.0.1
lib
Support
Windows
ThreadLocal.inc
Go to the documentation of this file.
1
//= llvm/Support/Win32/ThreadLocal.inc - Win32 Thread Local Data -*- C++ -*-===//
2
//
3
// The LLVM Compiler Infrastructure
4
//
5
// This file is distributed under the University of Illinois Open Source
6
// License. See LICENSE.TXT for details.
7
//
8
//===----------------------------------------------------------------------===//
9
//
10
// This file implements the Win32 specific (non-pthread) ThreadLocal class.
11
//
12
//===----------------------------------------------------------------------===//
13
14
//===----------------------------------------------------------------------===//
15
//=== WARNING: Implementation here must contain only generic Win32 code that
16
//=== is guaranteed to work on *all* Win32 variants.
17
//===----------------------------------------------------------------------===//
18
19
#include "
WindowsSupport.h
"
20
#include "
llvm/Support/ThreadLocal.h
"
21
22
namespace
llvm
{
23
24
sys::ThreadLocalImpl::ThreadLocalImpl
() : data() {
25
static_assert(
sizeof
(
DWORD
) <=
sizeof
(data),
"size too big"
);
26
DWORD
* tls =
reinterpret_cast<
DWORD
*
>
(&data);
27
*tls = TlsAlloc();
28
assert
(*tls != TLS_OUT_OF_INDEXES);
29
}
30
31
sys::ThreadLocalImpl::~ThreadLocalImpl
() {
32
DWORD
* tls =
reinterpret_cast<
DWORD
*
>
(&data);
33
TlsFree(*tls);
34
}
35
36
void
*
sys::ThreadLocalImpl::getInstance
() {
37
DWORD
* tls =
reinterpret_cast<
DWORD
*
>
(&data);
38
return
TlsGetValue(*tls);
39
}
40
41
void
sys::ThreadLocalImpl::setInstance
(
const
void
* d){
42
DWORD
* tls =
reinterpret_cast<
DWORD
*
>
(&data);
43
int
errorcode = TlsSetValue(*tls, const_cast<void*>(d));
44
assert
(errorcode != 0);
45
(void)errorcode;
46
}
47
48
void
sys::ThreadLocalImpl::removeInstance
() {
49
setInstance(0);
50
}
51
52
}
llvm::sys::ThreadLocalImpl::getInstance
void * getInstance()
llvm::sys::ThreadLocalImpl::removeInstance
void removeInstance()
llvm
This class represents lattice values for constants.
Definition:
AllocatorList.h:24
WindowsSupport.h
llvm::sys::ThreadLocalImpl::~ThreadLocalImpl
virtual ~ThreadLocalImpl()
llvm::sys::ThreadLocalImpl::ThreadLocalImpl
ThreadLocalImpl()
ThreadLocal.h
llvm::sys::ThreadLocalImpl::setInstance
void setInstance(const void *d)
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::AMDGPU::SDWA::DWORD
Definition:
SIDefines.h:367
Generated on Sun Dec 20 2020 13:55:59 for LLVM by
1.8.13