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 <string> 19 20 namespace llvm { 21 class raw_ostream; 22 class StringRef; 23 class FunctionPass; 24 class ModulePass; 25 class Pass; 26 27 /// Create and return a pass that writes the module to the specified 28 /// \c raw_ostream. 29 ModulePass *createPrintModulePass(raw_ostream &OS, 30 const std::string &Banner = "", 31 bool ShouldPreserveUseListOrder = false); 32 33 /// Create and return a pass that prints functions to the specified 34 /// \c raw_ostream as they are processed. 35 FunctionPass *createPrintFunctionPass(raw_ostream &OS, 36 const std::string &Banner = ""); 37 38 /// Print out a name of an LLVM value without any prefixes. 39 /// 40 /// The name is surrounded with ""'s and escaped if it has any special or 41 /// non-printable characters in it. 42 void printLLVMNameWithoutPrefix(raw_ostream &OS, StringRef Name); 43 44 /// Return true if a pass is for IR printing. 45 bool isIRPrintingPass(Pass *P); 46 47 } // namespace llvm 48 49 #endif 50