CIRCT  20.0.0git
Debug.h
Go to the documentation of this file.
1 //===- Debug.h - Debug Utilities --------------------------------*- C++ -*-===//
2 //
3 // 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
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Utilities related to generating run-time debug information.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef CIRCT_SUPPORT_DEBUG_H
14 #define CIRCT_SUPPORT_DEBUG_H
15 
16 #include "mlir/Pass/Pass.h"
17 #include "llvm/ADT/Twine.h"
18 
19 namespace circt {
20 
21 /// Write a "header"-like string to the debug stream with a certain width. This
22 /// produces output like the following:
23 ///
24 /// ===- Hello World --------------------===
25 ///
26 /// This is commonly used for generating a header in debug information. The
27 /// format is modeled after LLVM/MLIR/CIRCT source file headers.
28 llvm::raw_ostream &debugHeader(llvm::StringRef str, int width = 80);
29 
30 /// Write a boilerplate header for a pass to the debug stream. This generates
31 /// output like the following if the pass's name is "FooPass":
32 ///
33 /// ===- Running FooPass -----------------===
34 ///
35 /// This is commonly used to generate a header in debug when a pass starts
36 /// running.
37 llvm::raw_ostream &debugPassHeader(const mlir::Pass *pass, int width = 80);
38 
39 /// Write a boilerplate footer to the debug stream to indicate that a pass has
40 /// ended. This produces text like the following:
41 ///
42 /// ===-----------------------------------===
43 llvm::raw_ostream &debugFooter(int width = 80);
44 
45 } // namespace circt
46 
47 #endif // CIRCT_SUPPORT_DEBUG_H
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
Definition: DebugAnalysis.h:21
llvm::raw_ostream & debugHeader(llvm::StringRef str, int width=80)
Write a "header"-like string to the debug stream with a certain width.
Definition: Debug.cpp:18
llvm::raw_ostream & debugPassHeader(const mlir::Pass *pass, int width=80)
Write a boilerplate header for a pass to the debug stream.
Definition: Debug.cpp:31
llvm::raw_ostream & debugFooter(int width=80)
Write a boilerplate footer to the debug stream to indicate that a pass has ended.
Definition: Debug.cpp:35