[DebugInfo] Avoid re-ordering assignments in LCSSA
[llvm-project.git] / llvm / tools / opt / NewPMDriver.h
blob87a71cec4c539eaae91ee67f43d6012eb999ca0c
1 //===- NewPMDriver.h - Function to drive opt with the new PM ----*- C++ -*-===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 /// \file
9 ///
10 /// A single function which is called to drive the opt behavior for the new
11 /// PassManager.
12 ///
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
16 /// opt.cpp.
17 ///
18 //===----------------------------------------------------------------------===//
20 #ifndef LLVM_TOOLS_OPT_NEWPMDRIVER_H
21 #define LLVM_TOOLS_OPT_NEWPMDRIVER_H
23 #include "llvm/ADT/ArrayRef.h"
24 #include "llvm/Support/CommandLine.h"
26 namespace llvm {
27 class StringRef;
28 class Module;
29 class TargetMachine;
30 class ToolOutputFile;
31 class TargetLibraryInfoImpl;
33 extern cl::opt<bool> DebugifyEach;
34 extern cl::opt<std::string> DebugifyExport;
36 namespace opt_tool {
37 enum OutputKind {
38 OK_NoOutput,
39 OK_OutputAssembly,
40 OK_OutputBitcode,
41 OK_OutputThinLTOBitcode,
43 enum VerifierKind {
44 VK_NoVerifier,
45 VK_VerifyInAndOut,
46 VK_VerifyEachPass
48 enum PGOKind {
49 NoPGO,
50 InstrGen,
51 InstrUse,
52 SampleUse
54 enum CSPGOKind { NoCSPGO, CSInstrGen, CSInstrUse };
57 /// Driver function to run the new pass manager over a module.
58 ///
59 /// This function only exists factored away from opt.cpp in order to prevent
60 /// inclusion of the new pass manager headers and the old headers into the same
61 /// file. It's interface is consequentially somewhat ad-hoc, but will go away
62 /// when the transition finishes.
63 ///
64 /// ThinLTOLinkOut is only used when OK is OK_OutputThinLTOBitcode, and can be
65 /// nullptr.
66 bool runPassPipeline(StringRef Arg0, Module &M, TargetMachine *TM,
67 TargetLibraryInfoImpl *TLII, ToolOutputFile *Out,
68 ToolOutputFile *ThinLinkOut, ToolOutputFile *OptRemarkFile,
69 StringRef PassPipeline, ArrayRef<StringRef> PassInfos,
70 opt_tool::OutputKind OK, opt_tool::VerifierKind VK,
71 bool ShouldPreserveAssemblyUseListOrder,
72 bool ShouldPreserveBitcodeUseListOrder,
73 bool EmitSummaryIndex, bool EmitModuleHash,
74 bool EnableDebugify, bool Coroutines);
75 } // namespace llvm
77 #endif