LLVM  3.7.0
IRPrintingPasses.h
Go to the documentation of this file.
1 //===- IRPrintingPasses.h - Passes to print out IR constructs ---*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 /// \file
10 ///
11 /// This file defines passes to print out IR in various granularities. The
12 /// PrintModulePass pass simply prints out the entire module when it is
13 /// executed. The PrintFunctionPass class is designed to be pipelined with
14 /// other FunctionPass's, and prints out the functions of the module as they
15 /// are processed.
16 ///
17 //===----------------------------------------------------------------------===//
18 
19 #ifndef LLVM_IR_IRPRINTINGPASSES_H
20 #define LLVM_IR_IRPRINTINGPASSES_H
21 
22 #include "llvm/ADT/StringRef.h"
23 #include <string>
24 
25 namespace llvm {
26 class BasicBlockPass;
27 class Function;
28 class FunctionPass;
29 class Module;
30 class ModulePass;
31 class PreservedAnalyses;
32 class raw_ostream;
33 
34 /// \brief Create and return a pass that writes the module to the specified
35 /// \c raw_ostream.
36 ModulePass *createPrintModulePass(raw_ostream &OS,
37  const std::string &Banner = "",
38  bool ShouldPreserveUseListOrder = false);
39 
40 /// \brief Create and return a pass that prints functions to the specified
41 /// \c raw_ostream as they are processed.
42 FunctionPass *createPrintFunctionPass(raw_ostream &OS,
43  const std::string &Banner = "");
44 
45 /// \brief Create and return a pass that writes the BB to the specified
46 /// \c raw_ostream.
47 BasicBlockPass *createPrintBasicBlockPass(raw_ostream &OS,
48  const std::string &Banner = "");
49 
50 /// \brief Pass for printing a Module as LLVM's text IR assembly.
51 ///
52 /// Note: This pass is for use with the new pass manager. Use the create...Pass
53 /// functions above to create passes for use with the legacy pass manager.
55  raw_ostream &OS;
56  std::string Banner;
57  bool ShouldPreserveUseListOrder;
58 
59 public:
61  PrintModulePass(raw_ostream &OS, const std::string &Banner = "",
62  bool ShouldPreserveUseListOrder = false);
63 
65 
66  static StringRef name() { return "PrintModulePass"; }
67 };
68 
69 /// \brief Pass for printing a Function as LLVM's text IR assembly.
70 ///
71 /// Note: This pass is for use with the new pass manager. Use the create...Pass
72 /// functions above to create passes for use with the legacy pass manager.
74  raw_ostream &OS;
75  std::string Banner;
76 
77 public:
79  PrintFunctionPass(raw_ostream &OS, const std::string &Banner = "");
80 
82 
83  static StringRef name() { return "PrintFunctionPass"; }
84 };
85 
86 } // End llvm namespace
87 
88 #endif
A Module instance is used to store all the information related to an LLVM module. ...
Definition: Module.h:114
Pass for printing a Module as LLVM's text IR assembly.
FunctionPass * createPrintFunctionPass(raw_ostream &OS, const std::string &Banner="")
Create and return a pass that prints functions to the specified raw_ostream as they are processed...
static StringRef name()
F(f)
static StringRef name()
An abstract set of preserved analyses following a transformation pass run.
Definition: PassManager.h:69
PreservedAnalyses run(Module &M)
BasicBlockPass * createPrintBasicBlockPass(raw_ostream &OS, const std::string &Banner="")
Create and return a pass that writes the BB to the specified raw_ostream.
PreservedAnalyses run(Function &F)
ModulePass * createPrintModulePass(raw_ostream &OS, const std::string &Banner="", bool ShouldPreserveUseListOrder=false)
Create and return a pass that writes the module to the specified raw_ostream.
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:38
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:40
Pass for printing a Function as LLVM's text IR assembly.