blob: 7d74a5777d11566ae22903e6975ff9730501f6cc [file] [log] [blame]
Chandler Carruth4e728be2014-01-11 08:16:35 +00001//===- 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 Kramer00e08fc2014-08-13 16:26:38 +000021#ifndef LLVM_TOOLS_OPT_NEWPMDRIVER_H
22#define LLVM_TOOLS_OPT_NEWPMDRIVER_H
Chandler Carruth4e728be2014-01-11 08:16:35 +000023
Chandler Carruth4e728be2014-01-11 08:16:35 +000024namespace llvm {
Mehdi Aminif6071e12016-04-18 09:17:29 +000025class StringRef;
Chandler Carruth4e728be2014-01-11 08:16:35 +000026class LLVMContext;
27class Module;
Chandler Carruth7724e8e2015-02-01 10:11:22 +000028class TargetMachine;
Reid Kleckner97ca9642017-09-23 01:03:17 +000029class ToolOutputFile;
Chandler Carruth4e728be2014-01-11 08:16:35 +000030
Chandler Carruth4a760322014-01-13 03:08:40 +000031namespace opt_tool {
32enum OutputKind {
33 OK_NoOutput,
34 OK_OutputAssembly,
Tim Shen2e378852017-06-01 01:02:12 +000035 OK_OutputBitcode,
36 OK_OutputThinLTOBitcode,
Chandler Carruth4a760322014-01-13 03:08:40 +000037};
Chandler Carruth1d9ab252014-01-20 11:34:08 +000038enum VerifierKind {
39 VK_NoVerifier,
40 VK_VerifyInAndOut,
41 VK_VerifyEachPass
42};
Chandler Carruth4a760322014-01-13 03:08:40 +000043}
44
Adrian Prantl26b584c2018-05-01 15:54:18 +000045/// Driver function to run the new pass manager over a module.
Chandler Carruth4e728be2014-01-11 08:16:35 +000046///
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 Shen2e378852017-06-01 01:02:12 +000051///
52/// ThinLTOLinkOut is only used when OK is OK_OutputThinLTOBitcode, and can be
53/// nullptr.
54bool runPassPipeline(StringRef Arg0, Module &M, TargetMachine *TM,
Reid Kleckner97ca9642017-09-23 01:03:17 +000055 ToolOutputFile *Out, ToolOutputFile *ThinLinkOut,
56 ToolOutputFile *OptRemarkFile, StringRef PassPipeline,
Sam Elliott74a34d92017-08-20 01:30:45 +000057 opt_tool::OutputKind OK, opt_tool::VerifierKind VK,
Duncan P. N. Exon Smith2c7f24d2015-04-15 02:38:06 +000058 bool ShouldPreserveAssemblyUseListOrder,
Teresa Johnson3143f332016-08-12 13:53:02 +000059 bool ShouldPreserveBitcodeUseListOrder,
Vedant Kumarb8c067b2018-02-15 21:14:36 +000060 bool EmitSummaryIndex, bool EmitModuleHash,
61 bool EnableDebugify);
62} // namespace llvm
Chandler Carruth4e728be2014-01-11 08:16:35 +000063
64#endif