/** Initializes the used colors. */
static void init_colors(void)
{
- static int initialized = 0;
+ static bool initialized = 0;
if (initialized)
return;
*
* Projs should be dumped near their predecessor, so they get "nearedge".
*/
-static void print_node_edge_kind(FILE *out, ir_node *node)
+static void print_node_edge_kind(FILE *out, const ir_node *node)
{
if (is_Proj(node)) {
fprintf(out, "nearedge: ");
return lists;
}
-void dump_node_opcode(FILE *F, ir_node *n)
+void dump_node_opcode(FILE *F, const ir_node *n)
{
const ir_op_ops *ops = get_op_ops(get_irn_op(n));
* Dump the mode of a node n to a file F.
* Ignore modes that are "always known".
*/
-static void dump_node_mode(FILE *F, ir_node *n)
+static void dump_node_mode(FILE *F, const ir_node *n)
{
const ir_op_ops *ops = get_op_ops(get_irn_op(n));
unsigned iro;
/**
* Dump the type of a node n to a file F if it's known.
*/
-static int dump_node_typeinfo(FILE *F, ir_node *n)
+static int dump_node_typeinfo(FILE *F, const ir_node *n)
{
int bad = 0;
/**
* Dump additional node attributes of some nodes to a file F.
*/
-static void dump_node_nodeattr(FILE *F, ir_node *n)
+static void dump_node_nodeattr(FILE *F, const ir_node *n)
{
ir_node *pred;
unsigned code;
}
}
-static void dump_node_ana_vals(FILE *F, ir_node *n)
-{
- (void) F;
- (void) n;
- return;
-}
-
-void dump_node_label(FILE *F, ir_node *n)
+void dump_node_label(FILE *F, const ir_node *n)
{
dump_node_opcode(F, n);
fputs(" ", F);
* Dumps the attributes of a node n into the file F.
* Currently this is only the color of a node.
*/
-static void dump_node_vcgattr(FILE *F, ir_node *node, ir_node *local, int bad)
+static void dump_node_vcgattr(FILE *F, const ir_node *node, const ir_node *local, bool bad)
{
ir_mode *mode;
- ir_node *n;
+ const ir_node *n;
if (bad) {
print_vcg_color(F, ird_color_error);
/**
* Dump the node information of a node n to a file F.
*/
-static void dump_node_info(FILE *F, ir_node *n)
+static void dump_node_info(FILE *F, const ir_node *n)
{
const ir_op_ops *ops = get_op_ops(get_irn_op(n));
/** outputs the predecessors of n, that are constants, local. I.e.,
generates a copy of the constant predecessors for each node called with. */
-static void dump_const_node_local(FILE *F, ir_node *n)
+static void dump_const_node_local(FILE *F, const ir_node *n)
{
int i;
if (!get_opt_dump_const_local()) return;
}
/** If the block of an edge is a const_like node, dump it local with an edge */
-static void dump_const_block_local(FILE *F, ir_node *n)
+static void dump_const_block_local(FILE *F, const ir_node *n)
{
ir_node *blk;
/**
* Dump a node
*/
-static void dump_node(FILE *F, ir_node *n)
+void dump_node(FILE *F, const ir_node *n)
{
int bad = 0;
const char *p;
fputs(" label: \"", F);
bad = ! irn_verify_irg_dump(n, current_ir_graph, &p);
dump_node_label(F, n);
- dump_node_ana_vals(F, n);
//dump_node_ana_info(F, n);
fputs("\" ", F);
fputs("}\n", F);
dump_const_node_local(F, n);
- if (dump_node_edge_hook)
- dump_node_edge_hook(F, n);
}
/** dump the edge to the block this node belongs to */
-static void dump_ir_block_edge(FILE *F, ir_node *n)
+static void dump_ir_block_edge(FILE *F, const ir_node *n)
{
if (get_opt_dump_const_local() && is_constlike_node(n)) return;
if (!is_Block(n)) {
}
}
-static void print_data_edge_vcgattr(FILE *F, ir_node *from, int to)
+static void print_data_edge_vcgattr(FILE *F, const ir_node *from, int to)
{
/*
* do not use get_nodes_block() here, will fail
fprintf(F, INTER_DATA_EDGE_ATTR);
}
-static void print_mem_edge_vcgattr(FILE *F, ir_node *from, int to)
+static void print_mem_edge_vcgattr(FILE *F, const ir_node *from, int to)
{
/*
* do not use get_nodes_block() here, will fail
}
/** Print the vcg attributes for the edge from node "from" to its "to"th input */
-static void print_edge_vcgattr(FILE *F, ir_node *from, int to)
+static void print_edge_vcgattr(FILE *F, const ir_node *from, int to)
{
assert(from);
}
/** dump edges to our inputs */
-static void dump_ir_data_edges(FILE *F, ir_node *n)
+static void dump_ir_data_edges(FILE *F, const ir_node *n)
{
int i, num;
+ if (dump_node_edge_hook)
+ dump_node_edge_hook(F, n);
+
if (!(flags & ir_dump_flag_keepalive_edges) && is_End(n)) {
/* the End node has only keep-alive edges */
return;
/** Dumps a node and its edges but not the block edge */
-static void dump_node_wo_blockedge(ir_node *n, void *env)
+static void dump_node_wo_blockedge(FILE *F, const ir_node *n)
{
- FILE *F = (FILE*)env;
dump_node(F, n);
dump_ir_data_edges(F, n);
}
static void dump_node_with_edges(ir_node *n, void *env)
{
FILE *F = (FILE*)env;
- dump_node_wo_blockedge(n, env);
+ dump_node_wo_blockedge(F, n);
if (!node_floats(n))
dump_ir_block_edge(F, n);
}
/** Dumps a const-like node. */
static void dump_const_node(ir_node *n, void *env)
{
+ FILE *F = (FILE*)env;
if (is_Block(n)) return;
- dump_node_wo_blockedge(n, env);
+ dump_node_wo_blockedge(F, n);
}
/***********************************************************************/
* Expects to find nodes belonging to the block as list in its
* link field.
* Dumps the edges of all nodes including itself. */
-static void dump_whole_block(FILE *F, ir_node *block)
+static void dump_whole_block(FILE *F, const ir_node *block)
{
ir_node *node;
ird_color_t color = ird_color_block_background;
}
}
+void dump_vcg_header_colors(FILE *F)
+{
+ int i;
+ init_colors();
+ for (i = 0; i < ird_color_count; ++i) {
+ if (color_rgb[i] != NULL) {
+ fprintf(F, "colorentry %s: %s\n", color_names[i], color_rgb[i]);
+ }
+ }
+}
/**
* dumps the VCG header
*/
void dump_vcg_header(FILE *F, const char *name, const char *layout, const char *orientation)
{
- int i;
const char *label
= (flags & ir_dump_flag_disable_edge_labels) ? "no" : "yes";
- init_colors();
-
if (! layout) layout = "Compilergraph";
if (!orientation) orientation = "bottom_to_top";
"infoname 2: \"Verification errors\"\n"
"infoname 3: \"Debug info\"\n",
name, label, layout, orientation);
-
- for (i = 0; i < ird_color_count; ++i) {
- if (color_rgb[i] != NULL) {
- fprintf(F, "colorentry %s: %s\n", color_names[i], color_rgb[i]);
- }
- }
+ dump_vcg_header_colors(F);
fprintf(F, "\n");
}
#define PRINT_ITEMID(X,Y) ir_fprintf(F, "i%ldT%zu", get_type_nr(X), (Y))
#define PRINT_EXTBBID(X) ir_fprintf(F, "x%ld", get_irn_node_nr(X))
-void dump_vcg_header(FILE *out, const char *name, const char *layout, const char *orientation);
-void dump_vcg_footer(FILE *out);
const char *get_irg_dump_name(const ir_graph *irg);
const char *get_ent_dump_name(const ir_entity *ent);
*/
const char *get_mode_name_ex(const ir_mode *mode, int *bad);
/** dump the name of a node n to the File F. */
-void dump_node_opcode(FILE *out, ir_node *n);
+void dump_node_opcode(FILE *out, const ir_node *n);
-void dump_node_label(FILE *out, ir_node *n);
+void dump_node_label(FILE *out, const ir_node *n);
/** Writes vcg representation with title "PRINT_TYPEID(tp)" to file F. */
void dump_type_node(FILE *out, ir_type *tp);
+void dump_vcg_header(FILE *out, const char *name, const char *layout, const char *orientation);
+void dump_vcg_footer(FILE *out);
+void dump_vcg_header_colors(FILE *out);
+void dump_node(FILE *out, const ir_node *node);
+
+/** Write the irnode and all its attributes to the file passed.
+ * (plain text format) */
+void dump_irnode_to_file(FILE *out, const ir_node *node);
+
#endif