2009-05-14 05:54:36 +00:00
|
|
|
//===- llvm/System/Atomic.h - Atomic Operations -----------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file declares the llvm::sys atomic operations.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2009-05-14 21:24:15 +00:00
|
|
|
#ifndef LLVM_SYSTEM_ATOMIC_H
|
|
|
|
#define LLVM_SYSTEM_ATOMIC_H
|
|
|
|
|
2009-05-21 00:48:13 +00:00
|
|
|
#include "llvm/Support/DataTypes.h"
|
2009-05-14 05:54:36 +00:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
namespace sys {
|
2009-05-20 18:26:15 +00:00
|
|
|
void MemoryFence();
|
2009-05-15 11:04:52 +00:00
|
|
|
|
2009-06-23 20:17:22 +00:00
|
|
|
typedef uint32_t cas_flag;
|
|
|
|
cas_flag CompareAndSwap(volatile cas_flag* ptr,
|
|
|
|
cas_flag new_value,
|
|
|
|
cas_flag old_value);
|
|
|
|
cas_flag AtomicIncrement(volatile cas_flag* ptr);
|
|
|
|
cas_flag AtomicDecrement(volatile cas_flag* ptr);
|
|
|
|
cas_flag AtomicAdd(volatile cas_flag* ptr, cas_flag val);
|
2009-06-23 21:19:04 +00:00
|
|
|
cas_flag AtomicMul(volatile cas_flag* ptr, cas_flag val);
|
|
|
|
cas_flag AtomicDiv(volatile cas_flag* ptr, cas_flag val);
|
2009-05-14 05:54:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-05-15 11:04:52 +00:00
|
|
|
#endif
|