summaryrefslogtreecommitdiff
path: root/frontends
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2013-11-21 21:26:56 +0100
committerClifford Wolf <clifford@clifford.at>2013-11-21 21:26:56 +0100
commit95c94a02fc55664b5895f95e54a7212213539068 (patch)
treeb633c12df09ee31e2347464e92d88b883427c857 /frontends
parent09471846c553855c43224ce32d855c46f4df5140 (diff)
Fixed async proc detection in mem2reg
Diffstat (limited to 'frontends')
-rw-r--r--frontends/ast/simplify.cc14
1 files changed, 9 insertions, 5 deletions
diff --git a/frontends/ast/simplify.cc b/frontends/ast/simplify.cc
index f1cce397..a3518ff0 100644
--- a/frontends/ast/simplify.cc
+++ b/frontends/ast/simplify.cc
@@ -77,9 +77,13 @@ bool AstNode::simplify(bool const_fold, bool at_zero, bool in_lvalue, int stage,
if (memflags & AstNode::MEM2REG_FL_EQ2)
goto verbose_activate;
+ if (memflags & AstNode::MEM2REG_FL_SET_ASYNC)
+ goto verbose_activate;
+
if ((memflags & AstNode::MEM2REG_FL_SET_INIT) && (memflags & AstNode::MEM2REG_FL_SET_ELSE))
goto verbose_activate;
+ // log("Note: Not replacing memory %s with list of registers (flags=0x%08lx).\n", mem->str.c_str(), long(memflags));
continue;
verbose_activate:
@@ -94,6 +98,7 @@ bool AstNode::simplify(bool const_fold, bool at_zero, bool in_lvalue, int stage,
}
silent_activate:
+ // log("Note: Replacing memory %s with list of registers (flags=0x%08lx).\n", mem->str.c_str(), long(memflags));
mem2reg_set.insert(mem);
}
@@ -1349,12 +1354,11 @@ void AstNode::mem2reg_as_needed_pass1(std::map<AstNode*, std::set<std::string>>
std::map<AstNode*, uint32_t> *proc_flags_p = NULL;
if (type == AST_ALWAYS) {
- bool sync_proc = false;
- for (auto child : children) {
+ int count_edge_events = 0;
+ for (auto child : children)
if (child->type == AST_POSEDGE || child->type == AST_NEGEDGE)
- sync_proc = true;
- }
- if (!sync_proc)
+ count_edge_events++;
+ if (count_edge_events != 1)
children_flags |= AstNode::MEM2REG_FL_ASYNC;
proc_flags_p = new std::map<AstNode*, uint32_t>;
}