summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp47
1 files changed, 2 insertions, 45 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
index 6ee3c7d68..6f36281af 100644
--- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
+++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
@@ -12,7 +12,7 @@
#include "llvm/Object/COFFImportFile.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Pass.h"
-#include "llvm/Bitcode/BitcodeWriterPass.h"
+#include "llvm/Bitcode/BitcodeWriter.h"
#include "llvm/Support/Signals.h"
#include "llvm/ADT/Optional.h"
@@ -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,
@@ -1709,11 +1670,7 @@ LLVMRustModuleBufferCreate(LLVMModuleRef M) {
auto Ret = std::make_unique<LLVMRustModuleBuffer>();
{
raw_string_ostream OS(Ret->data);
- {
- legacy::PassManager PM;
- PM.add(createBitcodeWriterPass(OS));
- PM.run(*unwrap(M));
- }
+ WriteBitcodeToFile(*unwrap(M), OS);
}
return Ret.release();
}