add types (#559)

This commit is contained in:
water111
2021-06-05 16:58:32 -04:00
committed by GitHub
parent 2851cae13b
commit a572587a0e
32 changed files with 994 additions and 187 deletions
+14
View File
@@ -606,6 +606,13 @@ GenericOpMatcher GenericOpMatcher::condition(IR2_Condition::Kind condition) {
return m;
}
GenericOpMatcher GenericOpMatcher::or_match(const std::vector<GenericOpMatcher>& matchers) {
GenericOpMatcher m;
m.m_kind = Kind::OR;
m.m_sub_matchers = matchers;
return m;
}
bool GenericOpMatcher::do_match(GenericOperator& input, MatchResult::Maps* maps_out) const {
switch (m_kind) {
case Kind::FIXED:
@@ -623,6 +630,13 @@ bool GenericOpMatcher::do_match(GenericOperator& input, MatchResult::Maps* maps_
return input.condition_kind() == m_condition_kind;
}
return false;
case Kind::OR:
for (auto& m : m_sub_matchers) {
if (m.do_match(input, maps_out)) {
return true;
}
}
return false;
default:
assert(false);
return false;