diff options
author | Clifford Wolf <clifford@clifford.at> | 2015-02-20 10:33:20 +0100 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2015-02-20 10:33:20 +0100 |
commit | d5ce9a32ef51cd56810b3a1842dff846c1c8eab6 (patch) | |
tree | a0e3e32c70a72ee45bca75bce112aedc29dad37e /frontends/ast | |
parent | dc1a0f06fcfe545825f0a432cd42297785c98c1a (diff) | |
download | yosys-d5ce9a32ef51cd56810b3a1842dff846c1c8eab6.tar.gz yosys-d5ce9a32ef51cd56810b3a1842dff846c1c8eab6.tar.bz2 yosys-d5ce9a32ef51cd56810b3a1842dff846c1c8eab6.zip |
Added deep recursion warning to AST simplify
Diffstat (limited to 'frontends/ast')
-rw-r--r-- | frontends/ast/simplify.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/frontends/ast/simplify.cc b/frontends/ast/simplify.cc index ed767514b..404dab4e8 100644 --- a/frontends/ast/simplify.cc +++ b/frontends/ast/simplify.cc @@ -51,7 +51,12 @@ bool AstNode::simplify(bool const_fold, bool at_zero, bool in_lvalue, int stage, { static int recursion_counter = 0; static pair<string, int> last_blocking_assignment_warn; - recursion_counter++; + static bool deep_recursion_warning = false; + + if (recursion_counter++ == 1000 && deep_recursion_warning) { + log_warning("Deep recursion in AST simplifier.\nDoes this design contain insanely long expressions?\n"); + deep_recursion_warning = false; + } AstNode *newNode = NULL; bool did_something = false; @@ -69,6 +74,7 @@ bool AstNode::simplify(bool const_fold, bool at_zero, bool in_lvalue, int stage, log_assert(type == AST_MODULE); last_blocking_assignment_warn = pair<string, int>(); + deep_recursion_warning = true; while (simplify(const_fold, at_zero, in_lvalue, 1, width_hint, sign_hint, in_param)) { } if (!flag_nomem2reg && !get_bool_attribute("\\nomem2reg")) |