1 //===- PrintPasses.h - Determining whether/when to print IR ---------------===//
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 
9 #ifndef LLVM_IR_PRINTPASSES_H
10 #define LLVM_IR_PRINTPASSES_H
11 
12 #include "llvm/ADT/StringRef.h"
13 #include <vector>
14 
15 namespace llvm {
16 
17 // Returns true if printing before/after some pass is enabled, whether all
18 // passes or a specific pass.
19 bool shouldPrintBeforeSomePass();
20 bool shouldPrintAfterSomePass();
21 
22 // Returns true if we should print before/after a specific pass. The argument
23 // should be the pass ID, e.g. "instcombine".
24 bool shouldPrintBeforePass(StringRef PassID);
25 bool shouldPrintAfterPass(StringRef PassID);
26 
27 // Returns true if we should print before/after all passes.
28 bool shouldPrintBeforeAll();
29 bool shouldPrintAfterAll();
30 
31 // The list of passes to print before/after, if we only want to print
32 // before/after specific passes.
33 std::vector<std::string> printBeforePasses();
34 std::vector<std::string> printAfterPasses();
35 
36 // Returns true if we should always print the entire module.
37 bool forcePrintModuleIR();
38 
39 // Returns true if we should print the function.
40 bool isFunctionInPrintList(StringRef FunctionName);
41 
42 } // namespace llvm
43 
44 #endif // LLVM_IR_PRINTPASSES_H
45