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
26b90086
Commit
26b90086
authored
Jul 13, 2012
by
Christoph Mallon
Browse files
Use foreach_pset().
parent
a6e4400b
Changes
8
Hide whitespace changes
Inline
Side-by-side
ir/adt/set.c
View file @
26b90086
...
...
@@ -438,7 +438,7 @@ void *(pset_insert) (SET *se, const void *key, unsigned hash)
void
pset_insert_pset_ptr
(
pset
*
target
,
pset
*
src
)
{
void
*
elt
;
for
(
elt
=
pset_first
(
src
);
elt
;
elt
=
pset_next
(
src
)
)
{
for
each_pset
(
src
,
void
*
,
elt
)
{
pset_insert_ptr
(
target
,
elt
);
}
}
...
...
ir/ana/callgraph.c
View file @
26b90086
...
...
@@ -278,25 +278,23 @@ void compute_callgraph(void)
count
=
pset_count
(
callee_set
);
irg
->
callees
=
NEW_ARR_F
(
cg_callee_entry
*
,
count
);
irg
->
callee_isbe
=
NULL
;
callee
=
(
cg_callee_entry
*
)
pset_first
(
callee_set
);
for
(
j
=
0
;
j
<
count
;
++
j
)
{
irg
->
callees
[
j
]
=
callee
;
callee
=
(
cg_callee_entry
*
)
pset_next
(
callee_set
);
j
=
0
;
foreach_pset
(
callee_set
,
cg_callee_entry
*
,
callee
)
{
irg
->
callees
[
j
++
]
=
callee
;
}
del_pset
(
callee_set
);
assert
(
callee
==
NULL
);
assert
(
j
==
count
);
caller_set
=
(
pset
*
)
irg
->
callers
;
count
=
pset_count
(
caller_set
);
irg
->
callers
=
NEW_ARR_F
(
ir_graph
*
,
count
);
irg
->
caller_isbe
=
NULL
;
c
=
(
ir_graph
*
)
pset_first
(
caller_set
);
for
(
j
=
0
;
j
<
count
;
++
j
)
{
irg
->
callers
[
j
]
=
c
;
c
=
(
ir_graph
*
)
pset_next
(
caller_set
);
j
=
0
;
foreach_pset
(
caller_set
,
ir_graph
*
,
c
)
{
irg
->
callers
[
j
++
]
=
c
;
}
del_pset
(
caller_set
);
assert
(
c
==
NULL
);
assert
(
j
==
count
);
}
set_irp_callgraph_state
(
irp_callgraph_consistent
);
}
...
...
ir/be/becopyilp2.c
View file @
26b90086
...
...
@@ -348,7 +348,7 @@ static inline void remove_edge(set *edges, ir_node *n1, ir_node *n2, size_t *cou
}
}
#define pset_foreach(pset, irn)
for
(irn=(ir_node*)pset_first(pset); irn; irn=(ir_node*)pset_next(pset
))
#define pset_foreach(pset, irn) for
each_pset((pset), ir_node*, (irn
))
/**
* Search for an interference clique and an external node
...
...
ir/be/beifg.c
View file @
26b90086
...
...
@@ -247,8 +247,7 @@ static inline int get_next_clique(cliques_iter_t *it)
ir_node
*
irn
;
/* fill the output buffer */
for
(
irn
=
(
ir_node
*
)
pset_first
(
it
->
living
);
irn
!=
NULL
;
irn
=
(
ir_node
*
)
pset_next
(
it
->
living
))
{
foreach_pset
(
it
->
living
,
ir_node
*
,
irn
)
{
it
->
buf
[
count
++
]
=
irn
;
}
...
...
ir/stat/distrib.c
View file @
26b90086
...
...
@@ -205,20 +205,14 @@ double stat_calc_mean_distrib_tbl(distrib_tbl_t *tbl)
if
(
tbl
->
int_dist
)
{
/* integer distribution, need min, max */
int
min
,
max
;
entry
=
(
distrib_entry_t
*
)
pset_first
(
tbl
->
hash_map
);
if
(
!
entry
)
if
(
pset_count
(
tbl
->
hash_map
)
==
0
)
return
0
.
0
;
min
=
max
=
PTR_TO_INT
(
entry
->
object
);
sum
=
cnt_to_dbl
(
&
entry
->
cnt
);
int
min
=
INT_MAX
;
int
max
=
INT_MIN
;
sum
=
0
.
0
;
for
(
entry
=
(
distrib_entry_t
*
)
pset_next
(
tbl
->
hash_map
);
entry
!=
NULL
;
entry
=
(
distrib_entry_t
*
)
pset_next
(
tbl
->
hash_map
))
{
foreach_pset
(
tbl
->
hash_map
,
distrib_entry_t
*
,
entry
)
{
int
value
=
PTR_TO_INT
(
entry
->
object
);
if
(
value
<
min
)
...
...
ir/stat/firmstat.c
View file @
26b90086
...
...
@@ -2077,8 +2077,7 @@ void stat_dump_snapshot(const char *name, const char *phase)
stat_dump_init
(
fname
);
/* calculate the graph statistics */
for
(
entry
=
(
graph_entry_t
*
)
pset_first
(
status
->
irg_hash
);
entry
!=
NULL
;
entry
=
(
graph_entry_t
*
)
pset_next
(
status
->
irg_hash
))
{
foreach_pset
(
status
->
irg_hash
,
graph_entry_t
*
,
entry
)
{
if
(
entry
->
irg
==
NULL
)
{
/* special entry for the global count */
continue
;
...
...
@@ -2097,8 +2096,7 @@ void stat_dump_snapshot(const char *name, const char *phase)
}
/* while */
/* dump per graph */
for
(
entry
=
(
graph_entry_t
*
)
pset_first
(
status
->
irg_hash
);
entry
!=
NULL
;
entry
=
(
graph_entry_t
*
)
pset_next
(
status
->
irg_hash
))
{
foreach_pset
(
status
->
irg_hash
,
graph_entry_t
*
,
entry
)
{
if
(
entry
->
irg
==
NULL
)
{
/* special entry for the global count */
continue
;
...
...
@@ -2137,8 +2135,7 @@ void stat_dump_snapshot(const char *name, const char *phase)
{
node_entry_t
*
entry
;
for
(
entry
=
(
node_entry_t
*
)
pset_first
(
global
->
opcode_hash
);
entry
!=
NULL
;
entry
=
(
node_entry_t
*
)
pset_next
(
global
->
opcode_hash
))
{
foreach_pset
(
global
->
opcode_hash
,
node_entry_t
*
,
entry
)
{
opcode_clear_entry
(
entry
);
}
/* for */
/* clear all global counter */
...
...
ir/stat/pattern.c
View file @
26b90086
...
...
@@ -746,7 +746,7 @@ static void store_pattern(const char *fname)
{
FILE
*
f
;
pattern_entry_t
*
entry
;
size_t
i
,
count
=
pset_count
(
status
->
pattern_hash
);
size_t
count
=
pset_count
(
status
->
pattern_hash
);
if
(
count
<=
0
)
return
;
...
...
@@ -760,9 +760,7 @@ static void store_pattern(const char *fname)
fwrite
(
"FPS1"
,
4
,
1
,
f
);
fwrite
(
&
count
,
sizeof
(
count
),
1
,
f
);
for
(
i
=
0
,
entry
=
(
pattern_entry_t
*
)
pset_first
(
status
->
pattern_hash
);
entry
&&
i
<
count
;
entry
=
(
pattern_entry_t
*
)
pset_next
(
status
->
pattern_hash
),
++
i
)
{
foreach_pset
(
status
->
pattern_hash
,
pattern_entry_t
*
,
entry
)
{
fwrite
(
entry
,
offsetof
(
pattern_entry_t
,
buf
)
+
entry
->
len
,
1
,
f
);
}
/* for */
fclose
(
f
);
...
...
@@ -844,10 +842,9 @@ static void pattern_output(const char *fname)
dump
=
new_vcg_dumper
(
fname
,
100
);
pattern_arr
=
XMALLOCN
(
pattern_entry_t
*
,
count
);
for
(
i
=
0
,
entry
=
(
pattern_entry_t
*
)
pset_first
(
status
->
pattern_hash
);
entry
&&
i
<
count
;
entry
=
(
pattern_entry_t
*
)
pset_next
(
status
->
pattern_hash
),
++
i
)
{
pattern_arr
[
i
]
=
entry
;
i
=
0
;
foreach_pset
(
status
->
pattern_hash
,
pattern_entry_t
*
,
entry
)
{
pattern_arr
[
i
++
]
=
entry
;
}
/* for */
assert
(
count
==
i
);
count
=
i
;
...
...
ir/stat/stat_dmp.c
View file @
26b90086
...
...
@@ -278,9 +278,7 @@ static void simple_dump_be_block_reg_pressure(dumper_t *dmp, graph_entry_t *entr
fprintf
(
dmp
->
f
,
"
\n
"
);
/* print the reg pressure for all blocks and register classes */
for
(
/* b_entry is already initialized */
;
b_entry
;
b_entry
=
(
be_block_entry_t
*
)
pset_next
(
entry
->
be_block_hash
))
{
foreach_pset
(
entry
->
block_hash
,
be_block_entry_t
*
,
b_entry
)
{
fprintf
(
dmp
->
f
,
"BLK %6ld"
,
b_entry
->
block_nr
);
foreach_pset
(
b_entry
->
reg_pressure
,
reg_pressure_entry_t
*
,
rp_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