Path: blob/main/contrib/llvm-project/llvm/tools/opt/NewPMDriver.h
35231 views
//===- NewPMDriver.h - Function to drive opt with the new PM ----*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7/// \file8///9/// A single function which is called to drive the opt behavior for the new10/// PassManager.11///12/// This is only in a separate TU with a header to avoid including all of the13/// old pass manager headers and the new pass manager headers into the same14/// file. Eventually all of the routines here will get folded back into15/// opt.cpp.16///17//===----------------------------------------------------------------------===//1819#ifndef LLVM_TOOLS_OPT_NEWPMDRIVER_H20#define LLVM_TOOLS_OPT_NEWPMDRIVER_H2122#include "llvm/Support/CommandLine.h"2324namespace llvm {25class PassBuilder;26class StringRef;27class Module;28class PassPlugin;29class TargetMachine;30class ToolOutputFile;31class TargetLibraryInfoImpl;3233extern cl::opt<bool> DebugifyEach;34extern cl::opt<std::string> DebugifyExport;3536extern cl::opt<bool> VerifyEachDebugInfoPreserve;37extern cl::opt<std::string> VerifyDIPreserveExport;3839namespace opt_tool {40enum OutputKind {41OK_NoOutput,42OK_OutputAssembly,43OK_OutputBitcode,44OK_OutputThinLTOBitcode,45};46enum VerifierKind { VK_NoVerifier, VK_VerifyOut, VK_VerifyEachPass };47enum PGOKind {48NoPGO,49InstrGen,50InstrUse,51SampleUse52};53enum CSPGOKind { NoCSPGO, CSInstrGen, CSInstrUse };54}5556void printPasses(raw_ostream &OS);5758/// Driver function to run the new pass manager over a module.59///60/// This function only exists factored away from opt.cpp in order to prevent61/// inclusion of the new pass manager headers and the old headers into the same62/// file. It's interface is consequentially somewhat ad-hoc, but will go away63/// when the transition finishes.64///65/// ThinLTOLinkOut is only used when OK is OK_OutputThinLTOBitcode, and can be66/// nullptr.67bool runPassPipeline(68StringRef Arg0, Module &M, TargetMachine *TM, TargetLibraryInfoImpl *TLII,69ToolOutputFile *Out, ToolOutputFile *ThinLinkOut,70ToolOutputFile *OptRemarkFile, StringRef PassPipeline,71ArrayRef<PassPlugin> PassPlugins,72ArrayRef<std::function<void(llvm::PassBuilder &)>> PassBuilderCallbacks,73opt_tool::OutputKind OK, opt_tool::VerifierKind VK,74bool ShouldPreserveAssemblyUseListOrder,75bool ShouldPreserveBitcodeUseListOrder, bool EmitSummaryIndex,76bool EmitModuleHash, bool EnableDebugify, bool VerifyDIPreserve,77bool UnifiedLTO = false);78} // namespace llvm7980#endif818283