(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)
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) ... */
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 */
#include "trouts.h"
#include "cgana.h"
#include "debug.h"
+#include "execfreq_t.h"
#include "beirg.h"
#include "beabi.h"
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);