Commit 96f0f567 authored by Paul's avatar Paul
Browse files

Formatting

parent d3f83759
......@@ -186,21 +186,23 @@ matcher_result match_instruction(program& p, instruction_ref ins, M&& m)
return result;
}
template<class... Ms>
template <class... Ms>
void find_matches(program& p, Ms&&... ms)
{
for(auto ins:iterator_for(p))
for(auto ins : iterator_for(p))
{
bool match = false;
each_args([&](auto&& m) {
if(match)
return;
auto r = match_instruction(p, ins, m.matcher());
if(r.result == p.end())
return;
m.apply(r);
match = true;
}, ms...);
each_args(
[&](auto&& m) {
if(match)
return;
auto r = match_instruction(p, ins, m.matcher());
if(r.result == p.end())
return;
m.apply(r);
match = true;
},
ms...);
}
}
......
......@@ -314,24 +314,15 @@ void match_bind1()
struct match_find_sum
{
migraph::instruction_ref ins;
auto matcher() const
{
return matchers::name("sum");
}
auto matcher() const { return matchers::name("sum"); }
void apply(matchers::matcher_result r) const
{
EXPECT(bool{r.result == ins});
}
void apply(matchers::matcher_result r) const { EXPECT(bool{r.result == ins}); }
};
struct match_find_literal
{
migraph::instruction_ref ins;
auto matcher() const
{
return matchers::name("@literal");
}
auto matcher() const { return matchers::name("@literal"); }
void apply(matchers::matcher_result r) const
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment