| 1 | //===- IRPrintingPasses.h - Passes to print out IR constructs ---*- C++ -*-===// |
| 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 | /// \file |
| 9 | /// |
| 10 | /// This file contains an interface for creating legacy passes to print out IR |
| 11 | /// in various granularities. |
| 12 | /// |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
| 15 | #ifndef LLVM_IR_IRPRINTINGPASSES_H |
| 16 | #define LLVM_IR_IRPRINTINGPASSES_H |
| 17 | |
| 18 | #include "llvm/Support/Compiler.h" |
| 19 | #include <string> |
| 20 | |
| 21 | namespace llvm { |
| 22 | class raw_ostream; |
| 23 | class StringRef; |
| 24 | class FunctionPass; |
| 25 | class ModulePass; |
| 26 | class Pass; |
| 27 | |
| 28 | /// Create and return a pass that writes the module to the specified |
| 29 | /// \c raw_ostream. |
| 30 | LLVM_ABI ModulePass * |
| 31 | createPrintModulePass(raw_ostream &OS, const std::string &Banner = "" , |
| 32 | bool ShouldPreserveUseListOrder = false); |
| 33 | |
| 34 | /// Create and return a pass that prints functions to the specified |
| 35 | /// \c raw_ostream as they are processed. |
| 36 | LLVM_ABI FunctionPass *createPrintFunctionPass(raw_ostream &OS, |
| 37 | const std::string &Banner = "" ); |
| 38 | |
| 39 | /// Print out a name of an LLVM value without any prefixes. |
| 40 | /// |
| 41 | /// The name is surrounded with ""'s and escaped if it has any special or |
| 42 | /// non-printable characters in it. |
| 43 | LLVM_ABI void printLLVMNameWithoutPrefix(raw_ostream &OS, StringRef Name); |
| 44 | |
| 45 | /// Return true if a pass is for IR printing. |
| 46 | LLVM_ABI bool isIRPrintingPass(Pass *P); |
| 47 | |
| 48 | } // namespace llvm |
| 49 | |
| 50 | #endif |
| 51 | |