From: Michael Beck Date: Sun, 24 Aug 2008 12:48:08 +0000 (+0000) Subject: better count constants as operands of instructions X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=118d34f5f69dbe11aabfc9827bffc4c3053edd93;p=libfirm better count constants as operands of instructions [r21407] --- diff --git a/ir/stat/firmstat.c b/ir/stat/firmstat.c index f665ee943..e1d6fa1e0 100644 --- a/ir/stat/firmstat.c +++ b/ir/stat/firmstat.c @@ -989,12 +989,6 @@ static void update_node_stat(ir_node *node, void *env) /* handle statistics for special node types */ switch (op->code) { - case iro_Const: - if (status->stat_options & FIRMSTAT_COUNT_CONSTS) { - /* check properties of constants */ - stat_update_const(status, node, graph); - } /* if */ - break; case iro_Call: /* check for properties that depends on calls like recursion/leaf/indirect call */ stat_update_call(node, graph); @@ -1010,6 +1004,20 @@ static void update_node_stat(ir_node *node, void *env) default: ; } /* switch */ + + /* we want to count the constant IN nodes, not the CSE'ed constant's itself */ + if (status->stat_options & FIRMSTAT_COUNT_CONSTS) { + int i; + + for (i = get_irn_arity(node) - 1; i >= 0; --i) { + ir_node *pred = get_irn_n(node, i); + + if (is_Const(pred)) { + /* check properties of constants */ + stat_update_const(status, pred, graph); + } /* if */ + } /* for */ + } /* if */ } /* update_node_stat */ /**