Chandler Carruth | 6644538 | 2014-01-11 08:16:35 +0000 | [diff] [blame] | 1 | //===- NewPMDriver.h - Function to drive opt with the new PM ----*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | /// \file |
| 10 | /// |
| 11 | /// A single function which is called to drive the opt behavior for the new |
| 12 | /// PassManager. |
| 13 | /// |
| 14 | /// This is only in a separate TU with a header to avoid including all of the |
| 15 | /// old pass manager headers and the new pass manager headers into the same |
| 16 | /// file. Eventually all of the routines here will get folded back into |
| 17 | /// opt.cpp. |
| 18 | /// |
| 19 | //===----------------------------------------------------------------------===// |
| 20 | |
Benjamin Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 21 | #ifndef LLVM_TOOLS_OPT_NEWPMDRIVER_H |
| 22 | #define LLVM_TOOLS_OPT_NEWPMDRIVER_H |
Chandler Carruth | 6644538 | 2014-01-11 08:16:35 +0000 | [diff] [blame] | 23 | |
Chandler Carruth | 6644538 | 2014-01-11 08:16:35 +0000 | [diff] [blame] | 24 | namespace llvm { |
Mehdi Amini | b550cb1 | 2016-04-18 09:17:29 +0000 | [diff] [blame] | 25 | class StringRef; |
Chandler Carruth | 6644538 | 2014-01-11 08:16:35 +0000 | [diff] [blame] | 26 | class LLVMContext; |
| 27 | class Module; |
Chandler Carruth | e038552 | 2015-02-01 10:11:22 +0000 | [diff] [blame] | 28 | class TargetMachine; |
Chandler Carruth | 6644538 | 2014-01-11 08:16:35 +0000 | [diff] [blame] | 29 | class tool_output_file; |
| 30 | |
Chandler Carruth | 949282e | 2014-01-13 03:08:40 +0000 | [diff] [blame] | 31 | namespace opt_tool { |
| 32 | enum OutputKind { |
| 33 | OK_NoOutput, |
| 34 | OK_OutputAssembly, |
| 35 | OK_OutputBitcode |
| 36 | }; |
Chandler Carruth | 4d35631 | 2014-01-20 11:34:08 +0000 | [diff] [blame] | 37 | enum VerifierKind { |
| 38 | VK_NoVerifier, |
| 39 | VK_VerifyInAndOut, |
| 40 | VK_VerifyEachPass |
| 41 | }; |
Chandler Carruth | 949282e | 2014-01-13 03:08:40 +0000 | [diff] [blame] | 42 | } |
| 43 | |
Chandler Carruth | 6644538 | 2014-01-11 08:16:35 +0000 | [diff] [blame] | 44 | /// \brief Driver function to run the new pass manager over a module. |
| 45 | /// |
| 46 | /// This function only exists factored away from opt.cpp in order to prevent |
| 47 | /// inclusion of the new pass manager headers and the old headers into the same |
| 48 | /// file. It's interface is consequentially somewhat ad-hoc, but will go away |
| 49 | /// when the transition finishes. |
Davide Italiano | c5d0a5c | 2016-09-07 00:48:47 +0000 | [diff] [blame] | 50 | bool runPassPipeline(StringRef Arg0, Module &M, |
Chandler Carruth | e038552 | 2015-02-01 10:11:22 +0000 | [diff] [blame] | 51 | TargetMachine *TM, tool_output_file *Out, |
| 52 | StringRef PassPipeline, opt_tool::OutputKind OK, |
Duncan P. N. Exon Smith | 679db33 | 2015-04-15 00:34:24 +0000 | [diff] [blame] | 53 | opt_tool::VerifierKind VK, |
Duncan P. N. Exon Smith | 8a74f68 | 2015-04-15 02:38:06 +0000 | [diff] [blame] | 54 | bool ShouldPreserveAssemblyUseListOrder, |
Teresa Johnson | f93b246 | 2016-08-12 13:53:02 +0000 | [diff] [blame] | 55 | bool ShouldPreserveBitcodeUseListOrder, |
| 56 | bool EmitSummaryIndex, bool EmitModuleHash); |
Chandler Carruth | 6644538 | 2014-01-11 08:16:35 +0000 | [diff] [blame] | 57 | } |
| 58 | |
| 59 | #endif |