diff options
| author | Michael Howell <michael@notriddle.com> | 2022-09-20 10:12:59 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-20 10:12:59 -0700 |
| commit | 2c57a5b166d5e19ace5fea696a7f6d9d0cf6443b (patch) | |
| tree | 2aa58fa2ac710a3853e91fc6d2c5fafa97853be7 /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | |
| parent | 0d2e57cb045ed01ec9401d2d8091bf6cb735a533 (diff) | |
| parent | fac12e25dd49246242b2b04321698fb4cbc6d135 (diff) | |
| download | rust-2c57a5b166d5e19ace5fea696a7f6d9d0cf6443b.tar.gz rust-2c57a5b166d5e19ace5fea696a7f6d9d0cf6443b.zip | |
Rollup merge of #102001 - cuviper:build-atomic-capi, r=nikic
Use LLVM C-API to build atomic cmpxchg and fence We don't need C++ wrappers because the LLVM C API can build these.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
| -rw-r--r-- | compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp index 6ee3c7d6821..b2cfcf53c59 100644 --- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp @@ -406,45 +406,6 @@ extern "C" LLVMValueRef LLVMRustBuildAtomicStore(LLVMBuilderRef B, return wrap(SI); } -// FIXME: Use the C-API LLVMBuildAtomicCmpXchg and LLVMSetWeak -// once we raise our minimum support to LLVM 10. -extern "C" LLVMValueRef -LLVMRustBuildAtomicCmpXchg(LLVMBuilderRef B, LLVMValueRef Target, - LLVMValueRef Old, LLVMValueRef Source, - LLVMAtomicOrdering Order, - LLVMAtomicOrdering FailureOrder, LLVMBool Weak) { - // Rust probably knows the alignment of the target value and should be able to - // specify something more precise than MaybeAlign here. See also - // https://reviews.llvm.org/D97224 which may be a useful reference. - AtomicCmpXchgInst *ACXI = unwrap(B)->CreateAtomicCmpXchg( - unwrap(Target), unwrap(Old), unwrap(Source), llvm::MaybeAlign(), fromRust(Order), - fromRust(FailureOrder)); - ACXI->setWeak(Weak); - return wrap(ACXI); -} - -enum class LLVMRustSynchronizationScope { - SingleThread, - CrossThread, -}; - -static SyncScope::ID fromRust(LLVMRustSynchronizationScope Scope) { - switch (Scope) { - case LLVMRustSynchronizationScope::SingleThread: - return SyncScope::SingleThread; - case LLVMRustSynchronizationScope::CrossThread: - return SyncScope::System; - default: - report_fatal_error("bad SynchronizationScope."); - } -} - -extern "C" LLVMValueRef -LLVMRustBuildAtomicFence(LLVMBuilderRef B, LLVMAtomicOrdering Order, - LLVMRustSynchronizationScope Scope) { - return wrap(unwrap(B)->CreateFence(fromRust(Order), fromRust(Scope))); -} - enum class LLVMRustAsmDialect { Att, Intel, |
