LLVM 20.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
19
20namespace llvm {
21
22class MachineBasicBlock;
23class MachineFunction;
24class MachineModuleInfo;
25class Module;
26template <typename T> class SmallVectorImpl;
27
28class PrintMIRPreparePass : public PassInfoMixin<PrintMIRPreparePass> {
29 raw_ostream &OS;
30
31public:
34};
35
36class PrintMIRPass : public PassInfoMixin<PrintMIRPass> {
38
39public:
43};
44
45/// Print LLVM IR using the MIR serialization format to the given output stream.
46void printMIR(raw_ostream &OS, const Module &M);
47
48/// Print a machine function using the MIR serialization format to the given
49/// output stream.
50void printMIR(raw_ostream &OS, const MachineModuleInfo &MMI,
51 const MachineFunction &MF);
52
53/// Determine a possible list of successors of a basic block based on the
54/// basic block machine operand being used inside the block. This should give
55/// you the correct list of successor blocks in most cases except for things
56/// like jump tables where the basic block references can't easily be found.
57/// The MIRPRinter will skip printing successors if they match the result of
58/// this function and the parser will use this function to construct a list if
59/// it is missing.
60void guessSuccessors(const MachineBasicBlock &MBB,
61 SmallVectorImpl<MachineBasicBlock*> &Result,
62 bool &IsFallthrough);
63
64} // end namespace llvm
65
66#endif
MachineBasicBlock & MBB
Machine Check Debug Module
raw_pwrite_stream & OS
A container for analyses that lazily runs them and caches their results.
Definition: PassManager.h:253
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
A set of analyses that are preserved following a run of a transformation pass.
Definition: Analysis.h:111
PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
PrintMIRPass(raw_ostream &OS=errs())
Definition: MIRPrinter.h:40
PreservedAnalyses run(Module &M, ModuleAnalysisManager &MFAM)
PrintMIRPreparePass(raw_ostream &OS=errs())
Definition: MIRPrinter.h:32
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
void printMIR(raw_ostream &OS, const Module &M)
Print LLVM IR using the MIR serialization format to the given output stream.
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...
Definition: MIRPrinter.cpp:627
raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:69