Comments, beautify
authorDaniel Grund <grund@cs.uni-saarland.de>
Sat, 15 Jan 2005 16:31:17 +0000 (16:31 +0000)
committerDaniel Grund <grund@cs.uni-saarland.de>
Sat, 15 Jan 2005 16:31:17 +0000 (16:31 +0000)
ir/be/bephiopt.c
ir/be/phistat.c
ir/be/phistat.h

index 53de2bc..31a7786 100644 (file)
 #include "bephicoal_t.h"
 #include "phistat.h"
 
+#define DEBUG_LVL SET_LEVEL_1
+
 #define DO_PHI_STATISTICS
 #undef DUMP_IRG_PHI_STAT
-#define DUMP_ALL_PHI_STAT
-
-#define DEBUG_LVL 1
 
+#define DUMP_CUMULATIVE
 #define CUMULATIVE_FILE "all.phistat"
+
 #define ENV_PHI_STAT "PHI_STAT"
 
 static firm_dbg_module_t *dbgphi = NULL;
@@ -64,7 +65,7 @@ void be_phi_opt(ir_graph* irg) {
                phi_stat_dump_pretty(buf);
        }
 #endif
-#ifdef DUMP_ALL_PHI_STAT
+#ifdef DUMP_CUMULATIVE
        phi_stat_update(CUMULATIVE_FILE);
 #endif
        phi_stat_update(getenv(ENV_PHI_STAT));
index 5d6ccc4..1a1802f 100644 (file)
@@ -59,9 +59,6 @@ enum vals_t {
 static int curr_vals[ASIZE];
 
 
-/**
- * Resets the array holding the data
- */
 void phi_stat_reset(void) {
        int i;
 
@@ -144,8 +141,8 @@ static void phi_class_stat(pset *pc) {
                curr_vals[I_CLS_SIZE_S + size]++;
 
        /* get an array of all members for double iterating */
-       members = (ir_node **) malloc(size * sizeof(ir_node*));
-       for (i=0, p = (ir_node *)pset_first(pc); p; p = (ir_node *)pset_next(pc))
+       members = malloc(size * sizeof(*members));
+       for (i = 0, p = pset_first(pc); p; p = pset_next(pc))
                members[i++] = p;
        assert(i == size);
 
@@ -174,9 +171,6 @@ static void phi_class_stat(pset *pc) {
 }
 
 
-/**
- * Collect all stat data
- */
 void phi_stat_collect(ir_graph *irg, pset *all_phi_nodes, pset *all_phi_classes) {
        ir_node *n;
        pset *pc;
@@ -184,10 +178,10 @@ void phi_stat_collect(ir_graph *irg, pset *all_phi_nodes, pset *all_phi_classes)
        irg_walk_graph(irg, stat_walker, NULL, NULL);
        curr_vals[I_BLOCKS] -= 2;
 
-       for (n = (ir_node *)pset_first(all_phi_nodes); n; n = (ir_node *)pset_next(all_phi_nodes))
+       for (n = pset_first(all_phi_nodes); n; n = pset_next(all_phi_nodes))
                phi_node_stat(n);
 
-       for (pc = (pset *)pset_first(all_phi_classes); pc; pc = (pset *)pset_next(all_phi_classes))
+       for (pc = pset_first(all_phi_classes); pc; pc = pset_next(all_phi_classes))
                phi_class_stat(pc);
 }
 
@@ -217,9 +211,6 @@ static void dump_file(char *filename, int stat[ASIZE]) {
 }
 
 
-/**
- * Updates a cumulative file with the current values.
- */
 void phi_stat_update(char *filename) {
     int i;
        FILE *all;
@@ -255,20 +246,12 @@ void phi_stat_update(char *filename) {
 }
 
 
-/**
- * Dumps the current contents of the values array to a file.
- * Updates a cumulative file.
- */
 void phi_stat_dump(char *filename) {
        if (filename)
                dump_file(filename, curr_vals);
 }
 
 
-/**
- * Dumps the current contents of the values array
- * and annotations to a file.
- */
 void phi_stat_dump_pretty(char *filename) {
        int i;
        FILE *out;
index 5cfe055..d700c86 100644 (file)
@@ -9,10 +9,30 @@
 #include "pset.h"
 #include "irgraph.h"
 
+/**
+ * Resets the array holding the data
+ */
 void phi_stat_reset(void);
+
+/**
+ * Collect all stat data
+ */
 void phi_stat_collect(ir_graph *irg, pset *all_phi_nodes, pset *all_phi_classes);
+
+/**
+ * Dumps the current contents of the internal values to a file.
+ */
 void phi_stat_dump(char *filename);
+
+/**
+ * Updates a cumulative file with the internal values.
+ */
 void phi_stat_update(char *filename);
+
+/**
+ * Dumps the current contents of the values array
+ * and annotations to a file.
+ */
 void phi_stat_dump_pretty(char *filename);
 
 #endif