blob: 349a7b1267f8e6007f0ada7d9554daf435832cb2 [file] [log] [blame]
Chandler Carruth66445382014-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 Kramera7c40ef2014-08-13 16:26:38 +000021#ifndef LLVM_TOOLS_OPT_NEWPMDRIVER_H
22#define LLVM_TOOLS_OPT_NEWPMDRIVER_H
Chandler Carruth66445382014-01-11 08:16:35 +000023
24#include "llvm/ADT/StringRef.h"
25
26namespace llvm {
27class LLVMContext;
28class Module;
Chandler Carruthe0385522015-02-01 10:11:22 +000029class TargetMachine;
Chandler Carruth66445382014-01-11 08:16:35 +000030class tool_output_file;
31
Chandler Carruth949282e2014-01-13 03:08:40 +000032namespace opt_tool {
33enum OutputKind {
34 OK_NoOutput,
35 OK_OutputAssembly,
36 OK_OutputBitcode
37};
Chandler Carruth4d356312014-01-20 11:34:08 +000038enum VerifierKind {
39 VK_NoVerifier,
40 VK_VerifyInAndOut,
41 VK_VerifyEachPass
42};
Chandler Carruth949282e2014-01-13 03:08:40 +000043}
44
Chandler Carruth66445382014-01-11 08:16:35 +000045/// \brief Driver function to run the new pass manager over a module.
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.
51bool runPassPipeline(StringRef Arg0, LLVMContext &Context, Module &M,
Chandler Carruthe0385522015-02-01 10:11:22 +000052 TargetMachine *TM, tool_output_file *Out,
53 StringRef PassPipeline, opt_tool::OutputKind OK,
Duncan P. N. Exon Smith679db332015-04-15 00:34:24 +000054 opt_tool::VerifierKind VK,
Duncan P. N. Exon Smith8a74f682015-04-15 02:38:06 +000055 bool ShouldPreserveAssemblyUseListOrder,
Duncan P. N. Exon Smith679db332015-04-15 00:34:24 +000056 bool ShouldPreserveBitcodeUseListOrder);
Chandler Carruth66445382014-01-11 08:16:35 +000057}
58
59#endif