1 //===- NewPMDriver.cpp - Driver for opt with new PM -----------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 /// This file is just a split of the code that logically belongs in opt.cpp but
12 /// that includes the new pass manager headers.
14 //===----------------------------------------------------------------------===//
16 #include "NewPMDriver.h"
18 #include "llvm/ADT/StringRef.h"
19 #include "llvm/IR/LLVMContext.h"
20 #include "llvm/IR/Module.h"
21 #include "llvm/IR/PassManager.h"
22 #include "llvm/Support/CommandLine.h"
23 #include "llvm/Support/ToolOutputFile.h"
27 bool llvm::runPassPipeline(StringRef Arg0, LLVMContext &Context, Module &M,
28 tool_output_file *Out, StringRef PassPipeline,
30 // Before executing passes, print the final values of the LLVM options.
31 cl::PrintOptionValues();
33 ModulePassManager MPM;
34 if (!parsePassPipeline(MPM, PassPipeline)) {
35 errs() << Arg0 << ": unable to parse pass pipeline description.\n";
39 // Now that we have all of the passes ready, run them.