Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:44:11

0001 //===- IRPrintingPasses.h - Passes to print out IR constructs ---*- 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 /// \file
0009 ///
0010 /// This file defines passes to print out IR in various granularities. The
0011 /// PrintModulePass pass simply prints out the entire module when it is
0012 /// executed. The PrintFunctionPass class is designed to be pipelined with
0013 /// other FunctionPass's, and prints out the functions of the module as they
0014 /// are processed.
0015 ///
0016 //===----------------------------------------------------------------------===//
0017 
0018 #ifndef LLVM_IRPRINTER_IRPRINTINGPASSES_H
0019 #define LLVM_IRPRINTER_IRPRINTINGPASSES_H
0020 
0021 #include "llvm/IR/PassManager.h"
0022 #include <string>
0023 
0024 namespace llvm {
0025 class raw_ostream;
0026 class Function;
0027 class Module;
0028 class Pass;
0029 
0030 /// Pass (for the new pass manager) for printing a Module as
0031 /// LLVM's text IR assembly.
0032 class PrintModulePass : public PassInfoMixin<PrintModulePass> {
0033   raw_ostream &OS;
0034   std::string Banner;
0035   bool ShouldPreserveUseListOrder;
0036   bool EmitSummaryIndex;
0037 
0038 public:
0039   PrintModulePass();
0040   PrintModulePass(raw_ostream &OS, const std::string &Banner = "",
0041                   bool ShouldPreserveUseListOrder = false,
0042                   bool EmitSummaryIndex = false);
0043 
0044   PreservedAnalyses run(Module &M, AnalysisManager<Module> &);
0045   static bool isRequired() { return true; }
0046 };
0047 
0048 /// Pass (for the new pass manager) for printing a Function as
0049 /// LLVM's text IR assembly.
0050 class PrintFunctionPass : public PassInfoMixin<PrintFunctionPass> {
0051   raw_ostream &OS;
0052   std::string Banner;
0053 
0054 public:
0055   PrintFunctionPass();
0056   PrintFunctionPass(raw_ostream &OS, const std::string &Banner = "");
0057 
0058   PreservedAnalyses run(Function &F, AnalysisManager<Function> &);
0059   static bool isRequired() { return true; }
0060 };
0061 
0062 } // namespace llvm
0063 
0064 #endif