summaryrefslogtreecommitdiff
path: root/mlir/lib/IR/PatternLoggingListener.cpp
blob: 0db13ab5b775dbc9b4d92b95d3a4562f0ab5682e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "mlir/IR/PatternMatch.h"
#include "llvm/Support/DebugLog.h"

#define DEBUG_TYPE "pattern-logging-listener"

using namespace mlir;

void RewriterBase::PatternLoggingListener::notifyOperationInserted(
    Operation *op, InsertPoint previous) {
  LDBG() << patternName << " | notifyOperationInserted"
         << " | " << op->getName();
  ForwardingListener::notifyOperationInserted(op, previous);
}

void RewriterBase::PatternLoggingListener::notifyOperationModified(
    Operation *op) {
  LDBG() << patternName << " | notifyOperationModified"
         << " | " << op->getName();
  ForwardingListener::notifyOperationModified(op);
}

void RewriterBase::PatternLoggingListener::notifyOperationReplaced(
    Operation *op, Operation *newOp) {
  LDBG() << patternName << " | notifyOperationReplaced (with op)"
         << " | " << op->getName() << " | " << newOp->getName();
  ForwardingListener::notifyOperationReplaced(op, newOp);
}

void RewriterBase::PatternLoggingListener::notifyOperationReplaced(
    Operation *op, ValueRange replacement) {
  LDBG() << patternName << " | notifyOperationReplaced (with values)"
         << " | " << op->getName();
  ForwardingListener::notifyOperationReplaced(op, replacement);
}

void RewriterBase::PatternLoggingListener::notifyOperationErased(
    Operation *op) {
  LDBG() << patternName << " | notifyOperationErased"
         << " | " << op->getName();
  ForwardingListener::notifyOperationErased(op);
}

void RewriterBase::PatternLoggingListener::notifyPatternBegin(
    const Pattern &pattern, Operation *op) {
  LDBG() << patternName << " | notifyPatternBegin"
         << " | " << op->getName();
  ForwardingListener::notifyPatternBegin(pattern, op);
}