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
c015328a
Commit
c015328a
authored
Feb 11, 2010
by
Michael Beck
Browse files
Don't use malloc inside libFirm.
Kicked useless memory allocation and casts. [r27120]
parent
e0e9e9ac
Changes
1
Hide whitespace changes
Inline
Side-by-side
ir/ana/vrp.c
View file @
c015328a
...
...
@@ -541,14 +541,11 @@ void vrp_first_pass(ir_node *n, void *e) {
ir_node
*
succ
;
worklist_t
*
tmp_entry
;
int
i
;
struct
vrp_env_t
*
env
;
struct
vrp_env_t
*
env
=
e
;
if
(
is_Block
(
n
))
return
;
env
=
(
struct
vrp_env_t
*
)
e
;
set_irn_link
(
n
,
VISITED
);
update_vrp_data
(
n
);
...
...
@@ -558,7 +555,7 @@ void vrp_first_pass(ir_node *n, void *e) {
if
(
get_irn_link
(
succ
)
==
VISITED
)
{
// we found a loop
tmp_entry
=
(
struct
worklist_t
*
)
malloc
(
sizeof
(
struct
worklist_t
)
);
tmp_entry
=
XMALLOC
(
worklist_t
);
tmp_entry
->
node
=
n
;
list_add
(
&
(
tmp_entry
->
nodes
),
&
(
env
->
worklist
->
nodes
));
...
...
@@ -574,12 +571,7 @@ void set_vrp_data(ir_graph *irg) {
int
i
;
worklist_t
worklist
;
worklist_t
*
tmp_entry
,
*
tmp_entry2
;
struct
vrp_env_t
*
env
;
env
=
malloc
(
sizeof
(
struct
vrp_env_t
));
if
(
env
==
NULL
)
{
return
;
}
struct
vrp_env_t
env
;
if
(
!
irg
)
{
/* no graph, skip */
...
...
@@ -592,32 +584,32 @@ void set_vrp_data(ir_graph *irg) {
INIT_LIST_HEAD
(
&
worklist
.
nodes
);
env
->
worklist
=
&
worklist
;
irg_walk_graph
(
irg
,
NULL
,
vrp_first_pass
,
env
);
env
.
worklist
=
&
worklist
;
irg_walk_graph
(
irg
,
NULL
,
vrp_first_pass
,
&
env
);
// while there are entries in the worklist, continue
while
(
!
list_empty
(
&
worklist
.
nodes
)
)
{
struct
list_head
*
pos
,
*
next
;
list_head
*
pos
,
*
next
;
list_for_each_safe
(
pos
,
next
,
&
worklist
.
nodes
)
{
tmp_entry
=
list_entry
(
pos
,
struct
worklist_t
,
nodes
);
tmp_entry
=
list_entry
(
pos
,
worklist_t
,
nodes
);
if
(
update_vrp_data
(
tmp_entry
->
node
))
{
// if something changed, add successors to worklist
for
(
i
=
get_irn_n_outs
(
tmp_entry
->
node
)
-
1
;
i
>=
0
;
--
i
)
{
succ
=
get_irn_out
(
tmp_entry
->
node
,
i
);
tmp_entry2
=
(
struct
worklist_t
*
)
malloc
(
sizeof
(
struct
worklist_t
)
);
tmp_entry2
=
XMALLOC
(
worklist_t
);
tmp_entry2
->
node
=
succ
;
list_add
(
&
(
tmp_entry2
->
nodes
),
&
worklist
.
nodes
);
}
}
list_del
(
pos
);
free
(
tmp_entry
);
x
free
(
tmp_entry
);
}
}
}
...
...
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