LLVM: lib/Support/ManagedStatic.cpp Source File (original) (raw)

Go to the documentation of this file.

1

2

3

4

5

6

7

8

9

10

11

12

14#include "llvm/Config/config.h"

16#include

17#include

18using namespace llvm;

19

21

23 static std::recursive_mutex m;

24 return &m;

25}

26

28 void (*Deleter)(void*)) const {

32

33 if (Ptr.load(std::memory_order_relaxed)) {

34 void *Tmp = Creator();

35

36 Ptr.store(Tmp, std::memory_order_release);

38

39

42 }

43 } else {

45 "Partially initialized ManagedStatic!?");

46 Ptr = Creator();

48

49

52 }

53}

54

56 assert(DeleterFn && "ManagedStatic not initialized correctly!");

58 "Not destroyed in reverse order of construction?");

59

61 Next = nullptr;

62

63

65

66

67 Ptr = nullptr;

69}

70

71

72

73

74

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

static std::recursive_mutex * getManagedStaticMutex()

Definition ManagedStatic.cpp:22

static const ManagedStaticBase * StaticList

Definition ManagedStatic.cpp:20

ManagedStaticBase - Common base class for ManagedStatic instances.

LLVM_ABI void RegisterManagedStatic(void *(*creator)(), void(*deleter)(void *)) const

Definition ManagedStatic.cpp:27

void(* DeleterFn)(void *)

const ManagedStaticBase * Next

std::atomic< void * > Ptr

LLVM_ABI void destroy() const

Definition ManagedStatic.cpp:55

This is an optimization pass for GlobalISel generic memory operations.

constexpr bool llvm_is_multithreaded()

Returns true if LLVM is compiled with support for multi-threading, and false otherwise.

LLVM_ABI void llvm_shutdown()

llvm_shutdown - Deallocate and destroy all ManagedStatic variables.

Definition ManagedStatic.cpp:75