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
7c8e1979
Commit
7c8e1979
authored
Jul 02, 2019
by
Paul
Browse files
Formatting
parent
3cb4edfe
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
7 deletions
+5
-7
src/include/migraphx/functional.hpp
src/include/migraphx/functional.hpp
+2
-2
src/include/migraphx/matcher.hpp
src/include/migraphx/matcher.hpp
+2
-4
test/matcher.cpp
test/matcher.cpp
+1
-1
No files found.
src/include/migraphx/functional.hpp
View file @
7c8e1979
...
...
@@ -190,11 +190,11 @@ auto pop_back_args(Ts&&... xs)
};
}
template
<
class
T
>
template
<
class
T
>
struct
always_f
{
T
x
;
template
<
class
...
Ts
>
template
<
class
...
Ts
>
constexpr
T
operator
()(
Ts
&&
...)
const
{
return
x
;
...
...
src/include/migraphx/matcher.hpp
View file @
7c8e1979
...
...
@@ -261,16 +261,14 @@ struct lazy_or
template
<
class
Op
,
bool
Start
,
bool
Matches
>
struct
folder
{
template
<
class
...
Ms
>
template
<
class
...
Ms
>
static
bool
fold_match
(
matcher_context
&
ctx
,
instruction_ref
ins
,
Ms
...
ms
)
{
Op
op
;
auto
matched
=
[
&
](
auto
m
)
{
return
[
&
]
{
return
ctx
.
matched
(
m
,
ins
);
};
};
return
fold
([
&
](
auto
x
,
auto
y
)
{
return
op
(
always
(
x
),
matched
(
y
));
})(
Start
,
ms
...);
return
fold
([
&
](
auto
x
,
auto
y
)
{
return
op
(
always
(
x
),
matched
(
y
));
})(
Start
,
ms
...);
}
template
<
class
...
Ts
>
auto
operator
()(
Ts
...
ms
)
const
{
...
...
test/matcher.cpp
View file @
7c8e1979
...
...
@@ -156,7 +156,7 @@ TEST_CASE(match_arg8)
auto
sum
=
p
.
add_instruction
(
sum_op
{},
one
,
two
);
p
.
add_instruction
(
pass_op
{},
sum
);
auto
m
=
match
::
name
(
"sum"
)(
match
::
all_of
(
match
::
arg
(
0
)(
match
::
name
(
"@literal"
)),
match
::
arg
(
1
)(
match
::
name
(
"@literal"
))),
match
::
arg
(
1
)(
match
::
name
(
"@literal"
))),
match
::
standard_shape
());
auto
r
=
find_match
(
p
,
m
);
EXPECT
(
bool
{
r
.
result
==
sum
});
...
...
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