1#include "mlir/IR/PatternMatch.h"
2#include "llvm/Support/DebugLog.h"
3
4#define DEBUG_TYPE "pattern-logging-listener"
5
6using namespace mlir;
7
8void RewriterBase::PatternLoggingListener::notifyOperationInserted(
9 Operation *op, InsertPoint previous) {
10 LDBG() << patternName << " | notifyOperationInserted"
11 << " | " << op->getName();
12 ForwardingListener::notifyOperationInserted(op, previous);
13}
14
15void RewriterBase::PatternLoggingListener::notifyOperationModified(
16 Operation *op) {
17 LDBG() << patternName << " | notifyOperationModified"
18 << " | " << op->getName();
19 ForwardingListener::notifyOperationModified(op);
20}
21
22void RewriterBase::PatternLoggingListener::notifyOperationReplaced(
23 Operation *op, Operation *newOp) {
24 LDBG() << patternName << " | notifyOperationReplaced (with op)"
25 << " | " << op->getName() << " | " << newOp->getName();
26 ForwardingListener::notifyOperationReplaced(op, newOp);
27}
28
29void RewriterBase::PatternLoggingListener::notifyOperationReplaced(
30 Operation *op, ValueRange replacement) {
31 LDBG() << patternName << " | notifyOperationReplaced (with values)"
32 << " | " << op->getName();
33 ForwardingListener::notifyOperationReplaced(op, replacement);
34}
35
36void RewriterBase::PatternLoggingListener::notifyOperationErased(
37 Operation *op) {
38 LDBG() << patternName << " | notifyOperationErased"
39 << " | " << op->getName();
40 ForwardingListener::notifyOperationErased(op);
41}
42
43void RewriterBase::PatternLoggingListener::notifyPatternBegin(
44 const Pattern &pattern, Operation *op) {
45 LDBG() << patternName << " | notifyPatternBegin"
46 << " | " << op->getName();
47 ForwardingListener::notifyPatternBegin(pattern, op);
48}
49