2010-11-29 19:44:50 +00:00
|
|
|
//===- llvm/Support/Atomic.h - Atomic Operations -----------------*- C++ -*-===//
|
2009-05-14 05:54:36 +00:00
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2013-01-10 00:45:19 +00:00
|
|
|
#ifndef LLVM_SUPPORT_ATOMIC_H
|
|
|
|
#define LLVM_SUPPORT_ATOMIC_H
|
2009-05-14 21:24:15 +00:00
|
|
|
|
2010-11-29 18:16:10 +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-12-07 05:29:59 +00:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
typedef long cas_flag;
|
|
|
|
#else
|
2009-06-23 20:17:22 +00:00
|
|
|
typedef uint32_t cas_flag;
|
2009-12-07 05:29:59 +00:00
|
|
|
#endif
|
2009-06-23 20:17:22 +00:00
|
|
|
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
|