Skip to content

Commit

Permalink
fix synthesizer
Browse files Browse the repository at this point in the history
  • Loading branch information
julienhenry committed Oct 14, 2022
1 parent fd3c6f8 commit b698a0b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/synthesiser/Synthesiser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1144,7 +1144,7 @@ void Synthesiser::emitCode(std::ostream& out, const Statement& stmt) {
break;
}
} else if (const auto* uda = as<ram::UserDefinedAggregator>(aggregator)) {
out << "res0 = functors::" << uda->getName() << "(";
out << "res0 = " << uda->getName() << "(";
if (uda->isStateful()) {
out << "&symTable, &recordTable, ";
}
Expand Down Expand Up @@ -2422,6 +2422,14 @@ std::set<std::string> Synthesiser::accessedUserDefinedFunctors(Statement& stmt)
const std::string& name = node.getName();
accessed.insert(name);
});
auto visitAggregate = [&](const AbstractAggregate& op) {
const Aggregator& aggregator = op.getAggregator();
if (const auto* uda = as<UserDefinedAggregator>(aggregator)) {
accessed.insert(uda->getName());
}
};
visit(stmt, [&](const Aggregate& op) { visitAggregate(op); });
visit(stmt, [&](const IndexAggregate& op) { visitAggregate(op); });
return accessed;
};

Expand Down

0 comments on commit b698a0b

Please sign in to comment.