Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Zwinkau
libfirm
Commits
3102cb53
Commit
3102cb53
authored
Aug 01, 2012
by
Matthias Braun
Browse files
fix bugs in execfreq rework commit
parent
333c0b86
Changes
2
Hide whitespace changes
Inline
Side-by-side
ir/ana/execfreq.c
View file @
3102cb53
...
...
@@ -90,7 +90,9 @@ static void exec_freq_node_info(void *ctx, FILE *f, const ir_node *irn)
(
void
)
ctx
;
if
(
!
is_Block
(
irn
))
return
;
fprintf
(
f
,
"execution frequency: %g
\n
"
,
get_block_execfreq
(
irn
));
const
freq_t
*
freq
=
ir_nodehashmap_get
(
freq_t
,
&
freq_map
,
irn
);
if
(
freq
!=
NULL
)
fprintf
(
f
,
"execution frequency: %g
\n
"
,
get_block_execfreq
(
irn
));
}
void
init_execfreq
(
void
)
...
...
@@ -272,7 +274,7 @@ void ir_estimate_execfreq(ir_graph *irg)
ir_node
*
end_block
=
get_irg_end_block
(
irg
);
for
(
int
idx
=
dfs_get_n_nodes
(
dfs
)
-
1
;
idx
>=
0
;
--
idx
)
{
for
(
int
idx
=
size
-
1
;
idx
>=
0
;
--
idx
)
{
const
ir_node
*
bb
=
(
ir_node
*
)
dfs_get_post_num_node
(
dfs
,
size
-
idx
-
1
);
/* Sum of (execution frequency of predecessor * probability of cf edge) ... */
...
...
@@ -330,7 +332,7 @@ void ir_estimate_execfreq(ir_graph *irg)
double
start_freq
=
x
[
start_idx
];
double
norm
=
start_freq
!=
0
.
0
?
1
.
0
/
start_freq
:
1
.
0
;
for
(
int
idx
=
dfs_get_n_nodes
(
dfs
)
-
1
;
idx
>=
0
;
--
idx
)
{
for
(
int
idx
=
size
-
1
;
idx
>=
0
;
--
idx
)
{
ir_node
*
bb
=
(
ir_node
*
)
dfs_get_post_num_node
(
dfs
,
size
-
idx
-
1
);
/* take abs because it sometimes can be -0 in case of endless loops */
...
...
ir/be/betranshlp.c
View file @
3102cb53
...
...
@@ -37,6 +37,7 @@
#include
"trouts.h"
#include
"cgana.h"
#include
"debug.h"
#include
"execfreq_t.h"
#include
"beirg.h"
#include
"beabi.h"
...
...
@@ -114,6 +115,10 @@ static ir_node *transform_block(ir_node *node)
copy_node_attr
(
irg
,
node
,
block
);
block
->
node_nr
=
node
->
node_nr
;
/* transfer execfreq value */
double
execfreq
=
get_block_execfreq
(
node
);
set_block_execfreq
(
block
,
execfreq
);
/* put the preds in the worklist */
be_enqueue_preds
(
node
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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