1*9880d681SAndroid Build Coastguard Worker //===- NewPMDriver.h - Function to drive opt with the new PM ----*- C++ -*-===// 2*9880d681SAndroid Build Coastguard Worker // 3*9880d681SAndroid Build Coastguard Worker // The LLVM Compiler Infrastructure 4*9880d681SAndroid Build Coastguard Worker // 5*9880d681SAndroid Build Coastguard Worker // This file is distributed under the University of Illinois Open Source 6*9880d681SAndroid Build Coastguard Worker // License. See LICENSE.TXT for details. 7*9880d681SAndroid Build Coastguard Worker // 8*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===// 9*9880d681SAndroid Build Coastguard Worker /// \file 10*9880d681SAndroid Build Coastguard Worker /// 11*9880d681SAndroid Build Coastguard Worker /// A single function which is called to drive the opt behavior for the new 12*9880d681SAndroid Build Coastguard Worker /// PassManager. 13*9880d681SAndroid Build Coastguard Worker /// 14*9880d681SAndroid Build Coastguard Worker /// This is only in a separate TU with a header to avoid including all of the 15*9880d681SAndroid Build Coastguard Worker /// old pass manager headers and the new pass manager headers into the same 16*9880d681SAndroid Build Coastguard Worker /// file. Eventually all of the routines here will get folded back into 17*9880d681SAndroid Build Coastguard Worker /// opt.cpp. 18*9880d681SAndroid Build Coastguard Worker /// 19*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===// 20*9880d681SAndroid Build Coastguard Worker 21*9880d681SAndroid Build Coastguard Worker #ifndef LLVM_TOOLS_OPT_NEWPMDRIVER_H 22*9880d681SAndroid Build Coastguard Worker #define LLVM_TOOLS_OPT_NEWPMDRIVER_H 23*9880d681SAndroid Build Coastguard Worker 24*9880d681SAndroid Build Coastguard Worker namespace llvm { 25*9880d681SAndroid Build Coastguard Worker class StringRef; 26*9880d681SAndroid Build Coastguard Worker class LLVMContext; 27*9880d681SAndroid Build Coastguard Worker class Module; 28*9880d681SAndroid Build Coastguard Worker class TargetMachine; 29*9880d681SAndroid Build Coastguard Worker class tool_output_file; 30*9880d681SAndroid Build Coastguard Worker 31*9880d681SAndroid Build Coastguard Worker namespace opt_tool { 32*9880d681SAndroid Build Coastguard Worker enum OutputKind { 33*9880d681SAndroid Build Coastguard Worker OK_NoOutput, 34*9880d681SAndroid Build Coastguard Worker OK_OutputAssembly, 35*9880d681SAndroid Build Coastguard Worker OK_OutputBitcode 36*9880d681SAndroid Build Coastguard Worker }; 37*9880d681SAndroid Build Coastguard Worker enum VerifierKind { 38*9880d681SAndroid Build Coastguard Worker VK_NoVerifier, 39*9880d681SAndroid Build Coastguard Worker VK_VerifyInAndOut, 40*9880d681SAndroid Build Coastguard Worker VK_VerifyEachPass 41*9880d681SAndroid Build Coastguard Worker }; 42*9880d681SAndroid Build Coastguard Worker } 43*9880d681SAndroid Build Coastguard Worker 44*9880d681SAndroid Build Coastguard Worker /// \brief Driver function to run the new pass manager over a module. 45*9880d681SAndroid Build Coastguard Worker /// 46*9880d681SAndroid Build Coastguard Worker /// This function only exists factored away from opt.cpp in order to prevent 47*9880d681SAndroid Build Coastguard Worker /// inclusion of the new pass manager headers and the old headers into the same 48*9880d681SAndroid Build Coastguard Worker /// file. It's interface is consequentially somewhat ad-hoc, but will go away 49*9880d681SAndroid Build Coastguard Worker /// when the transition finishes. 50*9880d681SAndroid Build Coastguard Worker bool runPassPipeline(StringRef Arg0, LLVMContext &Context, Module &M, 51*9880d681SAndroid Build Coastguard Worker TargetMachine *TM, tool_output_file *Out, 52*9880d681SAndroid Build Coastguard Worker StringRef PassPipeline, opt_tool::OutputKind OK, 53*9880d681SAndroid Build Coastguard Worker opt_tool::VerifierKind VK, 54*9880d681SAndroid Build Coastguard Worker bool ShouldPreserveAssemblyUseListOrder, 55*9880d681SAndroid Build Coastguard Worker bool ShouldPreserveBitcodeUseListOrder); 56*9880d681SAndroid Build Coastguard Worker } 57*9880d681SAndroid Build Coastguard Worker 58*9880d681SAndroid Build Coastguard Worker #endif 59