Add atomic load/store

This commit is contained in:
Siu Kwan Lam 2012-08-03 11:56:59 -07:00
commit 6ac0f3c369
6 changed files with 136 additions and 0 deletions

View file

@ -2048,6 +2048,28 @@ class Builder(object):
return self.atomic_rmw('umin', *args, **kwargs)
def atomic_load(self, ptr, ordering, crossthread=True, volatile=False, name=""):
check_is_value(ptr)
inst = _make_value(_core.LLVMBuildAtomicLoad(
self.ptr, ptr.ptr, ordering.lower(),
int(bool(crossthread))))
if volatile:
inst.set_volatile(volatile)
if inst:
inst.name = name
return inst
def atomic_store(self, value, ptr, ordering, crossthread=True,
volatile=False):
check_is_value(value)
check_is_value(ptr)
inst = _make_value(_core.LLVMBuildAtomicStore(
self.ptr, ptr.ptr, value.ptr,
ordering.lower(), int(bool(crossthread))))
if volatile:
inst.set_volatile(volatile)
return inst
#===----------------------------------------------------------------------===
# Memory buffer
#===----------------------------------------------------------------------===