2009-05-14 07:54:36 +02: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 23:24:15 +02:00
|
|
|
#ifndef LLVM_SYSTEM_ATOMIC_H
|
|
|
|
#define LLVM_SYSTEM_ATOMIC_H
|
|
|
|
|
2009-05-21 02:48:13 +02:00
|
|
|
#include "llvm/Support/DataTypes.h"
|
2009-05-14 07:54:36 +02:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
namespace sys {
|
2009-05-20 20:26:15 +02:00
|
|
|
void MemoryFence();
|
2009-05-15 13:04:52 +02:00
|
|
|
|
2009-06-23 22:17:22 +02: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 23:19:04 +02:00
|
|
|
cas_flag AtomicMul(volatile cas_flag* ptr, cas_flag val);
|
|
|
|
cas_flag AtomicDiv(volatile cas_flag* ptr, cas_flag val);
|
2009-05-14 07:54:36 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-05-15 13:04:52 +02:00
|
|
|
#endif
|