|
|
|||
File indexing completed on 2026-05-10 08:44:10
0001 //===- PrintPasses.h - Determining whether/when to print IR ---------------===// 0002 // 0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 0004 // See https://llvm.org/LICENSE.txt for license information. 0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 0006 // 0007 //===----------------------------------------------------------------------===// 0008 0009 #ifndef LLVM_IR_PRINTPASSES_H 0010 #define LLVM_IR_PRINTPASSES_H 0011 0012 #include "llvm/ADT/StringRef.h" 0013 #include "llvm/Support/CommandLine.h" 0014 #include <vector> 0015 0016 namespace llvm { 0017 0018 enum class ChangePrinter { 0019 None, 0020 Verbose, 0021 Quiet, 0022 DiffVerbose, 0023 DiffQuiet, 0024 ColourDiffVerbose, 0025 ColourDiffQuiet, 0026 DotCfgVerbose, 0027 DotCfgQuiet 0028 }; 0029 0030 extern cl::opt<ChangePrinter> PrintChanged; 0031 0032 // Returns true if printing before/after some pass is enabled, whether all 0033 // passes or a specific pass. 0034 bool shouldPrintBeforeSomePass(); 0035 bool shouldPrintAfterSomePass(); 0036 0037 // Returns true if we should print before/after a specific pass. The argument 0038 // should be the pass ID, e.g. "instcombine". 0039 bool shouldPrintBeforePass(StringRef PassID); 0040 bool shouldPrintAfterPass(StringRef PassID); 0041 0042 // Returns true if we should print before/after all passes. 0043 bool shouldPrintBeforeAll(); 0044 bool shouldPrintAfterAll(); 0045 0046 // The list of passes to print before/after, if we only want to print 0047 // before/after specific passes. 0048 std::vector<std::string> printBeforePasses(); 0049 std::vector<std::string> printAfterPasses(); 0050 0051 // Returns true if we should always print the entire module. 0052 bool forcePrintModuleIR(); 0053 0054 // Returns true if we should print the entire function for loop passes. 0055 bool forcePrintFuncIR(); 0056 0057 // Return true if -filter-passes is empty or contains the pass name. 0058 bool isPassInPrintList(StringRef PassName); 0059 bool isFilterPassesEmpty(); 0060 0061 // Returns true if we should print the function. 0062 bool isFunctionInPrintList(StringRef FunctionName); 0063 0064 // Ensure temporary files exist, creating or re-using them. \p FD contains 0065 // file descriptors (-1 indicates that the file should be created) and 0066 // \p SR contains the corresponding initial content. \p FileName will have 0067 // the filenames filled in when creating files. Return first error code (if 0068 // any) and stop. 0069 std::error_code prepareTempFiles(SmallVector<int> &FD, ArrayRef<StringRef> SR, 0070 SmallVector<std::string> &FileName); 0071 0072 // Remove the temporary files in \p FileName. Typically used in conjunction 0073 // with prepareTempFiles. Return first error code (if any) and stop.. 0074 std::error_code cleanUpTempFiles(ArrayRef<std::string> FileName); 0075 0076 // Perform a system based diff between \p Before and \p After, using \p 0077 // OldLineFormat, \p NewLineFormat, and \p UnchangedLineFormat to control the 0078 // formatting of the output. Return an error message for any failures instead 0079 // of the diff. 0080 std::string doSystemDiff(StringRef Before, StringRef After, 0081 StringRef OldLineFormat, StringRef NewLineFormat, 0082 StringRef UnchangedLineFormat); 0083 0084 } // namespace llvm 0085 0086 #endif // LLVM_IR_PRINTPASSES_H
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|