Home | History | Annotate | Download | only in Support
      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 //===----------------------------------------------------------------------===//
     13 
     14 #ifndef LLVM_SUPPORT_ATOMIC_H
     15 #define LLVM_SUPPORT_ATOMIC_H
     16 
     17 #include "llvm/Support/DataTypes.h"
     18 
     19 namespace llvm {
     20   namespace sys {
     21     void MemoryFence();
     22 
     23 #ifdef _MSC_VER
     24     typedef long cas_flag;
     25 #else
     26     typedef uint32_t cas_flag;
     27 #endif
     28     cas_flag CompareAndSwap(volatile cas_flag* ptr,
     29                             cas_flag new_value,
     30                             cas_flag old_value);
     31     cas_flag AtomicIncrement(volatile cas_flag* ptr);
     32     cas_flag AtomicDecrement(volatile cas_flag* ptr);
     33     cas_flag AtomicAdd(volatile cas_flag* ptr, cas_flag val);
     34     cas_flag AtomicMul(volatile cas_flag* ptr, cas_flag val);
     35     cas_flag AtomicDiv(volatile cas_flag* ptr, cas_flag val);
     36   }
     37 }
     38 
     39 #endif
     40