Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
445d4b31
Commit
445d4b31
authored
Sep 23, 2018
by
Paul
Browse files
Move everything to matchers namespace
parent
aab3016d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
src/include/migraph/matcher.hpp
src/include/migraph/matcher.hpp
+4
-4
test/matcher.cpp
test/matcher.cpp
+3
-3
No files found.
src/include/migraph/matcher.hpp
View file @
445d4b31
...
@@ -10,6 +10,8 @@
...
@@ -10,6 +10,8 @@
namespace
migraph
{
namespace
migraph
{
namespace
matchers
{
struct
matcher_context
struct
matcher_context
{
{
matcher_context
(
instruction_ref
i
)
:
last
(
i
)
{}
matcher_context
(
instruction_ref
i
)
:
last
(
i
)
{}
...
@@ -156,7 +158,7 @@ basic_matcher<predicate_matcher<P>> make_basic_pred_matcher(P p)
...
@@ -156,7 +158,7 @@ basic_matcher<predicate_matcher<P>> make_basic_pred_matcher(P p)
{ \
{ \
instruction_ref match(__VA_ARGS__) const; \
instruction_ref match(__VA_ARGS__) const; \
}; \
}; \
const constexpr auto name = migraph::basic_matcher<name##_m>{{}}; \
const constexpr auto name = migraph::
matchers::
basic_matcher<name##_m>{{}}; \
inline instruction_ref name##_m::match(__VA_ARGS__) const
inline instruction_ref name##_m::match(__VA_ARGS__) const
#define MIGRAPH_PRED_MATCHER(name, ...) \
#define MIGRAPH_PRED_MATCHER(name, ...) \
...
@@ -164,7 +166,7 @@ basic_matcher<predicate_matcher<P>> make_basic_pred_matcher(P p)
...
@@ -164,7 +166,7 @@ basic_matcher<predicate_matcher<P>> make_basic_pred_matcher(P p)
{ \
{ \
bool operator()(__VA_ARGS__) const; \
bool operator()(__VA_ARGS__) const; \
}; \
}; \
const constexpr auto name = migraph::basic_matcher<predicate_matcher<name##_m>>{{}}; \
const constexpr auto name = migraph::
matchers::
basic_matcher<predicate_matcher<name##_m>>{{}}; \
inline bool name##_m::operator()(__VA_ARGS__) const
inline bool name##_m::operator()(__VA_ARGS__) const
struct
matcher_result
struct
matcher_result
...
@@ -184,8 +186,6 @@ matcher_result match_instruction(program& p, instruction_ref ins, M&& m)
...
@@ -184,8 +186,6 @@ matcher_result match_instruction(program& p, instruction_ref ins, M&& m)
return
result
;
return
result
;
}
}
namespace
matchers
{
template
<
class
...
Ts
>
template
<
class
...
Ts
>
auto
all_of
(
Ts
...
ms
)
auto
all_of
(
Ts
...
ms
)
{
{
...
...
test/matcher.cpp
View file @
445d4b31
...
@@ -6,12 +6,12 @@
...
@@ -6,12 +6,12 @@
namespace
matchers
=
migraph
::
matchers
;
namespace
matchers
=
migraph
::
matchers
;
template
<
class
M
>
template
<
class
M
>
migraph
::
matcher_result
find_match
(
migraph
::
program
&
p
,
M
&&
m
)
migraph
::
matchers
::
matcher_result
find_match
(
migraph
::
program
&
p
,
M
&&
m
)
{
{
migraph
::
matcher_result
result
;
migraph
::
matchers
::
matcher_result
result
;
for
(
auto
ins
:
migraph
::
iterator_for
(
p
))
for
(
auto
ins
:
migraph
::
iterator_for
(
p
))
{
{
result
=
migraph
::
match_instruction
(
p
,
ins
,
m
);
result
=
migraph
::
matchers
::
match_instruction
(
p
,
ins
,
m
);
if
(
result
.
result
!=
p
.
end
())
if
(
result
.
result
!=
p
.
end
())
return
result
;
return
result
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment