* @brief Write vcg representation of firm to file.
* @author Martin Trapp, Christian Schaefer, Goetz Lindenmaier, Hubert Schmidt,
* Matthias Braun
- * @version $Id$
*/
#include "config.h"
#include "pset.h"
#include "util.h"
+typedef struct pns_lookup {
+ long nr; /**< the proj number */
+ const char *name; /**< the name of the Proj */
+} pns_lookup_t;
+
+typedef struct proj_lookup {
+ unsigned code; /**< the opcode of the Proj predecessor */
+ unsigned num_data; /**< number of data entries */
+ const pns_lookup_t *data; /**< the data */
+} proj_lookup_t;
+
+#include "gen_irdump.c.inl"
+
/** Dump only irgs with names that start with this prefix. */
static ident *dump_file_filter_id = NULL;
}
break;
- case iro_Proj: {
- ir_node *pred = get_Proj_pred(n);
-
- if (get_irn_opcode(pred) == iro_Cond
- && get_Proj_proj(n) == get_Cond_default_proj(pred)
- && get_irn_mode(get_Cond_selector(pred)) != mode_b)
- fprintf(F, "defProj");
- else
- goto default_case;
- } break;
-
case iro_Load:
if (get_Load_unaligned(n) == align_non_aligned)
fprintf(F, "ua");
break;
default:
-default_case:
fprintf(F, "%s", get_irn_opname(n));
}
}
return bad;
}
-typedef struct pns_lookup {
- long nr; /**< the proj number */
- const char *name; /**< the name of the Proj */
-} pns_lookup_t;
-
-typedef struct proj_lookup {
- unsigned code; /**< the opcode of the Proj predecessor */
- unsigned num_data; /**< number of data entries */
- const pns_lookup_t *data; /**< the data */
-} proj_lookup_t;
-
-/** the lookup table for Proj(Start) names */
-static const pns_lookup_t start_lut[] = {
-#define X(a) { pn_Start_##a, #a }
- X(X_initial_exec),
- X(M),
- X(P_frame_base),
- X(T_args),
-#undef X
-};
-
-/** the lookup table for Proj(Cond) names */
-static const pns_lookup_t cond_lut[] = {
-#define X(a) { pn_Cond_##a, #a }
- X(false),
- X(true)
-#undef X
-};
-
-/** the lookup table for Proj(Call) names */
-static const pns_lookup_t call_lut[] = {
-#define X(a) { pn_Call_##a, #a }
- X(M),
- X(X_regular),
- X(X_except),
- X(T_result),
-#undef X
-};
-
-/** the lookup table for Proj(Div) names */
-static const pns_lookup_t div_lut[] = {
-#define X(a) { pn_Div_##a, #a }
- X(M),
- X(X_regular),
- X(X_except),
- X(res)
-#undef X
-};
-
-/** the lookup table for Proj(Mod) names */
-static const pns_lookup_t mod_lut[] = {
-#define X(a) { pn_Mod_##a, #a }
- X(M),
- X(X_regular),
- X(X_except),
- X(res)
-#undef X
-};
-
-/** the lookup table for Proj(Load) names */
-static const pns_lookup_t load_lut[] = {
-#define X(a) { pn_Load_##a, #a }
- X(M),
- X(X_regular),
- X(X_except),
- X(res)
-#undef X
-};
-
-/** the lookup table for Proj(Store) names */
-static const pns_lookup_t store_lut[] = {
-#define X(a) { pn_Store_##a, #a }
- X(M),
- X(X_regular),
- X(X_except)
-#undef X
-};
-
-/** the lookup table for Proj(Alloc) names */
-static const pns_lookup_t alloc_lut[] = {
-#define X(a) { pn_Alloc_##a, #a }
- X(M),
- X(X_regular),
- X(X_except),
- X(res)
-#undef X
-};
-
-/** the lookup table for Proj(CopyB) names */
-static const pns_lookup_t copyb_lut[] = {
-#define X(a) { pn_CopyB_##a, #a }
- X(M),
- X(X_regular),
- X(X_except),
-#undef X
-};
-
-/** the lookup table for Proj(InstOf) names */
-static const pns_lookup_t instof_lut[] = {
-#define X(a) { pn_InstOf_##a, #a }
- X(M),
- X(X_regular),
- X(X_except),
- X(res),
-#undef X
-};
-
-/** the lookup table for Proj(Raise) names */
-static const pns_lookup_t raise_lut[] = {
-#define X(a) { pn_Raise_##a, #a }
- X(M),
- X(X),
-#undef X
-};
-
-/** the lookup table for Proj(Bound) names */
-static const pns_lookup_t bound_lut[] = {
-#define X(a) { pn_Bound_##a, #a }
- X(M),
- X(X_regular),
- X(X_except),
- X(res),
-#undef X
-};
-
-/** the Proj lookup table */
-static const proj_lookup_t proj_lut[] = {
-#define E(a) ARRAY_SIZE(a), a
- { iro_Start, E(start_lut) },
- { iro_Cond, E(cond_lut) },
- { iro_Call, E(call_lut) },
- { iro_Div, E(div_lut) },
- { iro_Mod, E(mod_lut) },
- { iro_Load, E(load_lut) },
- { iro_Store, E(store_lut) },
- { iro_Alloc, E(alloc_lut) },
- { iro_CopyB, E(copyb_lut) },
- { iro_InstOf, E(instof_lut) },
- { iro_Raise, E(raise_lut) },
- { iro_Bound, E(bound_lut) }
-#undef E
-};
-
/**
* Dump additional node attributes of some nodes to a file F.
*/
default:
break;
- } /* end switch */
+ }
}
-#include <math.h>
-#include "execution_frequency.h"
-
static void dump_node_ana_vals(FILE *F, ir_node *n)
{
(void) F;
}
}
-void dump_vrp_info(FILE *F, ir_node *n)
-{
- vrp_attr *vrp = vrp_get_info(n);
- if (n == NULL) {
- return;
- }
-
- fprintf(F, "range_type: %d\n", (int) vrp->range_type);
- if (vrp->range_type == VRP_RANGE || vrp->range_type ==
- VRP_ANTIRANGE) {
- ir_fprintf(F, "range_bottom: %F\n",vrp->range_bottom);
- ir_fprintf(F, "range_top: %F\n", vrp->range_top);
- }
- ir_fprintf(F, "bits_set: %T\n", vrp->bits_set);
- ir_fprintf(F, "bits_not_set: %T\n", vrp->bits_not_set);
-}
-
/**
* Dumps the attributes of a node n into the file F.
* Currently this is only the color of a node.
void *dump_add_node_info_callback(dump_node_info_cb_t *cb, void *data)
{
- hook_entry_t *info = XMALLOC(hook_entry_t);
+ hook_entry_t *info = XMALLOCZ(hook_entry_t);
info->hook._hook_node_info = cb;
info->context = data;
dump_ir_edges(node, F);
}
- if (is_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_LOOPINFO))
+ if ((flags & ir_dump_flag_loops)
+ && is_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_LOOPINFO))
dump_loop_nodes_into_graph(F, irg);
current_ir_graph = rem;
break;
default:
break;
- } /* switch type */
+ }
}
#endif
break;
default:
break;
- } /* switch type */
+ }
}
void dump_type_node(FILE *F, ir_type *tp)
break;
default:
break;
- } /* switch type */
+ }
break; /* case k_type */
}
default:
printf(" *** irdump, dump_type_info(l.%i), faulty type.\n", __LINE__);
- } /* switch kind_or_entity */
+ }
}
/** For dumping class hierarchies.
}
break;
default: break;
- } /* switch type */
+ }
break; /* case k_type */
}
default:
printf(" *** irdump, dump_class_hierarchy_node(l.%i), faulty type.\n", __LINE__);
- } /* switch kind_or_entity */
+ }
}
/*******************************************************************/
}
}
-static void dump_loop_label(FILE *F, ir_loop *loop)
+static void dump_loop_label(FILE *F, const ir_loop *loop)
{
- fprintf(F, "loop %u, %lu sons, %lu nodes",
- get_loop_depth(loop), (unsigned long) get_loop_n_sons(loop),
- (unsigned long) get_loop_n_nodes(loop));
+ fprintf(F, "loop %u", get_loop_depth(loop));
}
-static void dump_loop_info(FILE *F, ir_loop *loop)
+static void dump_loop_info(FILE *F, const ir_loop *loop)
{
fprintf(F, " info1: \"");
fprintf(F, " loop nr: %ld", get_loop_loop_nr(loop));
fprintf(F, "\"");
}
-static void dump_loop_node(FILE *F, ir_loop *loop)
+static void dump_loop_node(FILE *F, const ir_loop *loop)
{
fprintf(F, "node: {title: \"");
PRINT_LOOPID(loop);
fprintf(F, "}\n");
}
-static void dump_loop_node_edge(FILE *F, ir_loop *loop, size_t i)
+static void dump_loop_node_edge(FILE *F, const ir_loop *loop, size_t i)
{
assert(loop);
fprintf(F, "edge: {sourcename: \"");
PRINT_LOOPID(loop);
fprintf(F, "\" targetname: \"");
- PRINT_NODEID(get_loop_node(loop, i));
+ PRINT_NODEID(get_loop_element(loop, i).node);
fprintf(F, "\" color: green");
fprintf(F, "}\n");
}
-static void dump_loop_son_edge(FILE *F, ir_loop *loop, size_t i)
+static void dump_loop_son_edge(FILE *F, const ir_loop *loop, size_t i)
{
assert(loop);
fprintf(F, "edge: {sourcename: \"");
PRINT_LOOPID(loop);
fprintf(F, "\" targetname: \"");
- PRINT_LOOPID(get_loop_son(loop, i));
- ir_fprintf(F, "\" color: darkgreen label: \"%zu\"}\n",
- get_loop_element_pos(loop, get_loop_son(loop, i)));
+ PRINT_LOOPID(get_loop_element(loop, i).son);
+ ir_fprintf(F, "\" color: darkgreen label: \"%zu\"}\n", i);
}
-static void dump_loops(FILE *F, ir_loop *loop)
+static void dump_loops(FILE *F, const ir_loop *loop)
{
size_t i;
+ size_t n_elements = get_loop_n_elements(loop);
/* dump this loop node */
dump_loop_node(F, loop);
/* dump edges to nodes in loop -- only if it is a real loop */
if (get_loop_depth(loop) != 0) {
- for (i = get_loop_n_nodes(loop); i > 0;) {
+ for (i = n_elements; i > 0;) {
+ loop_element element;
--i;
+ element = get_loop_element(loop, i);
+ if (*element.kind != k_ir_node)
+ continue;
dump_loop_node_edge(F, loop, i);
}
}
- for (i = get_loop_n_sons(loop); i > 0;) {
- --i;
- dump_loops(F, get_loop_son(loop, i));
+ for (i = n_elements; i > 0;) {
+ loop_element element;
+ --i;
+ element = get_loop_element(loop, i);
+ if (*element.kind != k_ir_loop)
+ continue;
+ dump_loops(F, element.son);
dump_loop_son_edge(F, loop, i);
}
}
size_t i;
ir_entity *ent = get_irg_entity(irg);
- if (get_irg_extblk_state(irg) != ir_extblk_info_valid)
+ if (!is_irg_state(irg, IR_GRAPH_STATE_VALID_EXTENDED_BLOCKS))
compute_extbb(irg);
construct_extblock_lists(irg);