3 * File name: ir/ir/firmstat.c
4 * Purpose: Statistics for Firm.
8 * Copyright: (c) 2004 Universität Karlsruhe
9 * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
16 #ifdef FIRM_STATISTICS
30 #include "firmstat_t.h"
38 * need this to be static:
39 * Special pseudo Opcodes that we need to count some interesting cases
43 * The Phi0, a node that is created during SSA construction
45 static ir_op _op_Phi0;
47 /** The PhiM, just to count memory Phi's. */
48 static ir_op _op_PhiM;
50 /** The Mul by Const node. */
51 static ir_op _op_MulC;
53 /** The Div by Const node. */
54 static ir_op _op_DivC;
56 /** The Div by Const node. */
57 static ir_op _op_ModC;
59 /** The Div by Const node. */
60 static ir_op _op_DivModC;
62 /** The memory Proj node. */
63 static ir_op _op_ProjM;
66 static ir_op _op_SelSel;
68 /** A Sel of a Sel of a Sel */
69 static ir_op _op_SelSelSel;
71 /* ---------------------------------------------------------------------------------- */
73 /** Marks the begin of a statistic (hook) function. */
74 #define STAT_ENTER ++status->recursive
76 /** Marks the end of a statistic (hook) functions. */
77 #define STAT_LEAVE --status->recursive
79 /** Allows to enter a statistic function only when we are not already in a hook. */
80 #define STAT_ENTER_SINGLE do { if (status->recursive > 0) return; ++status->recursive; } while (0)
85 static const int status_disable = 0;
86 static stat_info_t *status = (stat_info_t *)&status_disable;
89 * compare two elements of the opcode hash
91 static int opcode_cmp(const void *elt, const void *key)
93 const node_entry_t *e1 = elt;
94 const node_entry_t *e2 = key;
96 return e1->op->code - e2->op->code;
100 * compare two elements of the graph hash
102 static int graph_cmp(const void *elt, const void *key)
104 const graph_entry_t *e1 = elt;
105 const graph_entry_t *e2 = key;
107 return e1->irg != e2->irg;
111 * compare two elements of the optimization hash
113 static int opt_cmp(const void *elt, const void *key)
115 const opt_entry_t *e1 = elt;
116 const opt_entry_t *e2 = key;
118 return e1->op->code != e2->op->code;
122 * compare two elements of the block/extbb hash
124 static int block_cmp(const void *elt, const void *key)
126 const block_entry_t *e1 = elt;
127 const block_entry_t *e2 = key;
129 return e1->block_nr != e2->block_nr;
133 * compare two elements of the be_block hash
135 static int be_block_cmp(const void *elt, const void *key)
137 const be_block_entry_t *e1 = elt;
138 const be_block_entry_t *e2 = key;
140 return e1->block_nr != e2->block_nr;
144 * compare two elements of the block/extbb hash
146 static int reg_pressure_cmp(const void *elt, const void *key)
148 const reg_pressure_entry_t *e1 = elt;
149 const reg_pressure_entry_t *e2 = key;
151 return e1->id_name != e2->id_name;
155 * compare two elements of the ir_op hash
157 static int opcode_cmp_2(const void *elt, const void *key)
159 const ir_op *e1 = elt;
160 const ir_op *e2 = key;
162 return e1->code != e2->code;
166 * compare two elements of the address_mark set
168 static int address_mark_cmp(const void *elt, const void *key, size_t size)
170 const address_mark_entry_t *e1 = elt;
171 const address_mark_entry_t *e2 = key;
173 /* compare only the nodes, the rest is used as data container */
174 return e1->node != e2->node;
178 * clears all counter in a node_entry_t
180 static void opcode_clear_entry(node_entry_t *elem)
182 cnt_clr(&elem->cnt_alive);
183 cnt_clr(&elem->new_node);
184 cnt_clr(&elem->into_Id);
188 * Returns the associates node_entry_t for an ir_op
190 * @param op the IR operation
191 * @param hmap a hash map containing ir_op* -> node_entry_t*
193 static node_entry_t *opcode_get_entry(const ir_op *op, hmap_node_entry_t *hmap)
200 elem = pset_find(hmap, &key, op->code);
204 elem = obstack_alloc(&status->cnts, sizeof(*elem));
205 memset(elem, 0, sizeof(*elem));
208 opcode_clear_entry(elem);
212 return pset_insert(hmap, elem, op->code);
216 * Returns the associates ir_op for an opcode
218 * @param code the IR opcode
219 * @param hmap the hash map containing opcode -> ir_op*
221 static ir_op *opcode_find_entry(opcode code, hmap_ir_op *hmap)
226 return pset_find(hmap, &key, code);
230 * clears all counter in a graph_entry_t
232 static void graph_clear_entry(graph_entry_t *elem, int all)
235 cnt_clr(&elem->cnt_walked);
236 cnt_clr(&elem->cnt_walked_blocks);
237 cnt_clr(&elem->cnt_was_inlined);
238 cnt_clr(&elem->cnt_got_inlined);
239 cnt_clr(&elem->cnt_strength_red);
240 cnt_clr(&elem->cnt_real_func_call);
242 cnt_clr(&elem->cnt_edges);
243 cnt_clr(&elem->cnt_all_calls);
244 cnt_clr(&elem->cnt_call_with_cnst_arg);
245 cnt_clr(&elem->cnt_indirect_calls);
247 if (elem->block_hash) {
248 del_pset(elem->block_hash);
249 elem->block_hash = NULL;
252 if (elem->extbb_hash) {
253 del_pset(elem->extbb_hash);
254 elem->extbb_hash = NULL;
257 obstack_free(&elem->recalc_cnts, NULL);
258 obstack_init(&elem->recalc_cnts);
262 * Returns the associated graph_entry_t for an IR graph.
264 * @param irg the IR graph
265 * @param hmap the hash map containing ir_graph* -> graph_entry_t*
267 static graph_entry_t *graph_get_entry(ir_graph *irg, hmap_graph_entry_t *hmap)
275 elem = pset_find(hmap, &key, HASH_PTR(irg));
279 /* allocate a new one */
280 elem = obstack_alloc(&status->cnts, sizeof(*elem));
281 memset(elem, 0, sizeof(*elem));
282 obstack_init(&elem->recalc_cnts);
285 graph_clear_entry(elem, 1);
287 /* new hash table for opcodes here */
288 elem->opcode_hash = new_pset(opcode_cmp, 5);
289 elem->address_mark = new_set(address_mark_cmp, 5);
292 /* create hash map backend block information */
293 elem->be_block_hash = new_pset(be_block_cmp, 5);
295 /* these hash tables are created on demand */
296 elem->block_hash = NULL;
297 elem->extbb_hash = NULL;
299 for (i = 0; i < sizeof(elem->opt_hash)/sizeof(elem->opt_hash[0]); ++i)
300 elem->opt_hash[i] = new_pset(opt_cmp, 4);
302 return pset_insert(hmap, elem, HASH_PTR(irg));
306 * clears all counter in an opt_entry_t
308 static void opt_clear_entry(opt_entry_t *elem)
310 cnt_clr(&elem->count);
314 * Returns the associated opt_entry_t for an IR operation.
316 * @param op the IR operation
317 * @param hmap the hash map containing ir_op* -> opt_entry_t*
319 static opt_entry_t *opt_get_entry(const ir_op *op, hmap_opt_entry_t *hmap)
326 elem = pset_find(hmap, &key, op->code);
330 elem = obstack_alloc(&status->cnts, sizeof(*elem));
331 memset(elem, 0, sizeof(*elem));
333 /* clear new counter */
334 opt_clear_entry(elem);
338 return pset_insert(hmap, elem, op->code);
342 * clears all counter in a block_entry_t
344 static void block_clear_entry(block_entry_t *elem)
346 cnt_clr(&elem->cnt_nodes);
347 cnt_clr(&elem->cnt_edges);
348 cnt_clr(&elem->cnt_in_edges);
349 cnt_clr(&elem->cnt_out_edges);
350 cnt_clr(&elem->cnt_phi_data);
354 * Returns the associated block_entry_t for an block.
356 * @param block_nr an IR block number
357 * @param hmap a hash map containing long -> block_entry_t
359 static block_entry_t *block_get_entry(struct obstack *obst, long block_nr, hmap_block_entry_t *hmap)
364 key.block_nr = block_nr;
366 elem = pset_find(hmap, &key, block_nr);
370 elem = obstack_alloc(obst, sizeof(*elem));
371 memset(elem, 0, sizeof(*elem));
373 /* clear new counter */
374 block_clear_entry(elem);
376 elem->block_nr = block_nr;
378 return pset_insert(hmap, elem, block_nr);
382 * clears all sets in be_block_entry_t
384 static void be_block_clear_entry(be_block_entry_t *elem)
386 if (elem->reg_pressure)
387 del_pset(elem->reg_pressure);
389 if (elem->sched_ready)
390 stat_delete_distrib_tbl(elem->sched_ready);
392 elem->reg_pressure = new_pset(reg_pressure_cmp, 5);
393 elem->sched_ready = stat_new_int_distrib_tbl();
397 * Returns the associated be_block_entry_t for an block.
399 * @param block_nr an IR block number
400 * @param hmap a hash map containing long -> be_block_entry_t
402 static be_block_entry_t *be_block_get_entry(struct obstack *obst, long block_nr, hmap_be_block_entry_t *hmap)
404 be_block_entry_t key;
405 be_block_entry_t *elem;
407 key.block_nr = block_nr;
409 elem = pset_find(hmap, &key, block_nr);
413 elem = obstack_alloc(obst, sizeof(*elem));
414 memset(elem, 0, sizeof(*elem));
416 /* clear new counter */
417 be_block_clear_entry(elem);
419 elem->block_nr = block_nr;
421 return pset_insert(hmap, elem, block_nr);
426 * Returns the ir_op for an IR-node,
427 * handles special cases and return pseudo op codes.
429 * @param none an IR node
431 static ir_op *stat_get_irn_op(ir_node *node)
433 ir_op *op = get_irn_op(node);
435 if (op == op_Phi && get_irn_arity(node) == 0) {
436 /* special case, a Phi0 node, count on extra counter */
437 op = status->op_Phi0 ? status->op_Phi0 : op;
439 else if (op == op_Phi && get_irn_mode(node) == mode_M) {
440 /* special case, a Memory Phi node, count on extra counter */
441 op = status->op_PhiM ? status->op_PhiM : op;
443 else if (op == op_Proj && get_irn_mode(node) == mode_M) {
444 /* special case, a Memory Proj node, count on extra counter */
445 op = status->op_ProjM ? status->op_ProjM : op;
447 else if (op == op_Mul &&
448 (get_irn_op(get_Mul_left(node)) == op_Const || get_irn_op(get_Mul_right(node)) == op_Const)) {
449 /* special case, a Multiply by a const, count on extra counter */
450 op = status->op_MulC ? status->op_MulC : op;
452 else if (op == op_Div && get_irn_op(get_Div_right(node)) == op_Const) {
453 /* special case, a division by a const, count on extra counter */
454 op = status->op_DivC ? status->op_DivC : op;
456 else if (op == op_Mod && get_irn_op(get_Mod_right(node)) == op_Const) {
457 /* special case, a module by a const, count on extra counter */
458 op = status->op_ModC ? status->op_ModC : op;
460 else if (op == op_DivMod && get_irn_op(get_DivMod_right(node)) == op_Const) {
461 /* special case, a division/modulo by a const, count on extra counter */
462 op = status->op_DivModC ? status->op_DivModC : op;
464 else if (op == op_Sel && get_irn_op(get_Sel_ptr(node)) == op_Sel) {
465 /* special case, a Sel of a Sel, count on extra counter */
466 op = status->op_SelSel ? status->op_SelSel : op;
468 if (get_irn_op(get_Sel_ptr(get_Sel_ptr(node))) == op_Sel) {
469 /* special case, a Sel of a Sel of a Sel, count on extra counter */
470 op = status->op_SelSelSel ? status->op_SelSelSel : op;
478 * update the block counter
480 static void undate_block_info(ir_node *node, graph_entry_t *graph)
482 ir_op *op = get_irn_op(node);
484 block_entry_t *b_entry;
487 /* check for block */
488 if (op == op_Block) {
489 arity = get_irn_arity(node);
490 b_entry = block_get_entry(&graph->recalc_cnts, get_irn_node_nr(node), graph->block_hash);
492 /* count all incoming edges */
493 for (i = 0; i < arity; ++i) {
494 ir_node *pred = get_irn_n(node, i);
495 ir_node *other_block = get_nodes_block(pred);
496 block_entry_t *b_entry_other = block_get_entry(&graph->recalc_cnts, get_irn_node_nr(other_block), graph->block_hash);
498 cnt_inc(&b_entry->cnt_in_edges); /* an edge coming from another block */
499 cnt_inc(&b_entry_other->cnt_out_edges);
504 block = get_nodes_block(node);
505 b_entry = block_get_entry(&graph->recalc_cnts, get_irn_node_nr(block), graph->block_hash);
507 if (op == op_Phi && mode_is_datab(get_irn_mode(node))) {
508 /* count data Phi per block */
509 cnt_inc(&b_entry->cnt_phi_data);
512 /* we have a new node in our block */
513 cnt_inc(&b_entry->cnt_nodes);
515 /* don't count keep-alive edges */
516 if (get_irn_op(node) == op_End)
519 arity = get_irn_arity(node);
521 for (i = 0; i < arity; ++i) {
522 ir_node *pred = get_irn_n(node, i);
523 ir_node *other_block;
525 other_block = get_nodes_block(pred);
527 if (other_block == block)
528 cnt_inc(&b_entry->cnt_edges); /* a in block edge */
530 block_entry_t *b_entry_other = block_get_entry(&graph->recalc_cnts, get_irn_node_nr(other_block), graph->block_hash);
532 cnt_inc(&b_entry->cnt_in_edges); /* an edge coming from another block */
533 cnt_inc(&b_entry_other->cnt_out_edges);
539 * update the extended block counter
541 static void undate_extbb_info(ir_node *node, graph_entry_t *graph)
543 ir_op *op = get_irn_op(node);
545 extbb_entry_t *eb_entry;
548 /* check for block */
549 if (op == op_Block) {
550 extbb = get_nodes_extbb(node);
551 arity = get_irn_arity(node);
552 eb_entry = block_get_entry(&graph->recalc_cnts, get_extbb_node_nr(extbb), graph->extbb_hash);
554 /* count all incoming edges */
555 for (i = 0; i < arity; ++i) {
556 ir_node *pred = get_irn_n(node, i);
557 ir_extblk *other_extbb = get_nodes_extbb(pred);
559 if (extbb != other_extbb) {
560 extbb_entry_t *eb_entry_other = block_get_entry(&graph->recalc_cnts, get_extbb_node_nr(other_extbb), graph->extbb_hash);
562 cnt_inc(&eb_entry->cnt_in_edges); /* an edge coming from another extbb */
563 cnt_inc(&eb_entry_other->cnt_out_edges);
569 extbb = get_nodes_extbb(node);
570 eb_entry = block_get_entry(&graph->recalc_cnts, get_extbb_node_nr(extbb), graph->extbb_hash);
572 if (op == op_Phi && mode_is_datab(get_irn_mode(node))) {
573 /* count data Phi per extbb */
574 cnt_inc(&eb_entry->cnt_phi_data);
577 /* we have a new node in our block */
578 cnt_inc(&eb_entry->cnt_nodes);
580 /* don't count keep-alive edges */
581 if (get_irn_op(node) == op_End)
584 arity = get_irn_arity(node);
586 for (i = 0; i < arity; ++i) {
587 ir_node *pred = get_irn_n(node, i);
588 ir_extblk *other_extbb = get_nodes_extbb(pred);
590 if (other_extbb == extbb)
591 cnt_inc(&eb_entry->cnt_edges); /* a in extbb edge */
593 extbb_entry_t *eb_entry_other = block_get_entry(&graph->recalc_cnts, get_extbb_node_nr(other_extbb), graph->extbb_hash);
595 cnt_inc(&eb_entry->cnt_in_edges); /* an edge coming from another extbb */
596 cnt_inc(&eb_entry_other->cnt_out_edges);
601 /** calculates how many arguments of the call are const */
602 static int cnt_const_args(ir_node *call)
605 int n = get_Call_n_params(call);
607 for (i = 0; i < n; ++i) {
608 ir_node *param = get_Call_param(call, i);
609 ir_op *op = get_irn_op(param);
611 if (op == op_Const || op == op_SymConst)
618 * update info on calls
620 * @param call The call
621 * @param graph The graph entry containing the call
623 static void stat_update_call(ir_node *call, graph_entry_t *graph)
625 ir_node *block = get_nodes_block(call);
626 ir_node *ptr = get_Call_ptr(call);
628 ir_graph *callee = NULL;
632 * If the block is bad, the whole subgraph will collapse later
633 * so do not count this call.
634 * This happens in dead code.
639 cnt_inc(&graph->cnt_all_calls);
641 /* found a call, this function is not a leaf */
644 if (get_irn_op(ptr) == op_SymConst) {
645 if (get_SymConst_kind(ptr) == symconst_addr_ent) {
646 /* ok, we seems to know the entity */
647 ent = get_SymConst_entity(ptr);
648 callee = get_entity_irg(ent);
650 /* it is recursive, if it calls at least once */
651 if (callee == graph->irg)
652 graph->is_recursive = 1;
656 /* indirect call, be could not predict */
657 cnt_inc(&graph->cnt_indirect_calls);
659 /* NOT a leaf call */
660 graph->is_leaf_call = LCS_NON_LEAF_CALL;
663 /* check, if it's a chain-call: Then, the call-block
664 * must dominate the end block. */
666 ir_node *curr = get_irg_end_block(graph->irg);
667 int depth = get_Block_dom_depth(block);
669 for (; curr != block && get_Block_dom_depth(curr) > depth;) {
670 curr = get_Block_idom(curr);
672 if (! curr || is_no_Block(curr))
677 graph->is_chain_call = 0;
680 /* check, if the callee is a leaf */
682 graph_entry_t *called = graph_get_entry(callee, status->irg_hash);
684 if (called->is_analyzed) {
685 if (! called->is_leaf)
686 graph->is_leaf_call = LCS_NON_LEAF_CALL;
690 /* check, if arguments of the call are const */
691 num_const_args = cnt_const_args(call);
693 if (num_const_args > 0)
694 cnt_inc(&graph->cnt_call_with_cnst_arg);
698 * update info on calls for graphs on the wait queue
700 static void stat_update_call_2(ir_node *call, graph_entry_t *graph)
702 ir_node *block = get_nodes_block(call);
703 ir_node *ptr = get_Call_ptr(call);
705 ir_graph *callee = NULL;
708 * If the block is bad, the whole subgraph will collapse later
709 * so do not count this call.
710 * This happens in dead code.
715 if (get_irn_op(ptr) == op_SymConst) {
716 if (get_SymConst_kind(ptr) == symconst_addr_ent) {
717 /* ok, we seems to know the entity */
718 ent = get_SymConst_entity(ptr);
719 callee = get_entity_irg(ent);
723 /* check, if the callee is a leaf */
725 graph_entry_t *called = graph_get_entry(callee, status->irg_hash);
727 assert(called->is_analyzed);
729 if (! called->is_leaf)
730 graph->is_leaf_call = LCS_NON_LEAF_CALL;
733 graph->is_leaf_call = LCS_NON_LEAF_CALL;
737 * walker for reachable nodes count
739 static void update_node_stat(ir_node *node, void *env)
741 graph_entry_t *graph = env;
744 ir_op *op = stat_get_irn_op(node);
745 int arity = get_irn_arity(node);
747 entry = opcode_get_entry(op, graph->opcode_hash);
749 cnt_inc(&entry->cnt_alive);
750 cnt_add_i(&graph->cnt_edges, arity);
752 /* count block edges */
753 undate_block_info(node, graph);
755 /* count extended block edges */
756 if (status->stat_options & FIRMSTAT_COUNT_EXTBB) {
757 undate_extbb_info(node, graph);
760 /* handle statistics for special node types */
762 if (op == op_Const) {
763 if (status->stat_options & FIRMSTAT_COUNT_CONSTS) {
764 /* check properties of constants */
765 stat_update_const(status, node, graph);
768 else if (op == op_Call) {
769 /* check for properties that depends on calls like recursion/leaf/indirect call */
770 stat_update_call(node, graph);
775 * walker for reachable nodes count for graphs on the wait_q
777 static void update_node_stat_2(ir_node *node, void *env)
779 graph_entry_t *graph = env;
781 /* check for properties that depends on calls like recursion/leaf/indirect call */
783 stat_update_call_2(node, graph);
787 * get the current address mark
789 static unsigned get_adr_mark(graph_entry_t *graph, ir_node *node)
791 address_mark_entry_t *value = set_find(graph->address_mark, &node, sizeof(*value), HASH_PTR(node));
793 return value ? value->mark : 0;
797 * set the current address mark
799 static void set_adr_mark(graph_entry_t *graph, ir_node *node, unsigned val)
801 address_mark_entry_t *value = set_insert(graph->address_mark, &node, sizeof(*value), HASH_PTR(node));
807 * a vcg attribute hook: Color a node with a different color if
808 * it's identified as a part of an address expression or at least referenced
809 * by an address expression.
811 static int stat_adr_mark_hook(FILE *F, ir_node *node, ir_node *local)
813 ir_node *n = local ? local : node;
814 ir_graph *irg = get_irn_irg(n);
815 graph_entry_t *graph = graph_get_entry(irg, status->irg_hash);
816 unsigned mark = get_adr_mark(graph, n);
818 if (mark & MARK_ADDRESS_CALC)
819 fprintf(F, "color: purple");
820 else if ((mark & (MARK_REF_ADR | MARK_REF_NON_ADR)) == MARK_REF_ADR)
821 fprintf(F, "color: pink");
822 else if ((mark & (MARK_REF_ADR | MARK_REF_NON_ADR)) == (MARK_REF_ADR|MARK_REF_NON_ADR))
823 fprintf(F, "color: lightblue");
827 /* I know the color! */
832 * walker that marks every node that is an address calculation
834 * predecessor nodes must be visited first. We ensure this by
835 * calling in in the post of an outs walk. This should work even in cycles,
836 * while the pre in a normal walk will not.
838 static void mark_address_calc(ir_node *node, void *env)
840 graph_entry_t *graph = env;
841 ir_mode *mode = get_irn_mode(node);
843 unsigned mark_preds = MARK_REF_NON_ADR;
845 if (! mode_is_numP(mode))
848 if (mode_is_reference(mode)) {
849 /* a reference is calculated here, we are sure */
850 set_adr_mark(graph, node, MARK_ADDRESS_CALC);
852 mark_preds = MARK_REF_ADR;
855 unsigned mark = get_adr_mark(graph, node);
857 if ((mark & (MARK_REF_ADR | MARK_REF_NON_ADR)) == MARK_REF_ADR) {
859 * this node has not an reference mode, but is only
860 * referenced by address calculations
862 mark_preds = MARK_REF_ADR;
866 /* mark all predecessors */
867 for (i = 0, n = get_irn_arity(node); i < n; ++i) {
868 ir_node *pred = get_irn_n(node, i);
870 set_adr_mark(graph, pred, get_adr_mark(graph, pred) | mark_preds);
875 * Called for every graph when the graph is either deleted or stat_dump_snapshot()
876 * is called, must recalculate all statistic info.
878 * @param global The global entry
879 * @param graph The current entry
881 static void update_graph_stat(graph_entry_t *global, graph_entry_t *graph)
885 /* clear first the alive counter in the graph */
886 for (entry = pset_first(graph->opcode_hash); entry; entry = pset_next(graph->opcode_hash)) {
887 cnt_clr(&entry->cnt_alive);
890 /* set pessimistic values */
892 graph->is_leaf_call = LCS_UNKNOWN;
893 graph->is_recursive = 0;
894 graph->is_chain_call = 1;
896 /* create new block counter */
897 graph->block_hash = new_pset(block_cmp, 5);
899 /* we need dominator info */
900 if (graph->irg != get_const_code_irg())
901 if (get_irg_dom_state(graph->irg) != dom_consistent)
902 compute_doms(graph->irg);
904 if (status->stat_options & FIRMSTAT_COUNT_EXTBB) {
905 /* we need extended basic blocks */
906 compute_extbb(graph->irg);
908 /* create new extbb counter */
909 graph->extbb_hash = new_pset(block_cmp, 5);
912 /* count the nodes in the graph */
913 irg_walk_graph(graph->irg, update_node_stat, NULL, graph);
916 /* Uncomment this code if chain-call means call exact one */
917 entry = opcode_get_entry(op_Call, graph->opcode_hash);
919 /* check if we have more than 1 call */
920 if (cnt_gt(entry->cnt_alive, 1))
921 graph->is_chain_call = 0;
924 /* recursive functions are never chain calls, leafs don't have calls */
925 if (graph->is_recursive || graph->is_leaf)
926 graph->is_chain_call = 0;
928 /* assume we walk every graph only ONCE, we could sum here the global count */
929 for (entry = pset_first(graph->opcode_hash); entry; entry = pset_next(graph->opcode_hash)) {
930 node_entry_t *g_entry = opcode_get_entry(entry->op, global->opcode_hash);
932 /* update the node counter */
933 cnt_add(&g_entry->cnt_alive, &entry->cnt_alive);
936 /* update the edge counter */
937 cnt_add(&global->cnt_edges, &graph->cnt_edges);
939 /* count the number of address calculation */
940 if (graph->irg != get_const_code_irg()) {
941 ir_graph *rem = current_ir_graph;
943 if (get_irg_outs_state(graph->irg) != outs_consistent)
944 compute_irg_outs(graph->irg);
946 /* Must be done an the outs graph */
947 current_ir_graph = graph->irg;
948 irg_out_walk(get_irg_start(graph->irg), NULL, mark_address_calc, graph);
949 current_ir_graph = rem;
952 set_dump_node_vcgattr_hook(stat_adr_mark_hook);
953 dump_ir_block_graph(graph->irg, "-adr");
954 set_dump_node_vcgattr_hook(NULL);
958 /* count the DAG's */
959 if (status->stat_options & FIRMSTAT_COUNT_DAG)
960 count_dags_in_graph(global, graph);
962 /* calculate the patterns of this graph */
963 stat_calc_pattern_history(graph->irg);
965 /* leaf function did not call others */
967 graph->is_leaf_call = LCS_NON_LEAF_CALL;
968 else if (graph->is_leaf_call == LCS_UNKNOWN) {
969 /* we still don't know if this graph calls leaf-functions, so enqueue */
970 pdeq_putl(status->wait_q, graph);
973 /* we have analyzed this graph */
974 graph->is_analyzed = 1;
978 * Called for every graph that was on the wait_q in stat_dump_snapshot()
979 * must finish all statistic info calculations.
981 * @param global The global entry
982 * @param graph The current entry
984 static void update_graph_stat_2(graph_entry_t *global, graph_entry_t *graph)
986 if (graph->is_deleted) {
987 /* deleted, ignore */
992 /* count the nodes in the graph */
993 irg_walk_graph(graph->irg, update_node_stat_2, NULL, graph);
995 if (graph->is_leaf_call == LCS_UNKNOWN)
996 graph->is_leaf_call = LCS_LEAF_CALL;
1003 static void stat_register_dumper(const dumper_t *dumper)
1005 dumper_t *p = xmalloc(sizeof(*p));
1010 p->next = status->dumper;
1015 /* FIXME: memory leak */
1019 * dumps an IR graph.
1021 static void stat_dump_graph(graph_entry_t *entry)
1025 for (dumper = status->dumper; dumper; dumper = dumper->next) {
1026 if (dumper->dump_graph)
1027 dumper->dump_graph(dumper, entry);
1032 * dumps a constant table
1034 static void stat_dump_consts(const constant_info_t *tbl)
1038 for (dumper = status->dumper; dumper; dumper = dumper->next) {
1039 if (dumper->dump_const_tbl)
1040 dumper->dump_const_tbl(dumper, tbl);
1045 * initialize the dumper
1047 static void stat_dump_init(const char *name)
1051 for (dumper = status->dumper; dumper; dumper = dumper->next) {
1053 dumper->init(dumper, name);
1060 static void stat_dump_finish(void)
1064 for (dumper = status->dumper; dumper; dumper = dumper->next) {
1066 dumper->finish(dumper);
1070 /* ---------------------------------------------------------------------- */
1073 * helper: get an ir_op from an opcode
1075 ir_op *stat_get_op_from_opcode(opcode code)
1077 return opcode_find_entry(code, status->ir_op_hash);
1081 * A new IR op is registered.
1083 * @param ctx the hook context
1084 * @param op the new IR opcode that was created.
1086 static void stat_new_ir_op(void *ctx, ir_op *op)
1088 if (! status->stat_options)
1093 graph_entry_t *graph = graph_get_entry(NULL, status->irg_hash);
1095 /* execute for side effect :-) */
1096 opcode_get_entry(op, graph->opcode_hash);
1098 pset_insert(status->ir_op_hash, op, op->code);
1104 * An IR op is freed.
1106 * @param ctx the hook context
1107 * @param op the IR opcode that is freed
1109 static void stat_free_ir_op(void *ctx, ir_op *op)
1111 if (! status->stat_options)
1121 * A new node is created.
1123 * @param ctx the hook context
1124 * @param irg the IR graph on which the node is created
1125 * @param node the new IR node that was created
1127 static void stat_new_node(void *ctx, ir_graph *irg, ir_node *node)
1129 if (! status->stat_options)
1132 /* do NOT count during dead node elimination */
1133 if (status->in_dead_node_elim > 0)
1138 node_entry_t *entry;
1139 graph_entry_t *graph;
1140 ir_op *op = stat_get_irn_op(node);
1142 /* increase global value */
1143 graph = graph_get_entry(NULL, status->irg_hash);
1144 entry = opcode_get_entry(op, graph->opcode_hash);
1145 cnt_inc(&entry->new_node);
1147 /* increase local value */
1148 graph = graph_get_entry(current_ir_graph, status->irg_hash);
1149 entry = opcode_get_entry(op, graph->opcode_hash);
1150 cnt_inc(&entry->new_node);
1156 * A node is changed into a Id node
1158 * @param ctx the hook context
1159 * @param node the IR node that will be turned into an ID
1161 static void stat_turn_into_id(void *ctx, ir_node *node)
1163 if (! status->stat_options)
1168 node_entry_t *entry;
1169 graph_entry_t *graph;
1170 ir_op *op = stat_get_irn_op(node);
1172 /* increase global value */
1173 graph = graph_get_entry(NULL, status->irg_hash);
1174 entry = opcode_get_entry(op, graph->opcode_hash);
1175 cnt_inc(&entry->into_Id);
1177 /* increase local value */
1178 graph = graph_get_entry(current_ir_graph, status->irg_hash);
1179 entry = opcode_get_entry(op, graph->opcode_hash);
1180 cnt_inc(&entry->into_Id);
1186 * A new graph was created
1188 * @param ctx the hook context
1189 * @param irg the new IR graph that was created
1190 * @param ent the entity of this graph
1192 static void stat_new_graph(void *ctx, ir_graph *irg, entity *ent)
1194 if (! status->stat_options)
1199 /* execute for side effect :-) */
1200 graph_entry_t * graph = graph_get_entry(irg, status->irg_hash);
1203 graph->is_deleted = 0;
1205 graph->is_leaf_call = 0;
1206 graph->is_recursive = 0;
1207 graph->is_chain_call = 0;
1208 graph->is_analyzed = 0;
1214 * A graph will be deleted
1216 * @param ctx the hook context
1217 * @param irg the IR graph that will be deleted
1219 * Note that we still hold the information for this graph
1220 * in our hash maps, only a flag is set which prevents this
1221 * information from being changed, it's "frozen" from now.
1223 static void stat_free_graph(void *ctx, ir_graph *irg)
1225 if (! status->stat_options)
1230 graph_entry_t *graph = graph_get_entry(irg, status->irg_hash);
1231 graph_entry_t *global = graph_get_entry(NULL, status->irg_hash);
1233 graph->is_deleted = 1;
1235 if (status->stat_options & FIRMSTAT_COUNT_DELETED) {
1236 /* count the nodes of the graph yet, it will be destroyed later */
1237 update_graph_stat(global, graph);
1244 * A walk over a graph is initiated. Do not count walks from statistic code.
1246 * @param ctx the hook context
1247 * @param irg the IR graph that will be walked
1248 * @param pre the pre walker
1249 * @param post the post walker
1251 static void stat_irg_walk(void *ctx, ir_graph *irg, generic_func *pre, generic_func *post)
1253 if (! status->stat_options)
1258 graph_entry_t *graph = graph_get_entry(irg, status->irg_hash);
1260 cnt_inc(&graph->cnt_walked);
1266 * A walk over a graph in block-wise order is initiated. Do not count walks from statistic code.
1268 * @param ctx the hook context
1269 * @param irg the IR graph that will be walked
1270 * @param pre the pre walker
1271 * @param post the post walker
1273 static void stat_irg_walk_blkwise(void *ctx, ir_graph *irg, generic_func *pre, generic_func *post)
1275 /* for now, do NOT differentiate between blockwise and normal */
1276 stat_irg_walk(ctx, irg, pre, post);
1280 * A walk over the graph's blocks is initiated. Do not count walks from statistic code.
1282 * @param ctx the hook context
1283 * @param irg the IR graph that will be walked
1284 * @param node the IR node
1285 * @param pre the pre walker
1286 * @param post the post walker
1288 static void stat_irg_block_walk(void *ctx, ir_graph *irg, ir_node *node, generic_func *pre, generic_func *post)
1290 if (! status->stat_options)
1295 graph_entry_t *graph = graph_get_entry(irg, status->irg_hash);
1297 cnt_inc(&graph->cnt_walked_blocks);
1303 * called for every node that is removed due to an optimization.
1305 * @param n the IR node that will be removed
1306 * @param hmap the hash map containing ir_op* -> opt_entry_t*
1308 static void removed_due_opt(ir_node *n, hmap_opt_entry_t *hmap)
1310 ir_op *op = stat_get_irn_op(n);
1311 opt_entry_t *entry = opt_get_entry(op, hmap);
1313 /* increase global value */
1314 cnt_inc(&entry->count);
1318 * Some nodes were optimized into some others due to an optimization.
1320 * @param ctx the hook context
1322 static void stat_merge_nodes(
1324 ir_node **new_node_array, int new_num_entries,
1325 ir_node **old_node_array, int old_num_entries,
1328 if (! status->stat_options)
1334 graph_entry_t *graph = graph_get_entry(current_ir_graph, status->irg_hash);
1336 if (status->reassoc_run)
1337 opt = HOOK_OPT_REASSOC;
1339 for (i = 0; i < old_num_entries; ++i) {
1340 for (j = 0; j < new_num_entries; ++j)
1341 if (old_node_array[i] == new_node_array[j])
1344 /* nodes might be in new and old, these are NOT removed */
1345 if (j >= new_num_entries) {
1348 /* sometimes we did not detect, that it is replaced by a Const */
1349 if (opt == HOOK_OPT_CONFIRM && new_num_entries == 1) {
1350 ir_op *op = get_irn_op(new_node_array[0]);
1352 if (op == op_Const || op == op_SymConst)
1353 xopt = HOOK_OPT_CONFIRM_C;
1356 removed_due_opt(old_node_array[i], graph->opt_hash[xopt]);
1364 * Reassociation is started/stopped.
1366 * @param ctx the hook context
1367 * @param flag if non-zero, reassociation is started else stopped
1369 static void stat_reassociate(void *ctx, int flag)
1371 if (! status->stat_options)
1376 status->reassoc_run = flag;
1382 * A node was lowered into other nodes
1384 * @param ctx the hook context
1385 * @param node the IR node that will be lowered
1387 static void stat_lower(void *ctx, ir_node *node)
1389 if (! status->stat_options)
1394 graph_entry_t *graph = graph_get_entry(current_ir_graph, status->irg_hash);
1396 removed_due_opt(node, graph->opt_hash[HOOK_LOWERED]);
1402 * A graph was inlined.
1404 * @param ctx the hook context
1405 * @param call the IR call that will re changed into the body of
1406 * the called IR graph
1407 * @param called_irg the IR graph representing the called routine
1409 static void stat_inline(void *ctx, ir_node *call, ir_graph *called_irg)
1411 if (! status->stat_options)
1416 ir_graph *irg = get_irn_irg(call);
1417 graph_entry_t *i_graph = graph_get_entry(called_irg, status->irg_hash);
1418 graph_entry_t *graph = graph_get_entry(irg, status->irg_hash);
1420 cnt_inc(&graph->cnt_got_inlined);
1421 cnt_inc(&i_graph->cnt_was_inlined);
1427 * A graph with tail-recursions was optimized.
1429 * @param ctx the hook context
1431 static void stat_tail_rec(void *ctx, ir_graph *irg, int n_calls)
1433 if (! status->stat_options)
1438 graph_entry_t *graph = graph_get_entry(irg, status->irg_hash);
1440 graph->num_tail_recursion += n_calls;
1446 * Strength reduction was performed on an iteration variable.
1448 * @param ctx the hook context
1450 static void stat_strength_red(void *ctx, ir_graph *irg, ir_node *strong, ir_node *cmp)
1452 if (! status->stat_options)
1457 graph_entry_t *graph = graph_get_entry(irg, status->irg_hash);
1458 cnt_inc(&graph->cnt_strength_red);
1460 removed_due_opt(strong, graph->opt_hash[HOOK_OPT_STRENGTH_RED]);
1466 * Start/Stop the dead node elimination.
1468 * @param ctx the hook context
1470 static void stat_dead_node_elim(void *ctx, ir_graph *irg, int start)
1472 if (! status->stat_options)
1476 ++status->in_dead_node_elim;
1478 --status->in_dead_node_elim;
1482 * if-conversion was tried
1484 static void stat_if_conversion(void *context, ir_graph *irg, ir_node *phi,
1485 int pos, ir_node *mux, if_result_t reason)
1487 if (! status->stat_options)
1492 graph_entry_t *graph = graph_get_entry(irg, status->irg_hash);
1494 cnt_inc(&graph->cnt_if_conv[reason]);
1500 * real function call was optimized
1502 static void stat_func_call(void *context, ir_graph *irg, ir_node *call)
1504 if (! status->stat_options)
1509 graph_entry_t *graph = graph_get_entry(irg, status->irg_hash);
1511 cnt_inc(&graph->cnt_real_func_call);
1517 * A multiply was replaced by a series of Shifts/Adds/Subs
1519 * @param ctx the hook context
1521 static void stat_arch_dep_replace_mul_with_shifts(void *ctx, ir_node *mul)
1523 if (! status->stat_options)
1528 graph_entry_t *graph = graph_get_entry(current_ir_graph, status->irg_hash);
1529 removed_due_opt(mul, graph->opt_hash[HOOK_OPT_ARCH_DEP]);
1535 * A division by const was replaced
1537 * @param ctx the hook context
1538 * @param node the division node that will be optimized
1540 static void stat_arch_dep_replace_division_by_const(void *ctx, ir_node *node)
1542 if (! status->stat_options)
1547 graph_entry_t *graph = graph_get_entry(current_ir_graph, status->irg_hash);
1548 removed_due_opt(node, graph->opt_hash[HOOK_OPT_ARCH_DEP]);
1554 * Update the register pressure of a block
1556 * @param ctx the hook context
1557 * @param block the block for which the reg pressure should be set
1558 * @param irg the irg containing the block
1559 * @param pressure the pressure
1560 * @param class_name the ident name of the register class
1562 static void stat_be_block_regpressure(void *ctx, ir_node *block, ir_graph *irg, int pressure, ident *class_name)
1564 if (! status->stat_options)
1569 graph_entry_t *graph = graph_get_entry(irg, status->irg_hash);
1570 be_block_entry_t *block_ent;
1571 reg_pressure_entry_t *rp_ent;
1573 /* create new be_block hash */
1574 if (! graph->be_block_hash)
1575 graph->be_block_hash = new_pset(be_block_cmp, 5);
1577 block_ent = be_block_get_entry(&status->be_data, get_irn_node_nr(block), graph->be_block_hash);
1578 rp_ent = obstack_alloc(&status->be_data, sizeof(*rp_ent));
1579 memset(rp_ent, 0, sizeof(*rp_ent));
1581 rp_ent->id_name = class_name;
1582 rp_ent->pressure = pressure;
1584 pset_insert(block_ent->reg_pressure, rp_ent, HASH_PTR(class_name));
1590 * Update the distribution of ready nodes of a block
1592 * @param ctx the hook context
1593 * @param block the block for which the reg pressure should be set
1594 * @param irg the irg containing the block
1595 * @param num_ready the number of ready nodes
1597 static void stat_be_block_sched_ready(void *ctx, ir_node *block, ir_graph *irg, int num_ready)
1599 if (! status->stat_options)
1604 graph_entry_t *graph = graph_get_entry(irg, status->irg_hash);
1605 be_block_entry_t *block_ent;
1608 /* create new be_block hash */
1609 if (! graph->be_block_hash)
1610 graph->be_block_hash = new_pset(be_block_cmp, 5);
1612 block_ent = be_block_get_entry(&status->be_data, get_irn_node_nr(block), graph->be_block_hash);
1614 /* add 1 to the counter of orresponding number of ready nodes */
1617 stat_add_int_distrib_tbl(block_ent->sched_ready, num_ready, &cnt_1);
1623 /* Dumps a statistics snapshot */
1624 void stat_dump_snapshot(const char *name, const char *phase)
1630 if (! status->stat_options)
1635 graph_entry_t *entry;
1636 graph_entry_t *global = graph_get_entry(NULL, status->irg_hash);
1639 * The constant counter is only global, so we clear it here.
1640 * Note that it does NOT contain the constants in DELETED
1641 * graphs due to this.
1643 if (status->stat_options & FIRMSTAT_COUNT_CONSTS)
1644 stat_const_clear(status);
1646 /* build the name */
1647 p = strrchr(name, '/');
1652 q = strrchr(name, '\\');
1654 /* NULL might be not the smallest pointer */
1655 if (q && (!p || q > p))
1663 if (l > sizeof(fname) - 1)
1664 l = sizeof(fname) - 1;
1666 memcpy(fname, name, l);
1673 strncat(fname, "firmstat-", sizeof(fname));
1674 strncat(fname, phase, sizeof(fname));
1675 strncat(fname, "-", sizeof(fname));
1676 strncat(fname, p, sizeof(fname));
1678 stat_dump_init(fname);
1680 /* calculate the graph statistics */
1681 for (entry = pset_first(status->irg_hash); entry; entry = pset_next(status->irg_hash)) {
1683 if (entry->irg == NULL) {
1684 /* special entry for the global count */
1688 if (! entry->is_deleted) {
1689 /* the graph is still alive, count the nodes on it */
1690 update_graph_stat(global, entry);
1694 /* some calculations are dependent, we pushed them on the wait_q */
1695 while (! pdeq_empty(status->wait_q)) {
1696 entry = pdeq_getr(status->wait_q);
1698 update_graph_stat_2(global, entry);
1702 /* dump per graph */
1703 for (entry = pset_first(status->irg_hash); entry; entry = pset_next(status->irg_hash)) {
1705 if (entry->irg == NULL) {
1706 /* special entry for the global count */
1710 if (! entry->is_deleted || status->stat_options & FIRMSTAT_COUNT_DELETED) {
1711 stat_dump_graph(entry);
1714 if (! entry->is_deleted) {
1715 /* clear the counter that are not accumulated */
1716 graph_clear_entry(entry, 0);
1721 stat_dump_graph(global);
1723 /* dump the const info */
1724 if (status->stat_options & FIRMSTAT_COUNT_CONSTS)
1725 stat_dump_consts(&status->const_info);
1729 stat_finish_pattern_history();
1731 /* clear the global counter here */
1733 node_entry_t *entry;
1735 for (entry = pset_first(global->opcode_hash); entry; entry = pset_next(global->opcode_hash)) {
1736 opcode_clear_entry(entry);
1738 /* clear all global counter */
1739 graph_clear_entry(global, 1);
1745 /** the hook entries for the Firm statistics module */
1746 static hook_entry_t stat_hooks[hook_last];
1748 /* initialize the statistics module. */
1749 void firm_init_stat(unsigned enable_options)
1751 #define X(a) a, sizeof(a)-1
1752 #define HOOK(h, fkt) \
1753 stat_hooks[h].hook._##h = fkt; register_hook(h, &stat_hooks[h])
1756 if (! (enable_options & FIRMSTAT_ENABLED))
1759 status = xmalloc(sizeof(*status));
1760 memset(status, 0, sizeof(*status));
1762 /* enable statistics */
1763 status->stat_options = enable_options & FIRMSTAT_ENABLED ? enable_options : 0;
1765 /* register all hooks */
1766 HOOK(hook_new_ir_op, stat_new_ir_op);
1767 HOOK(hook_free_ir_op, stat_free_ir_op);
1768 HOOK(hook_new_node, stat_new_node);
1769 HOOK(hook_turn_into_id, stat_turn_into_id);
1770 HOOK(hook_new_graph, stat_new_graph);
1771 HOOK(hook_free_graph, stat_free_graph);
1772 HOOK(hook_irg_walk, stat_irg_walk);
1773 HOOK(hook_irg_walk_blkwise, stat_irg_walk_blkwise);
1774 HOOK(hook_irg_block_walk, stat_irg_block_walk);
1775 HOOK(hook_merge_nodes, stat_merge_nodes);
1776 HOOK(hook_reassociate, stat_reassociate);
1777 HOOK(hook_lower, stat_lower);
1778 HOOK(hook_inline, stat_inline);
1779 HOOK(hook_tail_rec, stat_tail_rec);
1780 HOOK(hook_strength_red, stat_strength_red);
1781 HOOK(hook_dead_node_elim, stat_dead_node_elim);
1782 HOOK(hook_if_conversion, stat_if_conversion);
1783 HOOK(hook_func_call, stat_func_call);
1784 HOOK(hook_arch_dep_replace_mul_with_shifts, stat_arch_dep_replace_mul_with_shifts);
1785 HOOK(hook_arch_dep_replace_division_by_const, stat_arch_dep_replace_division_by_const);
1786 HOOK(hook_be_block_regpressure, stat_be_block_regpressure);
1787 HOOK(hook_be_block_sched_ready, stat_be_block_sched_ready);
1789 obstack_init(&status->cnts);
1790 obstack_init(&status->be_data);
1792 /* create the hash-tables */
1793 status->irg_hash = new_pset(graph_cmp, 8);
1794 status->ir_op_hash = new_pset(opcode_cmp_2, 1);
1796 /* create the wait queue */
1797 status->wait_q = new_pdeq();
1799 if (enable_options & FIRMSTAT_COUNT_STRONG_OP) {
1800 /* build the pseudo-ops */
1802 _op_Phi0.code = --num;
1803 _op_Phi0.name = new_id_from_chars(X("Phi0"));
1805 _op_PhiM.code = --num;
1806 _op_PhiM.name = new_id_from_chars(X("PhiM"));
1808 _op_ProjM.code = --num;
1809 _op_ProjM.name = new_id_from_chars(X("ProjM"));
1811 _op_MulC.code = --num;
1812 _op_MulC.name = new_id_from_chars(X("MulC"));
1814 _op_DivC.code = --num;
1815 _op_DivC.name = new_id_from_chars(X("DivC"));
1817 _op_ModC.code = --num;
1818 _op_ModC.name = new_id_from_chars(X("ModC"));
1820 _op_DivModC.code = --num;
1821 _op_DivModC.name = new_id_from_chars(X("DivModC"));
1823 status->op_Phi0 = &_op_Phi0;
1824 status->op_PhiM = &_op_PhiM;
1825 status->op_ProjM = &_op_ProjM;
1826 status->op_MulC = &_op_MulC;
1827 status->op_DivC = &_op_DivC;
1828 status->op_ModC = &_op_ModC;
1829 status->op_DivModC = &_op_DivModC;
1832 status->op_Phi0 = NULL;
1833 status->op_PhiM = NULL;
1834 status->op_ProjM = NULL;
1835 status->op_MulC = NULL;
1836 status->op_DivC = NULL;
1837 status->op_ModC = NULL;
1838 status->op_DivModC = NULL;
1841 if (enable_options & FIRMSTAT_COUNT_SELS) {
1842 _op_SelSel.code = --num;
1843 _op_SelSel.name = new_id_from_chars(X("Sel(Sel)"));
1845 _op_SelSelSel.code = --num;
1846 _op_SelSelSel.name = new_id_from_chars(X("Sel(Sel(Sel))"));
1848 status->op_SelSel = &_op_SelSel;
1849 status->op_SelSelSel = &_op_SelSelSel;
1852 status->op_SelSel = NULL;
1853 status->op_SelSelSel = NULL;
1856 /* register the dumper */
1857 stat_register_dumper(&simple_dumper);
1859 if (enable_options & FIRMSTAT_CSV_OUTPUT)
1860 stat_register_dumper(&csv_dumper);
1862 /* initialize the pattern hash */
1863 stat_init_pattern_history(enable_options & FIRMSTAT_PATTERN_ENABLED);
1865 /* initialize the Const options */
1866 if (enable_options & FIRMSTAT_COUNT_CONSTS)
1867 stat_init_const_cnt(status);
1873 /* terminates the statistics module, frees all memory */
1874 void stat_term(void) {
1875 if (status != (stat_info_t *)&status_disable) {
1876 obstack_free(&status->be_data, NULL);
1877 obstack_free(&status->cnts, NULL);
1879 status = (stat_info_t *)&status_disable;
1885 /* initialize the statistics module. */
1886 void firm_init_stat(unsigned enable_options) {}
1888 /* Dumps a statistics snapshot */
1889 void stat_dump_snapshot(const char *name, const char *phase) {}
1891 /* terminates the statistics module, frees all memory */
1892 void stat_term(void);
1894 #endif /* FIRM_STATISTICS */