return bad;
}
+#include <math.h>
+#include "execution_frequency.h"
+#include "callgraph.h"
+
+void dump_node_ana_vals(FILE *F, ir_node *n) {
+ return;
+ fprintf(F, " %lf*(%2.0lf + %2.0lf) = %2.0lf ",
+ get_irn_exec_freq(n),
+ get_irg_method_execution_frequency(get_irn_irg(n)),
+ pow(5, get_irg_recursion_depth(get_irn_irg(n))),
+ get_irn_exec_freq(n) * (get_irg_method_execution_frequency(get_irn_irg(n)) + pow(5, get_irg_recursion_depth(get_irn_irg(n))))
+ );
+}
+
-/** Dumps a node label without the enclosing ". */
-static int dump_node_label(FILE *F, ir_node *n) {
+/* Dumps a node label without the enclosing ". */
+int dump_node_label(FILE *F, ir_node *n) {
int bad = 0;
bad |= dump_node_opcode(F, n);
bad = ! irn_vrfy_irg_dump(n, current_ir_graph, &p);
bad |= dump_node_label(F, n);
+ dump_node_ana_vals(F, n);
//dump_node_ana_info(F, n);
fprintf(F, "\" ");
bad |= dump_node_info(F, n);
}
}
-
+#if 0
static int print_type_info(FILE *F, type *tp) {
int bad = 0;
default: break;
} /* switch type */
}
-
+#endif
static void print_typespecific_vcgattr(FILE *F, type *tp) {
switch (get_type_tpop_code(tp)) {
} /* switch type */
}
+
+/* Why not dump_type_node as the others? */
static int print_type_node(FILE *F, type *tp)
{
int bad = 0;
PRINT_TYPEID(tp);
fprintf (F, " label: \"%s %s\"", get_type_tpop_name(tp), get_type_name_ex(tp, &bad));
fprintf (F, " info1: \"");
+#if 0
bad |= print_type_info(F, tp);
print_typespecific_info(F, tp);
+#else
+ dump_type_to_file(F, tp, dump_verbosity_max);
+#endif
fprintf (F, "\"");
print_typespecific_vcgattr(F, tp);
fprintf (F, "}\n");
return bad;
}
+int dump_type_node(FILE *F, type *tp) {
+ return print_type_node(F, tp);
+}
+
+
#define X(a) case a: fprintf(F, #a); break
void dump_entity_node(FILE *F, entity *ent, int color)
{
PRINT_NODEID(block);
fprintf (F, "\" ");
fprintf(F, "info1:\"");
+
+#if 0
if (dump_dominator_information_flag) {
fprintf(F, "dom depth %d\n", get_Block_dom_depth(block));
fprintf(F, "tree pre num %d\n", get_Block_dom_tree_pre_num(block));
fprintf(F, "max subtree pre num %d\n", get_Block_dom_max_subtree_pre_num(block));
- }
+ }
/* show arity and possible Bad predecessors of the block */
fprintf(F, "arity: %d\n", get_Block_n_cfgpreds(block));
for (fl = i = 0; i < get_Block_n_cfgpreds(block); ++i) {
ir_node *pred = get_Block_cfgpred(block, i);
if (is_Bad(pred)) {
- if (! fl)
- fprintf(F, "Bad pred at pos: ");
- fprintf(F, "%d ", i);
- fl = 1;
+ if (! fl)
+ fprintf(F, "Bad pred at pos: ");
+ fprintf(F, "%d ", i);
+ fl = 1;
}
}
if (fl)
fprintf(F, "\n");
+#else
+ /* the generic version. */
+ dump_irnode_to_file(F, block);
+
+ /* Check whether we have bad predecessors to color the block. */
+ for (i = 0; i < get_Block_n_cfgpreds(block); ++i)
+ if ((fl = is_Bad(get_Block_cfgpred(block, i))))
+ break;
+#endif
fprintf (F, "\""); /* closing quote of info */
#include "irgwalk.h"
#include "tv.h"
+#include "irdom.h"
#include "field_temperature.h"
#define MY_SIZE 1024 /* Size of an array that actually should be computed. */
-int dump_node_opcode(FILE *F, ir_node *n); /* from irdump.c */
-
-
/* Just opens a file, mangling a file name.
*
* The name consists of the following parts:
switch (get_irn_opcode(n)) {
case iro_Block: {
fprintf(F, " block visited: %ld\n", get_Block_block_visited(n));
- fprintf(F, " dominator info: output not implemented\n");
+ if (get_irg_dom_state(get_irn_irg(n)) != dom_none) {
+ fprintf(F, " dom depth %d\n", get_Block_dom_depth(n));
+ fprintf(F, " tree pre num %d\n", get_Block_dom_tree_pre_num(n));
+ fprintf(F, " max subtree pre num %d\n", get_Block_dom_max_subtree_pre_num(n));
+ }
+
+ fprintf(F, " Execution freqency statistics:\n");
+ if (get_irg_exec_freq_state(get_irn_irg(n)) != exec_freq_none)
+ fprintf(F, " procedure local evaluation: %8.2lf\n", get_irn_exec_freq(n));
+ if (get_irp_loop_nesting_depth_state() != loop_nesting_depth_none)
+ fprintf(F, " call freqency of procedure: %8.2lf\n",
+ get_irg_method_execution_frequency(get_irn_irg(n)));
+ if (get_irp_callgraph_state() == irp_callgraph_and_calltree_consistent)
+ fprintf(F, " recursion depth of procedure: %8.2lf\n", (double)get_irn_recursion_depth(n));
+ if ((get_irg_exec_freq_state(get_irn_irg(n)) != exec_freq_none) &&
+ (get_irp_loop_nesting_depth_state() != loop_nesting_depth_none) &&
+ (get_irp_callgraph_state() == irp_callgraph_and_calltree_consistent))
+ fprintf(F, " final evaluation: **%8.2lf**\n", get_irn_final_cost(n));
+
/* not dumped: graph_arr */
/* not dumped: mature */
} break;
return 1;
}
+/** dumps something like:
+ *
+ * "prefix" "Name" (x): node1, ... node7,\n
+ * "prefix" node8, ... node15,\n
+ * "prefix" node16, node17\n
+ */
+static void dump_node_list(FILE *F, firm_kind *k, char *prefix,
+ int (*get_entity_n_nodes)(firm_kind *ent),
+ ir_node *(*get_entity_node)(firm_kind *ent, int pos),
+ char *name) {
+ int i, n_nodes = get_entity_n_nodes(k);
+ char *comma = "";
+
+ fprintf(F, "%s %s (%d):", prefix, name, n_nodes);
+ for (i = 0; i < n_nodes; ++i) {
+ int rem;
+ if (i > 7 && !(i & 7)) { /* line break every eigth node. */
+ fprintf(F, ",\n%s ", prefix);
+ comma = "";
+ }
+ fprintf(F, "%s ", comma);
+ rem = opt_dump_analysed_type_info;
+ opt_dump_analysed_type_info = 0;
+ dump_node_label(F, get_entity_node(k, i));
+ opt_dump_analysed_type_info = rem;
+ comma = ",";
+ }
+ fprintf(F, "\n");
+}
+
+/** dumps something like:
+ *
+ * "prefix" "Name" (x): node1, ... node7,\n
+ * "prefix" node8, ... node15,\n
+ * "prefix" node16, node17\n
+ */
+static void dump_type_list(FILE *F, type *tp, char *prefix,
+ int (*get_n_types)(type *tp),
+ type *(*get_type)(type *tp, int pos),
+ char *name) {
+ int i, n_nodes = get_n_types(tp);
+ char *comma = "";
+
+ fprintf(F, "%s %s (%d):", prefix, name, n_nodes);
+ for (i = 0; i < n_nodes; ++i) {
+ if (i > 7 && !(i & 7)) { /* line break every eigth node. */
+ fprintf(F, ",\n%s ", prefix);
+ comma = "";
+ }
+ fprintf(F, "%s %s(%ld)", comma, get_type_name(get_type(tp, i)), get_type_nr(tp));
+ //dump_type_to_file(F, get_type(tp, i), dump_verbosity_onlynames);
+ comma = ",";
+ }
+ fprintf(F, "\n");
+}
+
#define X(a) case a: fprintf(F, #a); break
void dump_entity_to_file_prefix (FILE *F, entity *ent, char *prefix, unsigned verbosity) {
int i, j;
fprintf(F, "\n");
}
+ if (get_trouts_state()) {
+ fprintf(F, "%sEntity outs:\n", prefix);
+ dump_node_list(F, (firm_kind *)ent, prefix, (int(*)(firm_kind *))get_entity_n_accesses,
+ (ir_node *(*)(firm_kind *, int))get_entity_access, "Accesses");
+ dump_node_list(F, (firm_kind *)ent, prefix, (int(*)(firm_kind *))get_entity_n_references,
+ (ir_node *(*)(firm_kind *, int))get_entity_reference, "References");
+ }
+
if (verbosity & dump_verbosity_accessStats) {
#if 0
int n_acc = get_entity_n_accesses(ent);
fprintf(F, " alignment: %2d Bits,\n", get_type_alignment_bits(tp));
if (is_atomic_type(tp))
fprintf(F, " mode: %s,\n", get_mode_name(get_type_mode(tp)));
- fprintf(F, " dbg info: %p,", (void *)get_type_dbg_info(tp));
+ fprintf(F, " dbg info: %p,\n", (void *)get_type_dbg_info(tp));
+
+ if (get_trouts_state()) {
+ fprintf(F, "\n Type outs:\n");
+ dump_node_list(F, (firm_kind *)tp, " ", (int(*)(firm_kind *))get_type_n_allocs,
+ (ir_node *(*)(firm_kind *, int))get_type_alloc, "Allocations");
+ dump_node_list(F, (firm_kind *)tp, " ", (int(*)(firm_kind *))get_type_n_casts,
+ (ir_node *(*)(firm_kind *, int))get_type_cast, "Casts");
+ dump_type_list(F, tp, " ", get_type_n_pointertypes_to, get_type_pointertype_to, "PointerTpsTo");
+ }
+
if (verbosity & dump_verbosity_accessStats) {
#if 0