Skip to content

Commit 1aa1842

Browse files
committed
use LDBG macro for brevity
1 parent a46f1d3 commit 1aa1842

File tree

1 file changed

+18
-23
lines changed

1 file changed

+18
-23
lines changed

mlir/lib/IR/PatternLoggingListener.cpp

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,54 +2,49 @@
22
#include "llvm/Support/Debug.h"
33

44
#define DEBUG_TYPE "pattern-logging-listener"
5+
#define DBGS() (llvm::dbgs() << "[" << DEBUG_TYPE << "] ")
6+
#define LDBG(X) LLVM_DEBUG(DBGS() << X << "\n")
57

68
using namespace mlir;
79

8-
static constexpr StringLiteral catalogPrefix = "PatternLoggingListener: ";
9-
1010
void RewriterBase::PatternLoggingListener::notifyOperationInserted(
1111
Operation *op, InsertPoint previous) {
12-
LLVM_DEBUG(llvm::dbgs() << catalogPrefix << patternName
13-
<< " | notifyOperationInserted"
14-
<< " | " << op->getName() << "\n");
12+
LDBG(patternName << " | notifyOperationInserted"
13+
<< " | " << op->getName());
1514
ForwardingListener::notifyOperationInserted(op, previous);
1615
}
1716

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());
2221
ForwardingListener::notifyOperationModified(op);
2322
}
2423

2524
void RewriterBase::PatternLoggingListener::notifyOperationReplaced(
2625
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());
3128
ForwardingListener::notifyOperationReplaced(op, newOp);
3229
}
3330

3431
void RewriterBase::PatternLoggingListener::notifyOperationReplaced(
3532
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());
3935
ForwardingListener::notifyOperationReplaced(op, replacement);
4036
}
4137

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());
4642
ForwardingListener::notifyOperationErased(op);
4743
}
4844

4945
void RewriterBase::PatternLoggingListener::notifyPatternBegin(
5046
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());
5449
ForwardingListener::notifyPatternBegin(pattern, op);
5550
}

0 commit comments

Comments
 (0)