Skip to content

Commit 7304237

Browse files
authored
Add atomic intrinsics (#308)
1 parent acc89d6 commit 7304237

File tree

6 files changed

+776
-0
lines changed

6 files changed

+776
-0
lines changed

src/core/instructions.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,18 @@ for op in opcodes
129129
end
130130

131131

132+
## atomics
133+
134+
export ordering, ordering!
135+
136+
# Ordering getter/setter are supported only for a subset of instructions
137+
# https://github.com/llvm/llvm-project/blob/llvmorg-14.0.3/llvm/lib/IR/Core.cpp#L3779-L3798
138+
139+
ordering(val::Union{LoadInst,StoreInst,AtomicRMWInst}) = API.LLVMGetOrdering(val)
140+
ordering!(val::Union{LoadInst,StoreInst}, ord::API.LLVMAtomicOrdering) =
141+
API.LLVMSetOrdering(val, ord)
142+
143+
132144
## call sites and invocations
133145

134146
# TODO: add this to the actual type hierarchy

src/interop.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ include("interop/base.jl")
1010
include("interop/asmcall.jl")
1111
include("interop/passes.jl")
1212
include("interop/pointer.jl")
13+
include("interop/atomics.jl")
1314
include("interop/utils.jl")
1415
include("interop/intrinsics.jl")
1516

0 commit comments

Comments
 (0)