LLVM  14.0.0git
ThreadLocal.cpp
Go to the documentation of this file.
1 //===- ThreadLocal.cpp - Thread Local Data ----------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file implements the llvm::sys::ThreadLocal class.
10 //
11 //===----------------------------------------------------------------------===//
12 
14 #include "llvm/Config/llvm-config.h"
15 #include "llvm/Support/Compiler.h"
16 
17 //===----------------------------------------------------------------------===//
18 //=== WARNING: Implementation here must contain only TRULY operating system
19 //=== independent code.
20 //===----------------------------------------------------------------------===//
21 
22 #if !defined(LLVM_ENABLE_THREADS) || LLVM_ENABLE_THREADS == 0
23 // Define all methods as no-ops if threading is explicitly disabled
24 namespace llvm {
25 using namespace sys;
27 ThreadLocalImpl::~ThreadLocalImpl() { }
28 void ThreadLocalImpl::setInstance(const void* d) {
29  static_assert(sizeof(d) <= sizeof(data), "size too big");
30  void **pd = reinterpret_cast<void**>(&data);
31  *pd = const_cast<void*>(d);
32 }
33 void *ThreadLocalImpl::getInstance() {
34  void **pd = reinterpret_cast<void**>(&data);
35  return *pd;
36 }
37 void ThreadLocalImpl::removeInstance() {
38  setInstance(nullptr);
39 }
40 }
41 #elif defined(LLVM_ON_UNIX)
42 #include "Unix/ThreadLocal.inc"
43 #elif defined( _WIN32)
44 #include "Windows/ThreadLocal.inc"
45 #else
46 #warning Neither LLVM_ON_UNIX nor _WIN32 set in Support/ThreadLocal.cpp
47 #endif
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AllocatorList.h:23
ThreadLocal.inc
ThreadLocal.h
ThreadLocal.inc
llvm::sys::ThreadLocalImpl::ThreadLocalImpl
ThreadLocalImpl()
Compiler.h
d
the resulting code requires compare and branches when and if the revised code is with conditional branches instead of More there is a byte word extend before each where there should be only and the condition codes are not remembered when the same two values are compared twice More LSR enhancements i8 and i32 load store addressing modes are identical int int int d
Definition: README.txt:418