Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Zwinkau
libfirm
Commits
fec61d59
Commit
fec61d59
authored
Mar 10, 2014
by
yb9976
Browse files
Added equivalent_node_Sync to local optimizations.
parent
00880ea4
Changes
1
Hide whitespace changes
Inline
Side-by-side
ir/ir/iropt.c
View file @
fec61d59
...
...
@@ -1322,6 +1322,35 @@ static ir_node *equivalent_node_Phi(ir_node *n)
return
n
;
}
/**
* Optimizes Sync nodes that have only one operand.
*/
static
ir_node
*
equivalent_node_Sync
(
ir_node
*
n
)
{
int
arity
=
get_Sync_n_preds
(
n
);
assert
(
arity
>
0
);
ir_node
*
op
=
get_Sync_pred
(
n
,
0
);
for
(
int
i
=
1
;
i
<
arity
;
i
++
)
{
ir_node
*
pred
=
get_Sync_pred
(
n
,
i
);
if
(
pred
==
op
)
{
continue
;
}
/* We can ignore Bad predecessors */
if
(
is_Bad
(
op
))
{
op
=
pred
;
continue
;
}
return
n
;
}
return
op
;
}
/**
* Optimize Proj(Tuple).
*/
...
...
@@ -6057,14 +6086,6 @@ static ir_node *transform_node_Sync(ir_node *n)
}
}
if
(
arity
==
0
)
{
ir_graph
*
irg
=
get_irn_irg
(
n
);
return
new_r_Bad
(
irg
,
mode_M
);
}
if
(
arity
==
1
)
{
return
get_Sync_pred
(
n
,
0
);
}
/* rehash the sync node */
add_identities
(
n
);
return
n
;
...
...
@@ -6671,6 +6692,7 @@ void ir_register_opt_node_ops(void)
register_equivalent_node_func
(
op_Shr
,
equivalent_node_left_zero
);
register_equivalent_node_func
(
op_Shrs
,
equivalent_node_left_zero
);
register_equivalent_node_func
(
op_Sub
,
equivalent_node_Sub
);
register_equivalent_node_func
(
op_Sync
,
equivalent_node_Sync
);
register_equivalent_node_func_proj
(
op_Div
,
equivalent_node_Proj_Div
);
register_equivalent_node_func_proj
(
op_Tuple
,
equivalent_node_Proj_Tuple
);
register_equivalent_node_func_proj
(
op_Store
,
equivalent_node_Proj_Store
);
...
...
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