LLVM 22.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"
23#include <string>
24
25namespace llvm {
26class raw_ostream;
27class Function;
28class Module;
29class Pass;
30
31/// Pass (for the new pass manager) for printing a Module as
32/// LLVM's text IR assembly.
33class PrintModulePass : public PassInfoMixin<PrintModulePass> {
34 raw_ostream &OS;
35 std::string Banner;
36 bool ShouldPreserveUseListOrder;
37 bool EmitSummaryIndex;
38
39public:
41 LLVM_ABI PrintModulePass(raw_ostream &OS, const std::string &Banner = "",
42 bool ShouldPreserveUseListOrder = false,
43 bool EmitSummaryIndex = false);
44
46 static bool isRequired() { return true; }
47};
48
49/// Pass (for the new pass manager) for printing a Function as
50/// LLVM's text IR assembly.
51class PrintFunctionPass : public PassInfoMixin<PrintFunctionPass> {
52 raw_ostream &OS;
53 std::string Banner;
54
55public:
57 LLVM_ABI PrintFunctionPass(raw_ostream &OS, const std::string &Banner = "");
58
60 static bool isRequired() { return true; }
61};
62
63} // namespace llvm
64
65#endif
#define LLVM_ABI
Definition: Compiler.h:213
This header defines various interfaces for pass management in LLVM.
#define F(x, y, z)
Definition: MD5.cpp:55
Machine Check Debug Module
raw_pwrite_stream & OS
Shrink Wrap Pass
Definition: ShrinkWrap.cpp:301
A container for analyses that lazily runs them and caches their results.
Definition: PassManager.h:255
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:67
A set of analyses that are preserved following a run of a transformation pass.
Definition: Analysis.h:112
Pass (for the new pass manager) for printing a Function as LLVM's text IR assembly.
LLVM_ABI PreservedAnalyses run(Function &F, AnalysisManager< Function > &)
Pass (for the new pass manager) for printing a Module as LLVM's text IR assembly.
LLVM_ABI PreservedAnalyses run(Module &M, AnalysisManager< Module > &)
static bool isRequired()
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:70