/*
- * Project: libFIRM
- * File name: ir/ir/irdump.c
- * Purpose: Write vcg representation of firm to file.
- * Author: Martin Trapp, Christian Schaefer
- * Modified by: Goetz Lindenmaier, Hubert Schmidt
- * Created:
- * CVS-ID: $Id$
- * Copyright: (c) 1998-2006 Universit�t Karlsruhe
- * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
+ * Copyright (C) 1995-2007 University of Karlsruhe. All right reserved.
+ *
+ * This file is part of libFirm.
+ *
+ * This file may be distributed and/or modified under the terms of the
+ * GNU General Public License version 2 as published by the Free Software
+ * Foundation and appearing in the file LICENSE.GPL included in the
+ * packaging of this file.
+ *
+ * Licensees holding valid libFirm Professional Edition licenses may use
+ * this file in accordance with the libFirm Commercial License.
+ * Agreement provided with the Software.
+ *
+ * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+ * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ */
+
+/**
+ * @file
+ * @brief Write vcg representation of firm to file.
+ * @author Martin Trapp, Christian Schaefer, Goetz Lindenmaier, Hubert Schmidt
+ * @version $Id$
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
* Free the list with DEL_ARR_F().
*/
static ir_node **construct_block_lists(ir_graph *irg) {
- int i, rem_view = get_interprocedural_view();
- ir_graph *rem = current_ir_graph;
+ int i;
+ int rem_view = get_interprocedural_view();
+ int walk_flag = using_visited(irg);
+ ir_graph *rem = current_ir_graph;
+
current_ir_graph = irg;
+ if(walk_flag)
+ clear_using_visited(current_ir_graph);
+
for (i = get_irp_n_irgs() - 1; i >= 0; --i)
ird_set_irg_link(get_irp_irg(i), NULL);
set_interprocedural_view(rem_view);
+ if(walk_flag)
+ set_using_visited(current_ir_graph);
+
current_ir_graph = rem;
return ird_get_irg_link(irg);
}
#include <math.h>
#include "execution_frequency.h"
-#include "callgraph.h"
static void dump_node_ana_vals(FILE *F, ir_node *n) {
return;
if (!is_filtered_dump_name(get_entity_ident(get_irg_entity(irg))))
return;
+ if (dump_backedge_information_flag && get_irg_loopinfo_state(irg) != loopinfo_consistent) {
+ construct_backedges(irg);
+ }
+
rem = current_ir_graph;
current_ir_graph = irg;
if (get_interprocedural_view()) suffix1 = "-pure-ip";
return base_color + n_colors - color;
}
+/**
+ * Calculate a entity color depending on it's execution propability.
+ */
static int get_entity_color(ir_entity *ent) {
ir_graph *irg = get_entity_irg(ent);
assert(irg);
FILE *F = vcg_open_name("Callgraph", suffix);
if (F != NULL) {
- int i, rem = edge_label;
+ int i, rem = edge_label, colorize;
edge_label = 1;
dump_vcg_header(F, "Callgraph", NULL);
+ colorize = get_irp_callgraph_state() == irp_callgraph_and_calltree_consistent;
+
for (i = get_irp_n_irgs() - 1; i >= 0; --i) {
ir_graph *irg = get_irp_irg(i);
ir_entity *ent = get_irg_entity(irg);
int j, n_callees = get_irg_n_callees(irg);
+ int color;
- /* Do not dump runtime system. */
- //if (id_is_prefix(prefix, get_entity_ld_ident(ent))) continue;
-
- dump_entity_node(F, ent, get_entity_color(ent));
+ color = colorize ? get_entity_color(ent) : ird_color_green;
+ dump_entity_node(F, ent, color);
for (j = 0; j < n_callees; ++j) {
ir_entity *c = get_irg_entity(get_irg_callee(irg, j));
//if (id_is_prefix(prefix, get_entity_ld_ident(c))) continue;
attr = (be) ?
"label:\"recursion %d\" color:%d" :
"label:\"calls %d\" color:%d";
- print_ent_ent_edge(F, ent, c, be, attr, get_irg_callee_loop_depth(irg, j), get_entity_color(ent));
+ print_ent_ent_edge(F, ent, c, be, attr, get_irg_callee_loop_depth(irg, j), color);
}
}
}
-/*-----------------------------------------------------------------------------*/
-/* Dumps the firm nodes in the loop tree to a graph along with the loop nodes. */
-/*-----------------------------------------------------------------------------*/
+/*----------------------------------------------------------------------------*/
+/* Dumps the firm nodes in the loop tree to a graph along with the loop nodes.*/
+/*----------------------------------------------------------------------------*/
void collect_nodeloop(FILE *F, ir_loop *loop, eset *loopnodes) {
int i, son_number = 0, node_number = 0;