blob: a4b03a7fb765625579587b7b3e800e5c51f6cb48 [file] [log] [blame]
Andrew Walbran3d2c1972020-04-07 12:24:26 +01001//===- MIRPrinter.h - MIR serialization format printer ----------*- C++ -*-===//
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01002//
Andrew Walbran16937d02019-10-22 13:54:20 +01003// 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
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01006//
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_LIB_CODEGEN_MIRPRINTER_H
15#define LLVM_LIB_CODEGEN_MIRPRINTER_H
16
17namespace llvm {
18
19class MachineBasicBlock;
20class MachineFunction;
21class Module;
22class raw_ostream;
23template <typename T> class SmallVectorImpl;
24
25/// Print LLVM IR using the MIR serialization format to the given output stream.
26void printMIR(raw_ostream &OS, const Module &M);
27
28/// Print a machine function using the MIR serialization format to the given
29/// output stream.
30void printMIR(raw_ostream &OS, const MachineFunction &MF);
31
32/// Determine a possible list of successors of a basic block based on the
33/// basic block machine operand being used inside the block. This should give
34/// you the correct list of successor blocks in most cases except for things
35/// like jump tables where the basic block references can't easily be found.
36/// The MIRPRinter will skip printing successors if they match the result of
37/// this funciton and the parser will use this function to construct a list if
38/// it is missing.
39void guessSuccessors(const MachineBasicBlock &MBB,
Andrew Scullcdfcccc2018-10-05 20:58:37 +010040 SmallVectorImpl<MachineBasicBlock*> &Result,
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010041 bool &IsFallthrough);
42
43} // end namespace llvm
44
45#endif