IRPrintingPasses.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- IRPrintingPasses.h - Passes to print out IR constructs ---*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. /// \file
  14. ///
  15. /// This file contains an interface for creating legacy passes to print out IR
  16. /// in various granularities.
  17. ///
  18. //===----------------------------------------------------------------------===//
  19. #ifndef LLVM_IR_IRPRINTINGPASSES_H
  20. #define LLVM_IR_IRPRINTINGPASSES_H
  21. #include <string>
  22. namespace llvm {
  23. class raw_ostream;
  24. class StringRef;
  25. class FunctionPass;
  26. class ModulePass;
  27. class Pass;
  28. /// Create and return a pass that writes the module to the specified
  29. /// \c raw_ostream.
  30. ModulePass *createPrintModulePass(raw_ostream &OS,
  31. const std::string &Banner = "",
  32. bool ShouldPreserveUseListOrder = false);
  33. /// Create and return a pass that prints functions to the specified
  34. /// \c raw_ostream as they are processed.
  35. FunctionPass *createPrintFunctionPass(raw_ostream &OS,
  36. const std::string &Banner = "");
  37. /// Print out a name of an LLVM value without any prefixes.
  38. ///
  39. /// The name is surrounded with ""'s and escaped if it has any special or
  40. /// non-printable characters in it.
  41. void printLLVMNameWithoutPrefix(raw_ostream &OS, StringRef Name);
  42. /// Return true if a pass is for IR printing.
  43. bool isIRPrintingPass(Pass *P);
  44. } // namespace llvm
  45. #endif
  46. #ifdef __GNUC__
  47. #pragma GCC diagnostic pop
  48. #endif