From e2dc71d312fb9e46ad89429bade1f221ea8e67ff Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Mon, 13 Jan 2014 07:38:24 +0000 Subject: [PM] Wire up support for writing bitcode with new PM. This moves the old pass creation functionality to its own header and updates the callers of that routine. Then it adds a new PM supporting bitcode writer to the header file, and wires that up in the opt tool. A test is added that round-trips code into bitcode and back out using the new pass manager. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199078 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/opt/NewPMDriver.cpp | 4 +++- tools/opt/opt.cpp | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'tools/opt') diff --git a/tools/opt/NewPMDriver.cpp b/tools/opt/NewPMDriver.cpp index c7534e794a..2d210387f8 100644 --- a/tools/opt/NewPMDriver.cpp +++ b/tools/opt/NewPMDriver.cpp @@ -16,6 +16,7 @@ #include "NewPMDriver.h" #include "Passes.h" #include "llvm/ADT/StringRef.h" +#include "llvm/Bitcode/BitcodeWriterPass.h" #include "llvm/IR/IRPrintingPasses.h" #include "llvm/IR/LLVMContext.h" #include "llvm/IR/Module.h" @@ -44,7 +45,8 @@ bool llvm::runPassPipeline(StringRef Arg0, LLVMContext &Context, Module &M, MPM.addPass(PrintModulePass(Out->os())); break; case OK_OutputBitcode: - llvm::report_fatal_error("Bitcode output is not yet implemented!"); + MPM.addPass(BitcodeWriterPass(Out->os())); + break; } // Before executing passes, print the final values of the LLVM options. diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp index c4ab342650..98cfdd9af3 100644 --- a/tools/opt/opt.cpp +++ b/tools/opt/opt.cpp @@ -20,7 +20,7 @@ #include "llvm/Analysis/LoopPass.h" #include "llvm/Analysis/RegionPass.h" #include "llvm/Analysis/Verifier.h" -#include "llvm/Bitcode/ReaderWriter.h" +#include "llvm/Bitcode/BitcodeWriterPass.h" #include "llvm/CodeGen/CommandFlags.h" #include "llvm/DebugInfo.h" #include "llvm/IR/DataLayout.h" -- cgit v1.2.3