RegionPrinter.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===-- RegionPrinter.h - Region printer external interface -----*- 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. //
  14. // This file defines external functions that can be called to explicitly
  15. // instantiate the region printer.
  16. //
  17. //===----------------------------------------------------------------------===//
  18. #ifndef LLVM_ANALYSIS_REGIONPRINTER_H
  19. #define LLVM_ANALYSIS_REGIONPRINTER_H
  20. #include "llvm/Analysis/DOTGraphTraitsPass.h"
  21. #include "llvm/Analysis/RegionInfo.h"
  22. namespace llvm {
  23. class FunctionPass;
  24. class Function;
  25. class RegionInfo;
  26. FunctionPass *createRegionViewerPass();
  27. FunctionPass *createRegionOnlyViewerPass();
  28. FunctionPass *createRegionPrinterPass();
  29. FunctionPass *createRegionOnlyPrinterPass();
  30. template <>
  31. struct DOTGraphTraits<RegionNode *> : public DefaultDOTGraphTraits {
  32. DOTGraphTraits(bool isSimple = false) : DefaultDOTGraphTraits(isSimple) {}
  33. std::string getNodeLabel(RegionNode *Node, RegionNode *Graph);
  34. };
  35. #ifndef NDEBUG
  36. /// Open a viewer to display the GraphViz vizualization of the analysis
  37. /// result.
  38. ///
  39. /// Practical to call in the debugger.
  40. /// Includes the instructions in each BasicBlock.
  41. ///
  42. /// @param RI The analysis to display.
  43. void viewRegion(llvm::RegionInfo *RI);
  44. /// Analyze the regions of a function and open its GraphViz
  45. /// visualization in a viewer.
  46. ///
  47. /// Useful to call in the debugger.
  48. /// Includes the instructions in each BasicBlock.
  49. /// The result of a new analysis may differ from the RegionInfo the pass
  50. /// manager currently holds.
  51. ///
  52. /// @param F Function to analyze.
  53. void viewRegion(const llvm::Function *F);
  54. /// Open a viewer to display the GraphViz vizualization of the analysis
  55. /// result.
  56. ///
  57. /// Useful to call in the debugger.
  58. /// Shows only the BasicBlock names without their instructions.
  59. ///
  60. /// @param RI The analysis to display.
  61. void viewRegionOnly(llvm::RegionInfo *RI);
  62. /// Analyze the regions of a function and open its GraphViz
  63. /// visualization in a viewer.
  64. ///
  65. /// Useful to call in the debugger.
  66. /// Shows only the BasicBlock names without their instructions.
  67. /// The result of a new analysis may differ from the RegionInfo the pass
  68. /// manager currently holds.
  69. ///
  70. /// @param F Function to analyze.
  71. void viewRegionOnly(const llvm::Function *F);
  72. #endif
  73. } // End llvm namespace
  74. #endif
  75. #ifdef __GNUC__
  76. #pragma GCC diagnostic pop
  77. #endif