/*
- * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved.
+ * Copyright (C) 1995-2011 University of Karlsruhe. All right reserved.
*
* This file is part of libFirm.
*
return verbosity;
}
-static inline bool is_ip_Filter(ir_node *n)
-{
-#ifdef INTERPROCEDURAL_VIEW
- return is_Filter(n) && get_interprocedural_view();
-#else
- (void) n;
- return 0;
-#endif
-}
-
/* Write the irnode and all its attributes to the file passed. */
void dump_irnode_to_file(FILE *F, ir_node *n)
{
fprintf(F, " %ld\n", get_irn_node_nr(get_irn_n(n, -1)));
}
-#ifdef INTERPROCEDURAL_VIEW
- fprintf(F, " arity: %d\n", get_irn_intra_arity(n));
- /* show all predecessor nodes */
- fprintf(F, " pred nodes:\n");
- if (!is_Block(n)) {
- fprintf(F, " -1: ");
- dump_node_opcode(F, get_irn_n(n, -1));
- fprintf(F, " %ld\n", get_irn_node_nr(get_irn_n(n, -1)));
- }
- for ( i = 0; i < get_irn_intra_arity(n); ++i) {
- fprintf(F, " %d: %s ", i, is_intra_backedge(n, i) ? "be" : " ");
- dump_node_opcode(F, get_irn_intra_n(n, i));
- fprintf(F, " %ld\n", get_irn_node_nr(get_irn_intra_n(n, i)));
- }
-#else
fprintf(F, " arity: %d\n", get_irn_arity(n));
/* show all predecessor nodes */
fprintf(F, " pred nodes:\n");
dump_node_opcode(F, get_irn_n(n, i));
fprintf(F, " %ld\n", get_irn_node_nr(get_irn_n(n, i)));
}
-#endif
fprintf(F, " Private Attributes:\n");
if (is_Proj(n))
fprintf(F, " proj nr: %ld\n", get_Proj_proj(n));
-#ifdef INTERPROCEDURAL_VIEW
- if ((get_irp_ip_view_state() != ip_view_no) && (is_Filter(n) || is_Block(n))) {
- fprintf(F, " inter arity: %d\n", get_irn_inter_arity(n));
- fprintf(F, " inter pred nodes:\n");
- for (i = 0; i < get_irn_inter_arity(n); ++i) {
- fprintf(F, " %d: %s ", i, is_intra_backedge(n, i) ? "be" : " ");
- dump_node_opcode(F, get_irn_inter_n(n, i));
- fprintf(F, " %ld\n", get_irn_node_nr(get_irn_inter_n(n, i)));
- }
- }
-#endif
-
if (is_fragile_op(n)) {
fprintf(F, " pinned state: %s\n", get_op_pin_state_name(get_irn_pinned(n)));
/* not dumped: frag array */
/* This is not nice, output it as a marker in the predecessor list. */
if (is_Block(n) ||
- get_irn_op(n) == op_Phi ||
- (is_ip_Filter(n))) {
+ get_irn_op(n) == op_Phi) {
fprintf(F, " backedges:");
comma = ' ';
for (i = 0; i < get_irn_arity(n); i++)
if (get_irg_loopinfo_state(irg) & loopinfo_valid) {
ir_loop *loop = get_irn_loop(n);
if (loop != NULL) {
- fprintf(F, " in loop %d with depth %d\n",
- get_loop_loop_nr(loop), get_loop_depth(loop));
+ fprintf(F, " in loop %ld with depth %u\n",
+ get_loop_loop_nr(loop), get_loop_depth(loop));
}
}
case iro_Block: {
if (has_Block_entity(n))
fprintf(F, " Label: %lu\n", get_entity_label(get_Block_entity(n)));
- ir_fprintf(F, " macro Block: %+F\n", get_Block_MacroBlock(n));
fprintf(F, " block visited: %ld\n", get_Block_block_visited(n));
fprintf(F, " block marked: %u\n", get_Block_mark(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, " domtree 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));
}
+ if (get_irg_postdom_state(get_irn_irg(n)) != dom_none) {
+ fprintf(F, " pdom depth %d\n", get_Block_postdom_depth(n));
+ fprintf(F, " pdomtree pre num %d\n", get_Block_pdom_tree_pre_num(n));
+ fprintf(F, " max pdomsubtree pre num %d\n", get_Block_pdom_max_subtree_pre_num(n));
+ }
fprintf(F, " Execution frequency 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));
-#ifdef INTERPROCEDURAL_VIEW
- if (get_irp_loop_nesting_depth_state() != loop_nesting_depth_none)
- fprintf(F, " call frequency 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));
-#endif
/* not dumped: graph_arr */
/* not dumped: mature */
} break;
case iro_Start: {
+ size_t i;
ir_type *tp = get_entity_type(get_irg_entity(get_irn_irg(n)));
ir_fprintf(F, " start of method of type %+F\n", tp);
for (i = 0; i < get_method_n_params(tp); ++i)
ir_fprintf(F, " param %d type: %+F\n", i, get_method_param_type(tp, i));
-#ifdef INTERPROCEDURAL_VIEW
- if ((get_irp_ip_view_state() == ip_view_valid) && !get_interprocedural_view()) {
- ir_node *sbl = get_nodes_block(n);
- int i, n_cfgpreds = get_Block_cg_n_cfgpreds(sbl);
- fprintf(F, " graph has %d interprocedural predecessors:\n", n_cfgpreds);
- for (i = 0; i < n_cfgpreds; ++i) {
- ir_node *cfgpred = get_Block_cg_cfgpred(sbl, i);
- fprintf(F, " %d: Call %ld in graph %s\n", i,
- get_irn_node_nr(cfgpred),
- get_irg_dump_name(get_irn_irg(cfgpred)));
- }
- }
-#endif
} break;
case iro_Cond: {
fprintf(F, " default ProjNr: %ld\n", get_Cond_default_proj(n));
fprintf(F, " tail call\n");
ir_fprintf(F, " calling method of type %+F\n", tp);
if (get_unknown_type() != tp) {
+ size_t i;
for (i = 0; i < get_method_n_params(tp); ++i)
ir_fprintf(F, " param %d type: %+F\n", i, get_method_param_type(tp, i));
for (i = 0; i < get_method_n_ress(tp); ++i)
ir_fprintf(F, " result %d type: %+F\n", i, get_method_res_type(tp, i));
}
if (Call_has_callees(n)) {
+ size_t i;
fprintf(F, " possible callees:\n");
for (i = 0; i < get_Call_n_callees(n); i++) {
- fprintf(F, " %d: %s\n", i, get_ent_dump_name(get_Call_callee(n, i)));
- }
- }
- } break;
- case iro_CallBegin: {
- ir_node *call = get_CallBegin_call(n);
- fprintf(F, " Call: %ld\n", get_irn_node_nr(call));
- if (Call_has_callees(call)) {
- fprintf(F, " possible callees:\n");
- for (i = 0; i < get_Call_n_callees(call); i++) {
- fprintf(F, " %d: %s\n", i, get_ent_dump_name(get_Call_callee(call, i)));
+ ir_fprintf(F, " %zu: %s\n", i, get_ent_dump_name(get_Call_callee(n, i)));
}
}
} break;
case iro_Cast: {
ir_fprintf(F, " cast to type: %+F\n", get_Cast_type(n));
} break;
+ case iro_Cmp: {
+ ir_relation relation = get_Cmp_relation(n);
+ ir_fprintf(F, " relation: %s\n", get_relation_string(relation));
+ } break;
case iro_Return: {
-#ifdef INTERPROCEDURAL_VIEW
- if (!get_interprocedural_view()) {
-#endif
- ir_type *tp = get_entity_type(get_irg_entity(get_irn_irg(n)));
- ir_fprintf(F, " return in method of type %+F\n", tp);
- for (i = 0; i < get_method_n_ress(tp); ++i) {
- ir_fprintf(F, " result %d type: %+F\n", i,
- get_method_res_type(tp, i));
- }
-#ifdef INTERPROCEDURAL_VIEW
+ size_t i;
+ ir_type *tp = get_entity_type(get_irg_entity(get_irn_irg(n)));
+ ir_fprintf(F, " return in method of type %+F\n", tp);
+ for (i = 0; i < get_method_n_ress(tp); ++i) {
+ ir_fprintf(F, " result %d type: %+F\n", i,
+ get_method_res_type(tp, i));
}
-#endif
- } break;
- case iro_Const: {
- assert(get_Const_type(n) != firm_none_type);
- ir_fprintf(F, " Const of type %+F\n", get_Const_type(n));
} break;
case iro_SymConst: {
switch (get_SymConst_kind(n)) {
fprintf(F, " name: %s\n", get_enumeration_const_name(get_SymConst_enum(n)));
break;
}
- ir_fprintf(F, " type of value: %+F\n", get_SymConst_value_type(n));
} break;
case iro_Load:
fprintf(F, " mode of loaded value: %s\n", get_mode_name_ex(get_Load_mode(n), NULL));
fprintf(F, " volatility: %s\n", get_volatility_name(get_Load_volatility(n)));
- fprintf(F, " align: %s\n", get_align_name(get_Load_align(n)));
+ fprintf(F, " align: %s\n", get_align_name(get_Load_unaligned(n)));
break;
case iro_Store:
fprintf(F, " volatility: %s\n", get_volatility_name(get_Store_volatility(n)));
- fprintf(F, " align: %s\n", get_align_name(get_Store_align(n)));
+ fprintf(F, " align: %s\n", get_align_name(get_Store_unaligned(n)));
break;
case iro_Confirm:
- fprintf(F, " compare operation: %s\n", get_pnc_string(get_Confirm_cmp(n)));
+ fprintf(F, " compare operation: %s\n", get_relation_string(get_Confirm_relation(n)));
break;
case iro_ASM: {
const ir_asm_constraint *cons;
* "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)
+static void dump_node_list(FILE *F, firm_kind *k, const char *prefix,
+ size_t (*get_entity_n_nodes)(firm_kind *ent),
+ ir_node *(*get_entity_node)(firm_kind *ent, size_t pos),
+ const char *name)
{
- int i, n_nodes = get_entity_n_nodes(k);
- char *comma = "";
+ size_t i, n_nodes = get_entity_n_nodes(k);
+ const char *comma = "";
- fprintf(F, "%s %s (%d):", prefix, name, n_nodes);
+ ir_fprintf(F, "%s %s (%zu):", prefix, name, n_nodes);
for (i = 0; i < n_nodes; ++i) {
if (i > 7 && !(i & 7)) { /* line break every eight node. */
fprintf(F, ",\n%s ", prefix);
* "prefix" node8, ... node15,\n
* "prefix" node16, node17\n
*/
-static void dump_type_list(FILE *F, ir_type *tp, char *prefix,
- int (*get_n_types)(const ir_type *tp),
- ir_type *(*get_type)(const ir_type *tp, int pos),
+static void dump_type_list(FILE *F, ir_type *tp, const char *prefix,
+ size_t (*get_n_types)(const ir_type *tp),
+ ir_type *(*get_type)(const ir_type *tp, size_t pos),
const char *name)
{
- int i, n_nodes = get_n_types(tp);
- char *comma = "";
+ size_t i, n_nodes = get_n_types(tp);
+ const char *comma = "";
- fprintf(F, "%s %s (%d):", prefix, name, n_nodes);
+ ir_fprintf(F, "%s %s (%zu):", prefix, name, n_nodes);
for (i = 0; i < n_nodes; ++i) {
if (i > 7 && !(i & 7)) { /* line break every eight node. */
fprintf(F, ",\n%s ", prefix);
const ir_initializer_t *initializer,
ir_type *type)
{
- tarval *tv;
- ir_node *value;
+ ir_tarval *tv;
+ ir_node *value;
if (need_nl) {
fprintf(F, "\n%s ", prefix);
fprintf(F, " hidden_user");
}
-static void dump_entity_to_file_prefix(FILE *F, ir_entity *ent, char *prefix)
+static void dump_entity_to_file_prefix(FILE *F, ir_entity *ent, const char *prefix)
{
- int i, j;
ir_type *owner, *type;
assert(is_entity(ent));
if (is_Class_type(get_entity_owner(ent))) {
if (get_entity_n_overwrites(ent) > 0) {
+ size_t i;
fprintf(F, "%s overwrites:\n", prefix);
for (i = 0; i < get_entity_n_overwrites(ent); ++i) {
ir_entity *ov = get_entity_overwrites(ent, i);
fprintf(F, "%s Does not overwrite other entities.\n", prefix);
}
if (get_entity_n_overwrittenby(ent) > 0) {
+ size_t i;
fprintf(F, "%s overwritten by:\n", prefix);
for (i = 0; i < get_entity_n_overwrittenby(ent); ++i) {
ir_entity *ov = get_entity_overwrittenby(ent, i);
need_nl = 1;
dump_ir_initializers_to_file(F, prefix, initializer, get_entity_type(ent));
} else if (entity_has_compound_ent_values(ent)) {
+ size_t i;
fprintf(F, "%s compound values:", prefix);
for (i = 0; i < get_compound_ent_n_values(ent); ++i) {
+ size_t j;
compound_graph_path *path = get_compound_ent_value_path(ent, i);
ir_entity *ent0 = get_compound_graph_path_node(path, 0);
fprintf(F, "\n%s %3d:%u ", prefix, get_entity_offset(ent0), get_entity_offset_bits_remainder(ent0));
ir_entity *node = get_compound_graph_path_node(path, j);
fprintf(F, ".%s", get_entity_name(node));
if (is_Array_type(get_entity_owner(node)))
- fprintf(F, "[%d]", get_compound_graph_path_array_index(path, j));
+ fprintf(F, "[%ld]", get_compound_graph_path_array_index(path, j));
}
fprintf(F, "\t = ");
dump_node_opcode(F, get_compound_ent_value(ent, i));
if (is_Method_type(get_entity_type(ent))) {
if (get_entity_irg(ent)) /* can be null */ {
fprintf(F, "\n%s irg = %ld", prefix, get_irg_graph_nr(get_entity_irg(ent)));
-#ifdef INTERPROCEDURAL_VIEW
- if (get_irp_callgraph_state() == irp_callgraph_and_calltree_consistent) {
- fprintf(F, "\n%s recursion depth %d", prefix, get_irg_recursion_depth(get_entity_irg(ent)));
- fprintf(F, "\n%s loop depth %d", prefix, get_irg_loop_depth(get_entity_irg(ent)));
- }
-#endif
} else {
fprintf(F, "\n%s irg = NULL", prefix);
}
if (get_trouts_state()) {
fprintf(F, "%s Entity 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 (get_trouts_state() != outs_none) {
-#ifdef INTERPROCEDURAL_VIEW
- if (is_Method_type(get_entity_type(ent))) {
- fprintf(F, "%s Estimated #Calls: %lf\n", prefix, get_entity_estimated_n_calls(ent));
- fprintf(F, "%s Estimated #dynCalls: %lf\n", prefix, get_entity_estimated_n_calls(ent));
- } else {
- fprintf(F, "%s Estimated #Loads: %lf\n", prefix, get_entity_estimated_n_loads(ent));
- fprintf(F, "%s Estimated #Stores: %lf\n", prefix, get_entity_estimated_n_stores(ent));
- }
-#endif
- }
+ dump_node_list(F, (firm_kind *)ent, prefix, (size_t(*)(firm_kind *))get_entity_n_accesses,
+ (ir_node *(*)(firm_kind *, size_t))get_entity_access, "Accesses");
+ dump_node_list(F, (firm_kind *)ent, prefix, (size_t(*)(firm_kind *))get_entity_n_references,
+ (ir_node *(*)(firm_kind *, size_t))get_entity_reference, "References");
}
}
void dump_type_to_file(FILE *F, ir_type *tp)
{
- int i;
+ size_t i;
if ((is_Class_type(tp)) && (verbosity & dump_verbosity_noClassTypes)) return;
if ((is_Struct_type(tp)) && (verbosity & dump_verbosity_noStructTypes)) return;
case tpo_array:
if (verbosity & dump_verbosity_typeattrs) {
- int i, n_dim;
+ size_t i, n_dim;
ir_type *elem_tp = get_array_element_type(tp);
fprintf(F, "\n array ");
fprintf(F, "\n order: ");
for (i = 0; i < n_dim; ++i)
- fprintf(F, "<%d>", get_array_order(tp, i));
+ fprintf(F, "<%zu>", get_array_order(tp, i));
fprintf(F, "\n");
case tpo_method:
if (verbosity & dump_verbosity_typeattrs) {
fprintf(F, "\n variadicity: %s", get_variadicity_name(get_method_variadicity(tp)));
- fprintf(F, "\n return types: %d", get_method_n_ress(tp));
+ fprintf(F, "\n return types: %lu",
+ (unsigned long) get_method_n_ress(tp));
for (i = 0; i < get_method_n_ress(tp); ++i) {
ir_type *rtp = get_method_res_type(tp, i);
ir_fprintf(F, "\n %+F", rtp);
}
- fprintf(F, "\n parameter types: %d", get_method_n_params(tp));
+ fprintf(F, "\n parameter types: %lu",
+ (unsigned long) get_method_n_params(tp));
for (i = 0; i < get_method_n_params(tp); ++i) {
ir_type *ptp = get_method_param_type(tp, i);
ir_fprintf(F, "\n %+F", ptp);
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_node_list(F, (firm_kind *)tp, " ", (size_t(*)(firm_kind *))get_type_n_allocs,
+ (ir_node *(*)(firm_kind *, size_t))get_type_alloc, "Allocations");
+ dump_node_list(F, (firm_kind *)tp, " ", (size_t(*)(firm_kind *))get_type_n_casts,
+ (ir_node *(*)(firm_kind *, size_t))get_type_cast, "Casts");
dump_type_list(F, tp, " ", get_type_n_pointertypes_to, get_type_pointertype_to, "PointerTpsTo");
}
-
- if (verbosity & dump_verbosity_accessStats) {
-#ifdef INTERPROCEDURAL_VIEW
- if (get_trouts_state() != outs_none) {
- fprintf(F, " Estimated #Instances: %lf\n", get_type_estimated_n_instances(tp));
- if (is_Class_type(tp) && (get_irp_typeinfo_state() != ir_typeinfo_none)) {
- fprintf(F, " Estimated #dyn Calls: %lf\n", get_class_estimated_n_dyncalls(tp));
- fprintf(F, " Estimated #Upcasts: %lf (#CastOps: %d)\n", get_class_estimated_n_upcasts(tp), get_class_n_upcasts(tp));
- fprintf(F, " Estimated #Downcasts: %lf (#CastOps: %d)\n", get_class_estimated_n_downcasts(tp), get_class_n_downcasts(tp));
- assert(get_class_n_upcasts(tp) + get_class_n_downcasts(tp) == get_type_n_casts(tp));
- }
- }
-#endif
-
- }
-
fprintf(F, "\n\n");
}
void dump_types_as_text(FILE *out)
{
- int i;
- int n_types = get_irp_n_types();
+ size_t i, n_types = get_irp_n_types();
for (i = 0; i < n_types; ++i) {
ir_type *type = get_irp_type(i);
void dump_globals_as_text(FILE *out)
{
ir_type *global_type = get_glob_type();
- int n_members = get_class_n_members(global_type);
- int i;
+ size_t n_members = get_class_n_members(global_type);
+ size_t i;
for (i = 0; i < n_members; ++i) {
ir_entity *entity = get_class_member(global_type, i);