LLVM  8.0.1
Atomic.h
Go to the documentation of this file.
1 //===- llvm/Support/Atomic.h - Atomic Operations -----------------*- 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 declares the llvm::sys atomic operations.
11 //
12 // DO NOT USE IN NEW CODE!
13 //
14 // New code should always rely on the std::atomic facilities in C++11.
15 //
16 //===----------------------------------------------------------------------===//
17 
18 #ifndef LLVM_SUPPORT_ATOMIC_H
19 #define LLVM_SUPPORT_ATOMIC_H
20 
21 #include "llvm/Support/DataTypes.h"
22 
23 // Windows will at times define MemoryFence.
24 #ifdef MemoryFence
25 #undef MemoryFence
26 #endif
27 
28 namespace llvm {
29  namespace sys {
30  void MemoryFence();
31 
32 #ifdef _MSC_VER
33  typedef long cas_flag;
34 #else
35  typedef uint32_t cas_flag;
36 #endif
37  cas_flag CompareAndSwap(volatile cas_flag* ptr,
38  cas_flag new_value,
39  cas_flag old_value);
40  }
41 }
42 
43 #endif
This class represents lattice values for constants.
Definition: AllocatorList.h:24
cas_flag CompareAndSwap(volatile cas_flag *ptr, cas_flag new_value, cas_flag old_value)
Definition: Atomic.cpp:45
void MemoryFence()
Definition: Atomic.cpp:31
uint32_t cas_flag
Definition: Atomic.h:35