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
5c8df19f
Commit
5c8df19f
authored
Jul 08, 2015
by
yb9976
Browse files
Use edges instead of outs.
parent
9240cbac
Changes
1
Show whitespace changes
Inline
Side-by-side
ir/opt/reassoc.c
View file @
5c8df19f
...
...
@@ -598,6 +598,15 @@ typedef struct {
ir_node
*
other_node
;
}
optimization_t
;
/**
* Returns true if we can be sure that @p node only has a single read user.
*/
static
bool
only_one_user
(
const
ir_node
*
node
)
{
assert
(
edges_activated
(
get_irn_irg
(
node
)));
return
get_irn_n_edges
(
node
)
<=
1
;
}
/**
* Try to find middle_node or top_node, from base_node over a non-direct path.
*
...
...
@@ -638,7 +647,7 @@ static void find_path_to_top_node(ir_node *current, ir_node *other_node, ir_node
middle_node2
=
middle_node
;
}
if
(
current
==
top_node2
&&
((
middle_node
&&
get_irn_n_outs
(
middle_node
)
>
1
)
||
base_node
!=
other_node
))
{
if
(
current
==
top_node2
&&
((
middle_node
&&
!
only_one_user
(
middle_node
))
||
base_node
!=
other_node
))
{
optimization_t
*
optimization
=
XMALLOC
(
optimization_t
);
optimization
->
base_node
=
base_node
;
optimization
->
middle_node
=
middle_node2
;
...
...
@@ -660,7 +669,7 @@ static void find_path_to_top_node(ir_node *current, ir_node *other_node, ir_node
}
pmap_insert
(
shdata
->
walk_counter
,
current
,
(
void
*
)
counter
);
if
((
counter
-
shdata
->
walk_base
)
==
get_irn_n_
out
s
(
current
)
&&
is_bitop
(
current
))
{
if
((
counter
-
shdata
->
walk_base
)
==
(
unsigned
)
get_irn_n_
edge
s
(
current
)
&&
is_bitop
(
current
))
{
foreach_irn_in
(
current
,
i
,
n
)
{
find_path_to_top_node
(
n
,
current
,
base_node
,
middle_node
,
top_node
,
shdata
);
}
...
...
@@ -835,15 +844,6 @@ static void do_shannon(ir_graph *irg)
plist_free
(
optimizations
);
}
/**
* Returns true if we can be sure that @p node only has a single read user.
*/
static
bool
only_one_user
(
const
ir_node
*
node
)
{
assert
(
edges_activated
(
get_irn_irg
(
node
)));
return
get_irn_n_edges
(
node
)
<=
1
;
}
typedef
enum
{
NOT_FOUND
,
/**< no match found */
FOUND_FIRST
,
/**< found a match for the first node */
...
...
Write
Preview
Supports
Markdown
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