From af9d5340df83e18c0480b996de482d5ae930c7d7 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Fri, 10 Oct 2008 12:42:09 +0000 Subject: [PATCH] - detect non-strict functions [r22645] --- ir/stat/firmstat.c | 14 +++++++++++++- ir/stat/firmstat_t.h | 1 + ir/stat/stat_dmp.c | 2 ++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ir/stat/firmstat.c b/ir/stat/firmstat.c index 103e9d6ac..1e7dd4bdd 100644 --- a/ir/stat/firmstat.c +++ b/ir/stat/firmstat.c @@ -970,7 +970,7 @@ static void update_node_stat(ir_node *node, void *env) node_entry_t *entry; ir_op *op = stat_get_irn_op(node); - int arity = get_irn_arity(node); + int i, arity = get_irn_arity(node); entry = opcode_get_entry(op, graph->opcode_hash); @@ -1001,6 +1001,16 @@ static void update_node_stat(ir_node *node, void *env) /* check address properties */ stat_update_address(get_Store_ptr(node), graph); break; + case iro_Phi: + /* check for non-strict Phi nodes */ + for (i = arity - 1; i >= 0; --i) { + ir_node *pred = get_Phi_pred(node, i); + if (is_Unknown(pred)) { + /* found an Unknown predecessor, graph is not strict */ + graph->is_strict = 0; + break; + } + } default: ; } /* switch */ @@ -1186,6 +1196,7 @@ static void update_graph_stat(graph_entry_t *global, graph_entry_t *graph) graph->is_leaf_call = LCS_UNKNOWN; graph->is_recursive = 0; graph->is_chain_call = 1; + graph->is_strict = 1; /* create new block counter */ graph->block_hash = new_pset(block_cmp, 5); @@ -1550,6 +1561,7 @@ static void stat_new_graph(void *ctx, ir_graph *irg, ir_entity *ent) { graph->is_leaf_call = 0; graph->is_recursive = 0; graph->is_chain_call = 0; + graph->is_strict = 1; graph->is_analyzed = 0; } STAT_LEAVE; diff --git a/ir/stat/firmstat_t.h b/ir/stat/firmstat_t.h index 5757f9ca7..a344186b0 100644 --- a/ir/stat/firmstat_t.h +++ b/ir/stat/firmstat_t.h @@ -167,6 +167,7 @@ typedef struct _graph_entry_t { unsigned is_leaf_call:2; /**< set, if this irg calls only leaf functions */ unsigned is_recursive:1; /**< set, if this irg has recursive calls */ unsigned is_chain_call:1; /**< set, if this irg is a chain call */ + unsigned is_strict:1; /**< set, if this irg represents a strict program */ unsigned is_analyzed:1; /**< helper: set, if this irg was already analysed */ } graph_entry_t; diff --git a/ir/stat/stat_dmp.c b/ir/stat/stat_dmp.c index e8ab3271c..394012218 100644 --- a/ir/stat/stat_dmp.c +++ b/ir/stat/stat_dmp.c @@ -485,6 +485,7 @@ static void simple_dump_graph(dumper_t *dmp, graph_entry_t *entry) " calls only leaf functions : %s\n" " recursive : %s\n" " chain call : %s\n" + " strict : %s\n" " calls : %u\n" " indirect calls : %u\n" " external calls : %u\n", @@ -497,6 +498,7 @@ static void simple_dump_graph(dumper_t *dmp, graph_entry_t *entry) entry->is_leaf_call == LCS_NON_LEAF_CALL ? "NO" : (entry->is_leaf_call == LCS_LEAF_CALL ? "Yes" : "Maybe"), entry->is_recursive ? "YES" : "NO", entry->is_chain_call ? "YES" : "NO", + entry->is_strict ? "YES" : "NO", cnt_to_uint(&entry->cnt[gcnt_all_calls]), cnt_to_uint(&entry->cnt[gcnt_indirect_calls]), cnt_to_uint(&entry->cnt[gcnt_external_calls]) -- 2.20.1