Chandler Carruth | 4e728be | 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 | 00e08fc | 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 | 4e728be | 2014-01-11 08:16:35 +0000 | [diff] [blame] | 23 | |
Chandler Carruth | 4e728be | 2014-01-11 08:16:35 +0000 | [diff] [blame] | 24 | namespace llvm { |
Mehdi Amini | f6071e1 | 2016-04-18 09:17:29 +0000 | [diff] [blame] | 25 | class StringRef; |
Chandler Carruth | 4e728be | 2014-01-11 08:16:35 +0000 | [diff] [blame] | 26 | class LLVMContext; |
| 27 | class Module; |
Chandler Carruth | 7724e8e | 2015-02-01 10:11:22 +0000 | [diff] [blame] | 28 | class TargetMachine; |
Reid Kleckner | 97ca964 | 2017-09-23 01:03:17 +0000 | [diff] [blame] | 29 | class ToolOutputFile; |
Chandler Carruth | 4e728be | 2014-01-11 08:16:35 +0000 | [diff] [blame] | 30 | |
Chandler Carruth | 4a76032 | 2014-01-13 03:08:40 +0000 | [diff] [blame] | 31 | namespace opt_tool { |
| 32 | enum OutputKind { |
| 33 | OK_NoOutput, |
| 34 | OK_OutputAssembly, |
Tim Shen | 2e37885 | 2017-06-01 01:02:12 +0000 | [diff] [blame] | 35 | OK_OutputBitcode, |
| 36 | OK_OutputThinLTOBitcode, |
Chandler Carruth | 4a76032 | 2014-01-13 03:08:40 +0000 | [diff] [blame] | 37 | }; |
Chandler Carruth | 1d9ab25 | 2014-01-20 11:34:08 +0000 | [diff] [blame] | 38 | enum VerifierKind { |
| 39 | VK_NoVerifier, |
| 40 | VK_VerifyInAndOut, |
| 41 | VK_VerifyEachPass |
| 42 | }; |
Chandler Carruth | 4a76032 | 2014-01-13 03:08:40 +0000 | [diff] [blame] | 43 | } |
| 44 | |
Adrian Prantl | 26b584c | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 45 | /// Driver function to run the new pass manager over a module. |
Chandler Carruth | 4e728be | 2014-01-11 08:16:35 +0000 | [diff] [blame] | 46 | /// |
| 47 | /// This function only exists factored away from opt.cpp in order to prevent |
| 48 | /// inclusion of the new pass manager headers and the old headers into the same |
| 49 | /// file. It's interface is consequentially somewhat ad-hoc, but will go away |
| 50 | /// when the transition finishes. |
Tim Shen | 2e37885 | 2017-06-01 01:02:12 +0000 | [diff] [blame] | 51 | /// |
| 52 | /// ThinLTOLinkOut is only used when OK is OK_OutputThinLTOBitcode, and can be |
| 53 | /// nullptr. |
| 54 | bool runPassPipeline(StringRef Arg0, Module &M, TargetMachine *TM, |
Reid Kleckner | 97ca964 | 2017-09-23 01:03:17 +0000 | [diff] [blame] | 55 | ToolOutputFile *Out, ToolOutputFile *ThinLinkOut, |
| 56 | ToolOutputFile *OptRemarkFile, StringRef PassPipeline, |
Sam Elliott | 74a34d9 | 2017-08-20 01:30:45 +0000 | [diff] [blame] | 57 | opt_tool::OutputKind OK, opt_tool::VerifierKind VK, |
Duncan P. N. Exon Smith | 2c7f24d | 2015-04-15 02:38:06 +0000 | [diff] [blame] | 58 | bool ShouldPreserveAssemblyUseListOrder, |
Teresa Johnson | 3143f33 | 2016-08-12 13:53:02 +0000 | [diff] [blame] | 59 | bool ShouldPreserveBitcodeUseListOrder, |
Vedant Kumar | b8c067b | 2018-02-15 21:14:36 +0000 | [diff] [blame] | 60 | bool EmitSummaryIndex, bool EmitModuleHash, |
| 61 | bool EnableDebugify); |
| 62 | } // namespace llvm |
Chandler Carruth | 4e728be | 2014-01-11 08:16:35 +0000 | [diff] [blame] | 63 | |
| 64 | #endif |