LLVM  17.0.0git
IRPrintingPasses.h
Go to the documentation of this file.
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 defines passes to print out IR in various granularities. The
11 /// PrintModulePass pass simply prints out the entire module when it is
12 /// executed. The PrintFunctionPass class is designed to be pipelined with
13 /// other FunctionPass's, and prints out the functions of the module as they
14 /// are processed.
15 ///
16 //===----------------------------------------------------------------------===//
17 
18 #ifndef LLVM_IRPRINTER_IRPRINTINGPASSES_H
19 #define LLVM_IRPRINTER_IRPRINTINGPASSES_H
20 
21 #include "llvm/IR/PassManager.h"
22 #include <string>
23 
24 namespace llvm {
25 class raw_ostream;
26 class Function;
27 class Module;
28 class Pass;
29 
30 /// Pass (for the new pass manager) for printing a Module as
31 /// LLVM's text IR assembly.
32 class PrintModulePass : public PassInfoMixin<PrintModulePass> {
33  raw_ostream &OS;
34  std::string Banner;
35  bool ShouldPreserveUseListOrder;
36  bool EmitSummaryIndex;
37 
38 public:
40  PrintModulePass(raw_ostream &OS, const std::string &Banner = "",
41  bool ShouldPreserveUseListOrder = false,
42  bool EmitSummaryIndex = false);
43 
45  static bool isRequired() { return true; }
46 };
47 
48 /// Pass (for the new pass manager) for printing a Function as
49 /// LLVM's text IR assembly.
50 class PrintFunctionPass : public PassInfoMixin<PrintFunctionPass> {
51  raw_ostream &OS;
52  std::string Banner;
53 
54 public:
56  PrintFunctionPass(raw_ostream &OS, const std::string &Banner = "");
57 
59  static bool isRequired() { return true; }
60 };
61 
62 } // namespace llvm
63 
64 #endif
llvm::PreservedAnalyses
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:152
llvm::PrintFunctionPass
Pass (for the new pass manager) for printing a Function as LLVM's text IR assembly.
Definition: IRPrintingPasses.h:50
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
M
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
Definition: README.txt:252
Pass
print lazy value Lazy Value Info Printer Pass
Definition: LazyValueInfo.cpp:2066
llvm::PassInfoMixin
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:371
llvm::Function
Definition: Function.h:59
llvm::PrintFunctionPass::run
PreservedAnalyses run(Function &F, AnalysisManager< Function > &)
Definition: IRPrintingPasses.cpp:67
llvm::PrintModulePass::isRequired
static bool isRequired()
Definition: IRPrintingPasses.h:45
F
#define F(x, y, z)
Definition: MD5.cpp:55
llvm::PrintModulePass::PrintModulePass
PrintModulePass()
Definition: IRPrintingPasses.cpp:25
llvm::PrintModulePass::run
PreservedAnalyses run(Module &M, AnalysisManager< Module > &)
Definition: IRPrintingPasses.cpp:33
llvm::PrintFunctionPass::PrintFunctionPass
PrintFunctionPass()
Definition: IRPrintingPasses.cpp:63
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
Module
Machine Check Debug Module
Definition: MachineCheckDebugify.cpp:122
llvm::PrintFunctionPass::isRequired
static bool isRequired()
Definition: IRPrintingPasses.h:59
PassManager.h
llvm::PrintModulePass
Pass (for the new pass manager) for printing a Module as LLVM's text IR assembly.
Definition: IRPrintingPasses.h:32
llvm::AnalysisManager
A container for analyses that lazily runs them and caches their results.
Definition: InstructionSimplify.h:42
llvm::codeview::PublicSymFlags::Function
@ Function