Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:43:32

0001 //===- MIRPrinter.h - MIR serialization format printer ----------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // This file declares the functions that print out the LLVM IR and the machine
0010 // functions using the MIR serialization format.
0011 //
0012 //===----------------------------------------------------------------------===//
0013 
0014 #ifndef LLVM_CODEGEN_MIRPRINTER_H
0015 #define LLVM_CODEGEN_MIRPRINTER_H
0016 
0017 #include "llvm/CodeGen/MachinePassManager.h"
0018 #include "llvm/Support/raw_ostream.h"
0019 
0020 namespace llvm {
0021 
0022 class MachineBasicBlock;
0023 class MachineFunction;
0024 class MachineModuleInfo;
0025 class Module;
0026 template <typename T> class SmallVectorImpl;
0027 
0028 class PrintMIRPreparePass : public PassInfoMixin<PrintMIRPreparePass> {
0029   raw_ostream &OS;
0030 
0031 public:
0032   PrintMIRPreparePass(raw_ostream &OS = errs()) : OS(OS) {}
0033   PreservedAnalyses run(Module &M, ModuleAnalysisManager &MFAM);
0034   static bool isRequired() { return true; }
0035 };
0036 
0037 class PrintMIRPass : public PassInfoMixin<PrintMIRPass> {
0038   raw_ostream &OS;
0039 
0040 public:
0041   PrintMIRPass(raw_ostream &OS = errs()) : OS(OS) {}
0042   PreservedAnalyses run(MachineFunction &MF,
0043                         MachineFunctionAnalysisManager &MFAM);
0044   static bool isRequired() { return true; }
0045 };
0046 
0047 /// Print LLVM IR using the MIR serialization format to the given output stream.
0048 void printMIR(raw_ostream &OS, const Module &M);
0049 
0050 /// Print a machine function using the MIR serialization format to the given
0051 /// output stream.
0052 void printMIR(raw_ostream &OS, const MachineModuleInfo &MMI,
0053               const MachineFunction &MF);
0054 
0055 /// Determine a possible list of successors of a basic block based on the
0056 /// basic block machine operand being used inside the block. This should give
0057 /// you the correct list of successor blocks in most cases except for things
0058 /// like jump tables where the basic block references can't easily be found.
0059 /// The MIRPRinter will skip printing successors if they match the result of
0060 /// this function and the parser will use this function to construct a list if
0061 /// it is missing.
0062 void guessSuccessors(const MachineBasicBlock &MBB,
0063                      SmallVectorImpl<MachineBasicBlock*> &Result,
0064                      bool &IsFallthrough);
0065 
0066 } // end namespace llvm
0067 
0068 #endif