|
2 | 2 | #include "llvm/Support/Debug.h"
|
3 | 3 |
|
4 | 4 | #define DEBUG_TYPE "pattern-logging-listener"
|
| 5 | +#define DBGS() (llvm::dbgs() << "[" << DEBUG_TYPE << "] ") |
| 6 | +#define LDBG(X) LLVM_DEBUG(DBGS() << X << "\n") |
5 | 7 |
|
6 | 8 | using namespace mlir;
|
7 | 9 |
|
8 |
| -static constexpr StringLiteral catalogPrefix = "PatternLoggingListener: "; |
9 |
| - |
10 | 10 | void RewriterBase::PatternLoggingListener::notifyOperationInserted(
|
11 | 11 | Operation *op, InsertPoint previous) {
|
12 |
| - LLVM_DEBUG(llvm::dbgs() << catalogPrefix << patternName |
13 |
| - << " | notifyOperationInserted" |
14 |
| - << " | " << op->getName() << "\n"); |
| 12 | + LDBG(patternName << " | notifyOperationInserted" |
| 13 | + << " | " << op->getName()); |
15 | 14 | ForwardingListener::notifyOperationInserted(op, previous);
|
16 | 15 | }
|
17 | 16 |
|
18 |
| -void RewriterBase::PatternLoggingListener::notifyOperationModified(Operation *op) { |
19 |
| - LLVM_DEBUG(llvm::dbgs() << catalogPrefix << patternName |
20 |
| - << " | notifyOperationModified" |
21 |
| - << " | " << op->getName() << "\n"); |
| 17 | +void RewriterBase::PatternLoggingListener::notifyOperationModified( |
| 18 | + Operation *op) { |
| 19 | + LDBG(patternName << " | notifyOperationModified" |
| 20 | + << " | " << op->getName()); |
22 | 21 | ForwardingListener::notifyOperationModified(op);
|
23 | 22 | }
|
24 | 23 |
|
25 | 24 | void RewriterBase::PatternLoggingListener::notifyOperationReplaced(
|
26 | 25 | Operation *op, Operation *newOp) {
|
27 |
| - LLVM_DEBUG(llvm::dbgs() << catalogPrefix << patternName |
28 |
| - << " | notifyOperationReplaced (with op)" |
29 |
| - << " | " << op->getName() << " | " << newOp->getName() |
30 |
| - << "\n"); |
| 26 | + LDBG(patternName << " | notifyOperationReplaced (with op)" |
| 27 | + << " | " << op->getName() << " | " << newOp->getName()); |
31 | 28 | ForwardingListener::notifyOperationReplaced(op, newOp);
|
32 | 29 | }
|
33 | 30 |
|
34 | 31 | void RewriterBase::PatternLoggingListener::notifyOperationReplaced(
|
35 | 32 | Operation *op, ValueRange replacement) {
|
36 |
| - LLVM_DEBUG(llvm::dbgs() << catalogPrefix << patternName |
37 |
| - << " | notifyOperationReplaced (with values)" |
38 |
| - << " | " << op->getName() << "\n"); |
| 33 | + LDBG(patternName << " | notifyOperationReplaced (with values)" |
| 34 | + << " | " << op->getName()); |
39 | 35 | ForwardingListener::notifyOperationReplaced(op, replacement);
|
40 | 36 | }
|
41 | 37 |
|
42 |
| -void RewriterBase::PatternLoggingListener::notifyOperationErased(Operation *op) { |
43 |
| - LLVM_DEBUG(llvm::dbgs() << catalogPrefix << patternName |
44 |
| - << " | notifyOperationErased" |
45 |
| - << " | " << op->getName() << "\n"); |
| 38 | +void RewriterBase::PatternLoggingListener::notifyOperationErased( |
| 39 | + Operation *op) { |
| 40 | + LDBG(patternName << " | notifyOperationErased" |
| 41 | + << " | " << op->getName()); |
46 | 42 | ForwardingListener::notifyOperationErased(op);
|
47 | 43 | }
|
48 | 44 |
|
49 | 45 | void RewriterBase::PatternLoggingListener::notifyPatternBegin(
|
50 | 46 | const Pattern &pattern, Operation *op) {
|
51 |
| - LLVM_DEBUG(llvm::dbgs() << catalogPrefix << patternName |
52 |
| - << " | notifyPatternBegin" |
53 |
| - << " | " << op->getName() << "\n"); |
| 47 | + LDBG(patternName << " | notifyPatternBegin" |
| 48 | + << " | " << op->getName()); |
54 | 49 | ForwardingListener::notifyPatternBegin(pattern, op);
|
55 | 50 | }
|
0 commit comments