1 //===- NewPMDriver.h - Function to drive opt with the new PM ----*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
10 /// A single function which is called to drive the opt behavior for the new
13 /// This is only in a separate TU with a header to avoid including all of the
14 /// old pass manager headers and the new pass manager headers into the same
15 /// file. Eventually all of the routines here will get folded back into
18 //===----------------------------------------------------------------------===//
20 #ifndef LLVM_TOOLS_OPT_NEWPMDRIVER_H
21 #define LLVM_TOOLS_OPT_NEWPMDRIVER_H
23 #include "llvm/Support/CommandLine.h"
31 class TargetLibraryInfoImpl
;
33 extern cl::opt
<bool> DebugifyEach
;
34 extern cl::opt
<std::string
> DebugifyExport
;
36 extern cl::opt
<bool> VerifyEachDebugInfoPreserve
;
37 extern cl::opt
<std::string
> VerifyDIPreserveExport
;
44 OK_OutputThinLTOBitcode
,
46 enum VerifierKind
{ VK_NoVerifier
, VK_VerifyOut
, VK_VerifyEachPass
};
53 enum CSPGOKind
{ NoCSPGO
, CSInstrGen
, CSInstrUse
};
56 void printPasses(raw_ostream
&OS
);
58 /// Driver function to run the new pass manager over a module.
60 /// This function only exists factored away from opt.cpp in order to prevent
61 /// inclusion of the new pass manager headers and the old headers into the same
62 /// file. It's interface is consequentially somewhat ad-hoc, but will go away
63 /// when the transition finishes.
65 /// ThinLTOLinkOut is only used when OK is OK_OutputThinLTOBitcode, and can be
67 bool runPassPipeline(StringRef Arg0
, Module
&M
, TargetMachine
*TM
,
68 TargetLibraryInfoImpl
*TLII
, ToolOutputFile
*Out
,
69 ToolOutputFile
*ThinLinkOut
, ToolOutputFile
*OptRemarkFile
,
70 StringRef PassPipeline
, ArrayRef
<PassPlugin
> PassPlugins
,
71 opt_tool::OutputKind OK
, opt_tool::VerifierKind VK
,
72 bool ShouldPreserveAssemblyUseListOrder
,
73 bool ShouldPreserveBitcodeUseListOrder
,
74 bool EmitSummaryIndex
, bool EmitModuleHash
,
75 bool EnableDebugify
, bool VerifyDIPreserve
,
76 bool UnifiedLTO
= false);