- detect non-strict functions
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Fri, 10 Oct 2008 12:42:09 +0000 (12:42 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Fri, 10 Oct 2008 12:42:09 +0000 (12:42 +0000)
[r22645]

ir/stat/firmstat.c
ir/stat/firmstat_t.h
ir/stat/stat_dmp.c

index 103e9d6..1e7dd4b 100644 (file)
@@ -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;
index 5757f9c..a344186 100644 (file)
@@ -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;
 
index e8ab327..3940122 100644 (file)
@@ -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])