Add atomic load/store
This commit is contained in:
parent
4d763680f6
commit
6ac0f3c369
6 changed files with 136 additions and 0 deletions
22
llvm/core.py
22
llvm/core.py
|
|
@ -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
|
||||
#===----------------------------------------------------------------------===
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue