LLVM 23.0.0git
MIRPrinter.h
Go to the documentation of this file.
1//===- MIRPrinter.h - MIR serialization format printer ----------*- 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//
9// This file declares the functions that print out the LLVM IR and the machine
10// functions using the MIR serialization format.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CODEGEN_MIRPRINTER_H
15#define LLVM_CODEGEN_MIRPRINTER_H
16
20
21namespace llvm {
22
24class MachineFunction;
26class Module;
27class VirtRegMap;
28template <typename T> class SmallVectorImpl;
29
30class PrintMIRPreparePass : public RequiredPassInfoMixin<PrintMIRPreparePass> {
31 raw_ostream &OS;
32
33public:
36};
37
38class PrintMIRPass : public RequiredPassInfoMixin<PrintMIRPass> {
39 raw_ostream &OS;
40
41public:
42 PrintMIRPass(raw_ostream &OS = errs()) : OS(OS) {}
45};
46
47/// Print LLVM IR using the MIR serialization format to the given output stream.
48LLVM_ABI void printMIR(raw_ostream &OS, const Module &M);
49
50/// Print MIR using Legacy Pass Manager (uses MachineModuleInfo).
51/// If \p VRM is non-null, the printer will serialize VirtRegMap state
52/// (split-from, assigned-phys).
53LLVM_ABI void printMIR(raw_ostream &OS, const MachineModuleInfo &MMI,
54 const MachineFunction &MF,
55 const VirtRegMap *VRM = nullptr);
56
57/// Print MIR using New Pass Manager (uses FunctionAnalysisManager).
58/// If \p VRM is non-null, the printer will serialize VirtRegMap state
59/// (split-from, assigned-phys).
60LLVM_ABI void printMIR(raw_ostream &OS, FunctionAnalysisManager &FAM,
61 const MachineFunction &MF,
62 const VirtRegMap *VRM = nullptr);
63
64/// Determine a possible list of successors of a basic block based on the
65/// basic block machine operand being used inside the block. This should give
66/// you the correct list of successor blocks in most cases except for things
67/// like jump tables where the basic block references can't easily be found.
68/// The MIRPRinter will skip printing successors if they match the result of
69/// this function and the parser will use this function to construct a list if
70/// it is missing.
71LLVM_ABI void guessSuccessors(const MachineBasicBlock &MBB,
72 SmallVectorImpl<MachineBasicBlock *> &Result,
73 bool &IsFallthrough);
74
75} // end namespace llvm
76
77#endif
MachineBasicBlock & MBB
#define LLVM_ABI
Definition Compiler.h:213
Machine Check Debug Module
FunctionAnalysisManager FAM
This class contains meta information specific to a module.
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
LLVM_ABI PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
PrintMIRPass(raw_ostream &OS=errs())
Definition MIRPrinter.h:42
LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &MFAM)
PrintMIRPreparePass(raw_ostream &OS=errs())
Definition MIRPrinter.h:34
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
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.
AnalysisManager< MachineFunction > MachineFunctionAnalysisManager
LLVM_ABI void printMIR(raw_ostream &OS, const Module &M)
Print LLVM IR using the MIR serialization format to the given output stream.
LLVM_ABI void guessSuccessors(const MachineBasicBlock &MBB, SmallVectorImpl< MachineBasicBlock * > &Result, bool &IsFallthrough)
Determine a possible list of successors of a basic block based on the basic block machine operand bei...
LLVM_ABI raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.
AnalysisManager< Module > ModuleAnalysisManager
Convenience typedef for the Module analysis manager.
Definition MIRParser.h:39
A CRTP mix-in for passes that should not be skipped.