summary refs log tree commit diff
path: root/src/librustc_codegen_llvm
diff options
context:
space:
mode:
authorVictor Ding <victording@google.com>2019-12-02 20:53:01 +1100
committerVictor Ding <victording@google.com>2019-12-02 21:04:44 +1100
commit85df207ecc3a7b8b7150e2b65c67eec3a23b7c81 (patch)
tree29213a1e7182bfb262566a83af5ff2e8c4202b73 /src/librustc_codegen_llvm
parentf5c81e0a986e4285d3d0fd781a1bd475753eb12c (diff)
downloadrust-85df207ecc3a7b8b7150e2b65c67eec3a23b7c81.tar.gz
rust-85df207ecc3a7b8b7150e2b65c67eec3a23b7c81.zip
Use Module::print() instead of a PrintModulePass
llvm::Module has a print() method. It is unnecessary to create a
pass just for the purpose of printing LLVM IR.
Diffstat (limited to 'src/librustc_codegen_llvm')
-rw-r--r--src/librustc_codegen_llvm/back/write.rs13
-rw-r--r--src/librustc_codegen_llvm/llvm/ffi.rs3
2 files changed, 6 insertions, 10 deletions
diff --git a/src/librustc_codegen_llvm/back/write.rs b/src/librustc_codegen_llvm/back/write.rs
index 07ac76cec99..187063b866a 100644
--- a/src/librustc_codegen_llvm/back/write.rs
+++ b/src/librustc_codegen_llvm/back/write.rs
@@ -587,14 +587,11 @@ pub(crate) unsafe fn codegen(cgcx: &CodegenContext<LlvmCodegenBackend>,
                     cursor.position() as size_t
                 }
 
-                with_codegen(tm, llmod, config.no_builtins, |cpm| {
-                    let result =
-                        llvm::LLVMRustPrintModule(cpm, llmod, out_c.as_ptr(), demangle_callback);
-                    llvm::LLVMDisposePassManager(cpm);
-                    result.into_result().map_err(|()| {
-                        let msg = format!("failed to write LLVM IR to {}", out.display());
-                        llvm_err(diag_handler, &msg)
-                    })
+                let result =
+                    llvm::LLVMRustPrintModule(llmod, out_c.as_ptr(), demangle_callback);
+                result.into_result().map_err(|()| {
+                    let msg = format!("failed to write LLVM IR to {}", out.display());
+                    llvm_err(diag_handler, &msg)
                 })?;
             }
 
diff --git a/src/librustc_codegen_llvm/llvm/ffi.rs b/src/librustc_codegen_llvm/llvm/ffi.rs
index a49e863fa21..762c821de4d 100644
--- a/src/librustc_codegen_llvm/llvm/ffi.rs
+++ b/src/librustc_codegen_llvm/llvm/ffi.rs
@@ -1726,8 +1726,7 @@ extern "C" {
                                    Output: *const c_char,
                                    FileType: FileType)
                                    -> LLVMRustResult;
-    pub fn LLVMRustPrintModule(PM: &PassManager<'a>,
-                               M: &'a Module,
+    pub fn LLVMRustPrintModule(M: &'a Module,
                                Output: *const c_char,
                                Demangle: extern fn(*const c_char,
                                                    size_t,