#if DEBUG_libfirm && NODEID_AS_LABEL
-#define PRINT_NODEID(X) fprintf(F, "\"n%ld\"", get_irn_node_nr(X))
+#define PRINT_NODEID(X) fprintf(F, "n%ld", get_irn_node_nr(X))
#define PRINT_TYPEID(X) fprintf(F, "\"t%ld\"", get_type_nr(X))
-#define PRINT_ENTID(X) fprintf(F, "\"e%ld\"", get_entity_nr(X))
+#define PRINT_ENTID(X) fprintf(F, "e%ld", get_entity_nr(X))
#define PRINT_IRGID(X) fprintf(F, "g%ld", get_irg_graph_nr(X))
#define PRINT_CONSTID(X,Y) fprintf(F, "\"n%ldn%ld\"", get_irn_node_nr(X),get_irn_node_nr(Y))
#else
-#define PRINT_NODEID(X) fprintf(F, "\"n%p\"", (void*) X)
+#define PRINT_NODEID(X) fprintf(F, "n%p", (void*) X)
#define PRINT_TYPEID(X) fprintf(F, "\"t%p\"", (void *) X)
-#define PRINT_ENTID(X) fprintf(F, "\"e%p\"", (void*) X)
+#define PRINT_ENTID(X) fprintf(F, "e%p", (void*) X)
#define PRINT_IRGID(X) fprintf(F, "g%p",(void*) X)
#define PRINT_CONSTID(X,Y) fprintf(F, "\"%p%p\"", (void*) X, (void*) Y)
#endif
#define PRINT_TYPE_TYPE_EDGE(S,T,...){fprintf (F, "edge: { sourcename: "); PRINT_TYPEID(S); fprintf (F, " targetname: "); PRINT_TYPEID(T); fprintf (F, ##__VA_ARGS__); fprintf(F,"}\n"); }
-#define PRINT_TYPE_ENT_EDGE(S,T,...) {fprintf (F, "edge: { sourcename: "); PRINT_TYPEID(S); fprintf (F, " targetname: "); PRINT_ENTID(T); fprintf (F, ##__VA_ARGS__); fprintf(F,"}\n"); }
-#define PRINT_ENT_ENT_EDGE(S,T,...) {fprintf (F, "edge: { sourcename: "); PRINT_ENTID(S); fprintf (F, " targetname: "); PRINT_ENTID(T); fprintf (F, ##__VA_ARGS__); fprintf(F,"}\n"); }
-#define PRINT_ENT_TYPE_EDGE(S,T,...) {fprintf (F, "edge: { sourcename: "); PRINT_ENTID(S); fprintf (F, " targetname: "); PRINT_TYPEID(T); fprintf (F, ##__VA_ARGS__); fprintf(F,"}\n"); }
-#define PRINT_NODE_TYPE_EDGE(S,T,...){fprintf (F, "edge: { sourcename: "); PRINT_NODEID(S); fprintf (F, " targetname: "); PRINT_TYPEID(T); fprintf (F, ##__VA_ARGS__); fprintf(F,"}\n"); }
-#define PRINT_NODE_ENT_EDGE(S,T,...) {fprintf (F, "edge: { sourcename: "); PRINT_NODEID(S); fprintf (F, " targetname: "); PRINT_ENTID(T); fprintf (F, ##__VA_ARGS__); fprintf(F,"}\n"); }
-#define PRINT_ENT_NODE_EDGE(S,T,...) {fprintf (F, "edge: { sourcename: "); PRINT_ENTID(S); fprintf (F, " targetname: "); PRINT_NODEID(T); fprintf (F, ##__VA_ARGS__); fprintf(F,"}\n"); }
+#define PRINT_TYPE_ENT_EDGE(S,T,...) {fprintf (F, "edge: { sourcename: "); PRINT_TYPEID(S); fprintf (F, " targetname: \""); PRINT_ENTID(T); fprintf(F, "\""); fprintf (F, ##__VA_ARGS__); fprintf(F,"}\n"); }
+#define PRINT_ENT_ENT_EDGE(S,T,...) {fprintf (F, "edge: { sourcename: \""); PRINT_ENTID(S); fprintf (F, "\" targetname: \""); PRINT_ENTID(T); fprintf(F, "\""); fprintf (F, ##__VA_ARGS__); fprintf(F,"}\n"); }
+#define PRINT_ENT_TYPE_EDGE(S,T,...) {fprintf (F, "edge: { sourcename: \""); PRINT_ENTID(S); fprintf (F, "\" targetname: "); PRINT_TYPEID(T); fprintf (F, ##__VA_ARGS__); fprintf(F,"}\n"); }
+#define PRINT_NODE_TYPE_EDGE(S,T,...){fprintf (F, "edge: { sourcename: \""); PRINT_NODEID(S); fprintf (F, "\" targetname: "); PRINT_TYPEID(T); fprintf (F, ##__VA_ARGS__); fprintf(F,"}\n"); }
+#define PRINT_NODE_ENT_EDGE(S,T,...) {fprintf (F, "edge: { sourcename: \""); PRINT_NODEID(S); fprintf (F, "\" targetname: \""); PRINT_ENTID(T); fprintf(F, "\""); fprintf (F, ##__VA_ARGS__); fprintf(F,"}\n"); }
+#define PRINT_ENT_NODE_EDGE(S,T,...) {fprintf (F, "edge: { sourcename: \""); PRINT_ENTID(S); fprintf (F, "\" targetname: \""); PRINT_NODEID(T); fprintf(F, "\""); fprintf (F, ##__VA_ARGS__); fprintf(F,"}\n"); }
/* A suffix to manipulate the file name. */
}
}
+static INLINE void
+dump_node_info (ir_node *n) {
+ fprintf (F, " info1: \"visited: %ld\n\"", get_irn_visited(n));
+}
+
static bool pred_in_wrong_graph(ir_node *n, int pos, pmap *irgmap) {
ir_node *block = (is_Block(n)) ? n : get_nodes_Block(n);
#endif
fprintf (F, "\" ");
dump_node_vcgattr(con);
+ dump_node_info(con);
fprintf (F, "}\n");
}
}
if (get_opt_dump_const_local() && is_constlike_node(n)) return;
/* dump this node */
- fprintf (F, "node: {title: "); PRINT_NODEID(n); fprintf(F, " label: \"");
+ fprintf (F, "node: {title: \""); PRINT_NODEID(n); fprintf(F, "\" label: \"");
dump_node_opcode(n);
dump_node_mode (n);
#endif
fprintf (F, "\" ");
dump_node_vcgattr(n);
+ dump_node_info(n);
fprintf (F, "}\n");
dump_const_node_local(n, map);
}
dump_ir_block_edge(ir_node *n) {
if (get_opt_dump_const_local() && is_constlike_node(n)) return;
if (is_no_Block(n)) {
- fprintf (F, "edge: { sourcename: ");
+ fprintf (F, "edge: { sourcename: \"");
PRINT_NODEID(n);
- fprintf (F, " targetname: ");
+ fprintf (F, "\" targetname: \"");
PRINT_NODEID(get_nodes_Block(n));
- fprintf (F, " " BLOCK_EDGE_ATTR "}\n");
+ fprintf (F, "\" " BLOCK_EDGE_ATTR "}\n");
}
}
if (is_backedge(n, i))
fprintf (F, "backedge: {sourcename: ");
else
- fprintf (F, "edge: {sourcename: ");
+ fprintf (F, "edge: {sourcename: \"");
PRINT_NODEID(n);
- fprintf (F, " targetname: ");
+ fprintf (F, " \" targetname: ");
if ((get_opt_dump_const_local()) && is_constlike_node(pred))
{
PRINT_CONSTID(n,pred);
}
else
- {
- PRINT_NODEID(pred);
+ {fprintf(F, "\""); PRINT_NODEID(pred); fprintf(F, "\"");
}
fprintf (F, " label: \"%d\" ", i);
print_edge_vcgattr(n, i);
int i;
for (i = 0; i < get_irn_n_outs(n); i++) {
assert(get_irn_out(n, i));
- fprintf (F, "edge: {sourcename: ");
+ fprintf (F, "edge: {sourcename: \"");
PRINT_NODEID(n);
- fprintf (F, " targetname: ");
+ fprintf (F, "\" targetname: \"");
PRINT_NODEID(get_irn_out(n, i));
- fprintf (F, " color: red linestyle: dashed");
+ fprintf (F, "\" color: red linestyle: dashed");
fprintf (F, "}\n");
}
}
static INLINE void
dump_loop_node_edge (ir_loop *loop, int i) {
assert(loop);
- fprintf (F, "edge: {sourcename: \"%p\" targetname: ", (void*) loop);
+ fprintf (F, "edge: {sourcename: \"%p\" targetname: \"", (void*) loop);
PRINT_NODEID(get_loop_node(loop, i));
- fprintf (F, " color: green");
+ fprintf (F, "\" color: green");
fprintf (F, "}\n");
}
}
+/* @@@@ Does not work as someone kills the visited flag. */
static void dump_const_expression(ir_node *value) {
ir_graph *rem = current_ir_graph;
int rem_dump_const_local = dump_const_local;
}
void dump_entity_node(entity *ent) {
- fprintf (F, "node: {title: ");
- PRINT_ENTID(ent);
+ fprintf (F, "node: {title: \"");
+ PRINT_ENTID(ent); fprintf(F, "\"");
fprintf (F, DEFAULT_TYPE_ATTRIBUTE);
fprintf (F, "label: ");
fprintf (F, "\"ent %s\" " ENTITY_NODE_ATTR , id_to_str(get_entity_ident(ent)));
- fprintf (F, "\n info1:\"\nallocation: ");
+ fprintf (F, "\n info1: \"\nid: "); PRINT_ENTID(ent);
+ fprintf (F, "\nallocation: ");
switch (get_entity_allocation(ent)) {
case dynamic_allocated: fprintf (F, "dynamic allocated"); break;
case automatic_allocated: fprintf (F, "automatic allocated"); break;
fprintf (F, "\nvisibility: ");
switch (get_entity_visibility(ent)) {
case local: fprintf (F, "local"); break;
- case external_visible: fprintf (F, "external_visible"); break;
- case external_allocated: fprintf (F, "external_allocate"); break;
+ case external_visible: fprintf (F, "external visible"); break;
+ case external_allocated: fprintf (F, "external allocated"); break;
}
fprintf (F, "\nvariability: ");
switch (get_entity_variability(ent)) {
value = get_atomic_ent_value(ent);
if (value) {
PRINT_ENT_NODE_EDGE(ent, value, ENT_VALUE_EDGE_ATTR, i);
- /*
- fprintf (F, "edge: { sourcename: \"%p\" targetname: ", GET_ENTID(ent));
- PRINT_NODEID(value);
- fprintf(F, " " ENT_VALUE_EDGE_ATTR "\"}\n");
- */
+ /* DDMN(value); $$$ */
dump_const_expression(value);
}
}
if (get_irn_opcode(block) == iro_Block) {
/* This is a block. So dump the vcg information to make a block. */
- fprintf(F, "graph: { title: ");
+ fprintf(F, "graph: { title: \"");
PRINT_NODEID(block);
- fprintf(F, " label: \"");
+ fprintf(F, "\" label: \"");
#ifdef DEBUG_libfirm
fprintf (F, "%ld", get_irn_node_nr(block));
#else
if (get_irn_opcode(block) == iro_Block) {
/* This is a block. Dump a node for the block. */
- fprintf (F, "node: {title:"); PRINT_NODEID(block);
- fprintf (F, " label: \"%s ", get_op_name(get_irn_op(block)));
+ fprintf (F, "node: {title: \""); PRINT_NODEID(block);
+ fprintf (F, "\" label: \"%s ", get_op_name(get_irn_op(block)));
#ifdef DEBUG_libfirm
fprintf (F, "%ld", get_irn_node_nr(block));
#else
for ( i = 0; i < get_Block_n_cfgpreds(block); i++)
if (get_irn_op(skip_Proj(get_Block_cfgpred(block, i))) != op_Bad) {
pred = get_nodes_Block(skip_Proj(get_Block_cfgpred(block, i)));
- fprintf (F, "edge: { sourcename: ");
+ fprintf (F, "edge: { sourcename: \"");
PRINT_NODEID(block);
- fprintf (F, " targetname: ");
+ fprintf (F, "\" targetname: \"");
PRINT_NODEID(pred);
- fprintf (F, " }\n");
+ fprintf (F, "\"}\n");
}
/* Dump dominator edge */
if (dump_dominator_information_flag && get_Block_idom(block)) {
pred = get_Block_idom(block);
- fprintf (F, "edge: { sourcename: ");
+ fprintf (F, "edge: { sourcename: \"");
PRINT_NODEID(block);
- fprintf (F, " targetname: ");
+ fprintf (F, "\" targetname: \"");
PRINT_NODEID(pred);
- fprintf (F, " " DOMINATOR_EDGE_ATTR "}\n");
+ fprintf (F, "\" " DOMINATOR_EDGE_ATTR "}\n");
}
}
}
ir_node *node;
pmap *irgmap = (pmap *)env;
assert(is_Block(block));
- fprintf(F, "graph: { title: ");
+ fprintf(F, "graph: { title: \"");
PRINT_NODEID(block);
- fprintf(F, " label: \"");
+ fprintf(F, "\" label: \"");
fprintf (F, "%s ", get_op_name(get_irn_op(block)));
#ifdef DEBUG_libfirm
fprintf (F, "%ld", get_irn_node_nr(block));
#ifndef _IRG_WALK_FUNC_TYPEDEF_
#define _IRG_WALK_FUNC_TYPEDEF_
/**
- * The type of a walk function.
+ * The type of a walk function. Does not use the link field.
*
* @param node - the node that is just visited
* @param env - an environment pointer passed by the walk functions
* nodes. It executes inc_irg_visited(current_ir_graph) to generate a new
* flag. It marks the node as visited before executing pre.
* The void* env can be used to pass status information between the
- * pre and post functions.
+ * pre and post functions. Does not use the link field.
*/
void irg_walk(ir_node *node, irg_walk_func *pre, irg_walk_func *post, void *env);
*
* Like irg_walk(), but walks over all reachable nodes in the ir
* graph, starting at the end operation. During the walk current_ir_graph
- * is set to irg.
+ * is set to irg. Does not use the link field.
*/
void irg_walk_graph(ir_graph *irg, irg_walk_func *pre, irg_walk_func *post, void *env);
* This function executes irg_walk(end, pre, post, env) for all irgraphs in irprog.
* Sets current_ir_graph properly for each walk. Conserves current
* current_ir_graph. In interprocedural view nodes can be visited several
- * times.
+ * times. Does not use the link field.
*/
void all_irg_walk(irg_walk_func *pre, irg_walk_func *post, void *env);
* @param env - environment, passend to pre and post
*
* This function walks all irgs in interprocedural view.
- * Visits each node only once.Sets current_ir_graph properly.
+ * Visits each node only once. Sets current_ir_graph properly. Does not use the link field.
*/
void cg_walk(irg_walk_func *pre, irg_walk_func *post, void *env);
* This function Walks only over Block nodes in the graph. Has it's own visited
* flag, so that it can be interleaved with the other walker.
* If a none block is passed, starts at the block this node belongs to.
- * If end is passed also visites kept alive blocks.
+ * If end is passed also visites kept alive blocks. Does not use the link field.
*/
void irg_block_walk(ir_node *node, irg_walk_func *pre, irg_walk_func *post, void *env);
* @param env - environment, passend to pre and post
*
* Like irg_block_walk(), but walks over all reachable blocks in the
- * ir graph, starting at the end block.
+ * ir graph, starting at the end block. Does not use the link field.
*/
void irg_block_walk_graph(ir_graph *irg, irg_walk_func *pre, irg_walk_func *post, void *env);
* @param env - environment, passend to pre and post
*
* This function walks over all code in const_code_irg.
- * Uses visited flag in const_code_irg.
+ * Uses visited flag in const_code_irg. Does not use the link field.
*/
void walk_const_code(irg_walk_func *pre, irg_walk_func *post, void *env);