diff options
| author | Brian Anderson <banderson@mozilla.com> | 2013-06-13 12:42:02 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2013-06-13 13:08:57 -0700 |
| commit | 541c657a738006d78171aa261125a6a46f283b35 (patch) | |
| tree | cbbf3fd0040bc473e5a45908ee669f5491262e82 /src/rustllvm/RustWrapper.cpp | |
| parent | 19adece68b00bd1873499cca6f1537750608d769 (diff) | |
| download | rust-541c657a738006d78171aa261125a6a46f283b35.tar.gz rust-541c657a738006d78171aa261125a6a46f283b35.zip | |
Revert "Remove all usage of the global LLVMContextRef"
This reverts commit 779191cd4b8719e8efdf69fb6da93e2a8905ca1d. Conflicts: src/librustc/middle/trans/base.rs src/librustc/middle/trans/common.rs
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
| -rw-r--r-- | src/rustllvm/RustWrapper.cpp | 29 |
1 files changed, 5 insertions, 24 deletions
diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp index 17eb0f50b9b..4ee5df28d24 100644 --- a/src/rustllvm/RustWrapper.cpp +++ b/src/rustllvm/RustWrapper.cpp @@ -447,10 +447,9 @@ LLVMRustWriteOutputFile(LLVMPassManagerRef PMR, return true; } -extern "C" LLVMModuleRef LLVMRustParseAssemblyFile(LLVMContextRef C, - const char *Filename) { +extern "C" LLVMModuleRef LLVMRustParseAssemblyFile(const char *Filename) { SMDiagnostic d; - Module *m = ParseAssemblyFile(Filename, d, *unwrap(C)); + Module *m = ParseAssemblyFile(Filename, d, getGlobalContext()); if (m) { return wrap(m); } else { @@ -500,6 +499,9 @@ extern "C" LLVMValueRef LLVMGetOrInsertFunction(LLVMModuleRef M, extern "C" LLVMTypeRef LLVMMetadataTypeInContext(LLVMContextRef C) { return wrap(Type::getMetadataTy(*unwrap(C))); } +extern "C" LLVMTypeRef LLVMMetadataType(void) { + return LLVMMetadataTypeInContext(LLVMGetGlobalContext()); +} extern "C" LLVMValueRef LLVMBuildAtomicLoad(LLVMBuilderRef B, LLVMValueRef source, @@ -559,24 +561,3 @@ extern "C" LLVMValueRef LLVMInlineAsm(LLVMTypeRef Ty, Constraints, HasSideEffects, IsAlignStack, (InlineAsm::AsmDialect) Dialect)); } - -/** - * This function is intended to be a threadsafe interface into enabling a - * multithreaded LLVM. This is invoked at the start of the translation phase of - * compilation to ensure that LLVM is ready. - * - * All of trans properly isolates LLVM with the use of a different - * LLVMContextRef per task, thus allowing parallel compilation of different - * crates in the same process. At the time of this writing, the use case for - * this is unit tests for rusti, but there are possible other applications. - */ -extern "C" bool LLVMRustStartMultithreading() { - static Mutex lock; - bool ret = true; - assert(lock.acquire()); - if (!LLVMIsMultithreaded()) { - ret = LLVMStartMultithreaded(); - } - assert(lock.release()); - return ret; -} |
