Skip to content

Commit

Permalink
[DEBUG] Print rule line numbers in rw simplifier
Browse files Browse the repository at this point in the history
  • Loading branch information
sgrechanik-h committed Jun 19, 2019
1 parent c14cb38 commit ddfd8d6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/arithmetic/rewrite_simplify.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,34 @@ namespace arith {

using namespace ir;

//#define COUT_LINE std::cout << "RW " << __LINE__ << "\n"
#define COUT_LINE

// macro for doing simple rewrite
#define TVM_TRY_REWRITE(SrcExpr, ResExpr) \
if ((SrcExpr).Match(ret)) { \
COUT_LINE; \
return (ResExpr).Eval(); \
}

// macro for rewrite + recursively rewrite ResExpr
#define TVM_TRY_RECURSIVE_REWRITE(SrcExpr, ResExpr) \
if ((SrcExpr).Match(ret)) { \
COUT_LINE; \
return RecursiveRewrite((ResExpr).Eval()); \
}

// macro rewrite only if CondExor is true after match.
#define TVM_TRY_REWRITE_IF(SrcExpr, ResExpr, CondExpr) \
if ((SrcExpr).Match(ret) && (CondExpr)) { \
COUT_LINE; \
return (ResExpr).Eval(); \
}

// macro rewrite + recursive_rewrite only if CondExor is true after match.
#define TVM_TRY_RECURSIVE_REWRITE_IF(SrcExpr, ResExpr, CondExpr) \
if ((SrcExpr).Match(ret) && (CondExpr)) { \
COUT_LINE; \
return RecursiveRewrite((ResExpr).Eval()); \
}

Expand Down

0 comments on commit ddfd8d6

Please sign in to comment.