LLVM API Documentation
00001 //===- llvm/System/Atomic.h - Atomic Operations -----------------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file declares the llvm::sys atomic operations. 00011 // 00012 //===----------------------------------------------------------------------===// 00013 00014 #ifndef LLVM_SYSTEM_ATOMIC_H 00015 #define LLVM_SYSTEM_ATOMIC_H 00016 00017 #include "llvm/Support/DataTypes.h" 00018 00019 namespace llvm { 00020 namespace sys { 00021 void MemoryFence(); 00022 00023 typedef uint32_t cas_flag; 00024 cas_flag CompareAndSwap(volatile cas_flag* ptr, 00025 cas_flag new_value, 00026 cas_flag old_value); 00027 cas_flag AtomicIncrement(volatile cas_flag* ptr); 00028 cas_flag AtomicDecrement(volatile cas_flag* ptr); 00029 cas_flag AtomicAdd(volatile cas_flag* ptr, cas_flag val); 00030 cas_flag AtomicMul(volatile cas_flag* ptr, cas_flag val); 00031 cas_flag AtomicDiv(volatile cas_flag* ptr, cas_flag val); 00032 } 00033 } 00034 00035 #endif