15 #include "llvm/Config/llvm-config.h" 27 #if defined(__GNUC__) || (defined(__IBMCPP__) && __IBMCPP__ >= 1210) 32 #if LLVM_HAS_ATOMICS == 0 35 # if defined(GNU_ATOMICS) 37 # elif defined(_MSC_VER) 40 # error No memory fence implementation for your platform! 48 #if LLVM_HAS_ATOMICS == 0 50 if (result == old_value)
53 #elif defined(GNU_ATOMICS) 54 return __sync_val_compare_and_swap(ptr, old_value, new_value);
55 #elif defined(_MSC_VER) 56 return InterlockedCompareExchange(ptr, new_value, old_value);
58 # error No compare-and-swap implementation for your platform! This class represents lattice values for constants.
cas_flag CompareAndSwap(volatile cas_flag *ptr, cas_flag new_value, cas_flag old_value)