Commit 174de862 authored by Götz Lindenmaier's avatar Götz Lindenmaier
Browse files

Call_calleesl now with unknown entity instead of NULL.

[r4341]
parent 3bcbfec3
......@@ -82,7 +82,7 @@ static void caller_init(int arr_length, entity ** free_methods) {
if (get_irn_op(call) != op_Call) continue;
for (j = get_Call_n_callees(call) - 1; j >= 0; --j) {
entity * ent = get_Call_callee(call, j);
if (ent) {
if (ent != unknown_entity) {
irg_data_t * data = get_entity_link(ent);
# ifndef CATE_jni
assert(get_entity_irg(ent) && data);
......@@ -621,7 +621,7 @@ static void construct_call(ir_node * call) {
/* Wiederverwendete Daten initialisieren. */
for (i = 0; i < n_callees; ++i) {
callees[i] = get_Call_callee(call, i);
irgs[i] = callees[i] ? get_entity_irg(callees[i]) : NULL;
irgs[i] = get_entity_irg(callees[i]);
data[i] = get_entity_link(callees[i]);
}
......@@ -685,14 +685,14 @@ static void construct_call(ir_node * call) {
for (i = 0; i < n_callees; ++i) {
entity * callee = get_Call_callee(call, i);
if (data[i]) { /* explicit */
if (data[i]->except) {
in[i] = new_r_Proj(get_entity_irg(callee), get_nodes_block(data[i]->except),
data[i]->except, mode_X, data[i]->count);
} else {
in[i] = new_Bad();
}
if (data[i]->except) {
in[i] = new_r_Proj(get_entity_irg(callee), get_nodes_block(data[i]->except),
data[i]->except, mode_X, data[i]->count);
} else {
in[i] = new_Bad();
}
} else { /* unknown */
in[i] = get_cg_Unknown(mode_X);
in[i] = get_cg_Unknown(mode_X);
}
}
......@@ -824,7 +824,7 @@ void cg_construct(int arr_len, entity ** free_methods_arr) {
for (node = get_irn_link(get_irg_end(current_ir_graph)); node; node = get_irn_link(node)) {
if (get_irn_op(node) == op_Call) {
n_callees = get_Call_n_callees(node);
if (n_callees > 1 || (n_callees == 1 && get_Call_callee(node, 0) != NULL)) {
if (n_callees > 1 || (n_callees == 1 && get_Call_callee(node, 0) != unknown_entity)) {
construct_call(node);
}
}
......
......@@ -89,7 +89,7 @@ void gc_irgs(int n_keep, entity ** keep_arr) {
assert(get_irn_op(node) == op_Call);
for (i = get_Call_n_callees(node) - 1; i >= 0; --i) {
entity * ent = get_Call_callee(node, i);
if (ent && get_entity_irg(ent) && get_entity_link(ent) != MARK) {
if (get_entity_irg(ent) && get_entity_link(ent) != MARK) {
set_entity_link(ent, MARK);
ARR_APP1(entity *, marked, ent);
if (get_opt_dead_method_elimination_verbose() && get_firm_verbosity() > 2) {
......
......@@ -24,6 +24,7 @@
#include "irop_t.h"
#include "irdump.h"
#include "irdump_t.h"
#include "irgwalk.h"
#include "typewalk.h"
......@@ -49,67 +50,6 @@ typedef unsigned long SeqNo;
SeqNo get_Block_seqno(ir_node *n);
#endif
/* Attributes of nodes */
#define PRINT_DEFAULT_NODE_ATTR
#define DEFAULT_NODE_ATTR " "
#define DEFAULT_TYPE_ATTRIBUTE " "
#define DEFAULT_ENUM_ITEM_ATTRIBUTE " "
/* Attributes of edges between Firm nodes */
#define INTRA_DATA_EDGE_ATTR "class:1 priority:50"
#define INTER_DATA_EDGE_ATTR "class:16 priority:10"
#define BLOCK_EDGE_ATTR "class:2 priority:50 linestyle:dotted"
#define CF_EDGE_ATTR "class:13 priority:60 color:red"
#define INTRA_MEM_EDGE_ATTR "class:14 priority:50 color:blue"
#define INTER_MEM_EDGE_ATTR "class:17 priority:10 color:blue"
#define DOMINATOR_EDGE_ATTR "class:15 color:red"
#define BACK_EDGE_ATTR "linestyle:dashed "
/* Attributes of edges between Firm nodes and type/entity nodes */
#define NODE2TYPE_EDGE_ATTR "class:2 priority:2 linestyle:dotted"
/* Attributes of edges in type/entity graphs. */
#define TYPE_METH_NODE_ATTR "color: lightyellow"
#define TYPE_CLASS_NODE_ATTR "color: green"
#define TYPE_DESCRIPTION_NODE_ATTR "color: lightgreen"
#define ENTITY_NODE_ATTR "color: yellow"
#define ENT_TYPE_EDGE_ATTR "class: 3 label: \"type\" color: red"
#define ENT_OWN_EDGE_ATTR "class: 4 label: \"owner\" color: black"
#define METH_PAR_EDGE_ATTR "class: 5 label: \"param %d\" color: green"
#define METH_RES_EDGE_ATTR "class: 6 label: \"res %d\" color: green"
#define TYPE_SUPER_EDGE_ATTR "class: 7 label: \"supertype\" color: red"
#define UNION_EDGE_ATTR "class: 8 label: \"component\" color: blue"
#define PTR_PTS_TO_EDGE_ATTR "class: 9 label: \"points to\" color:green"
#define ARR_ELT_TYPE_EDGE_ATTR "class: 10 label: \"arr elt tp\" color:green"
#define ARR_ENT_EDGE_ATTR "class: 10 label: \"arr ent\" color: green"
#define ENT_OVERWRITES_EDGE_ATTR "class: 11 label: \"overwrites\" color:red"
#define ENT_VALUE_EDGE_ATTR "label: \"value %d\""
#define ENT_CORR_EDGE_ATTR "label: \"value %d corresponds to \" "
#define TYPE_MEMBER_EDGE_ATTR "class: 12 label: \"member\" color:blue"
#define ENUM_ITEM_NODE_ATTR "color: green"
#define CALLGRAPH_EDGE_ATTR "calls"
#if DEBUG_libfirm && NODEID_AS_LABEL
#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_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))
#define PRINT_LOOPID(X) fprintf(F, "l%d", get_loop_loop_nr(X))
#define PRINT_ITEMID(X,Y) fprintf(F, "i%ldT%d", get_type_nr(X), (Y))
#else
#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_IRGID(X) fprintf(F, "g%p",(void *)(X))
#define PRINT_CONSTID(X,Y) fprintf(F, "\"n%pn%p\"", (void*)(X), (void*)(Y))
#define PRINT_LOOPID(X) fprintf(F, "l%p", (void *)(X))
#define PRINT_ITEMID(X,Y) fprintf(F, "i%pT%d", (void *) (X), (Y))
#endif
/* basis for a color range for vcg */
static int n_colors = 0;
static int base_color = 0;
......@@ -293,7 +233,7 @@ static int node_floats(ir_node *n) {
}
const char *get_ent_dump_name(entity *ent) {
if (! ent)
if (!ent)
return "<NULL entity>";
/* Don't use get_entity_ld_ident (ent) as it computes the mangled name! */
if (ent->ld_name) return get_id_str(ent->ld_name);
......@@ -753,11 +693,7 @@ static INLINE int dump_node_info(FILE *F, ir_node *n)
if (Call_has_callees(n)) {
fprintf(F, "possible callees: \n");
for (i = 0; i < get_Call_n_callees(n); i++) {
if (!get_Call_callee(n, i)) {
fprintf(F, " %d external method\n", i);
} else {
fprintf(F, " %d: %s\n", i, get_ent_dump_name(get_Call_callee(n, i)));
}
fprintf(F, " %d: %s\n", i, get_ent_dump_name(get_Call_callee(n, i)));
}
}
} break;
......@@ -766,11 +702,7 @@ static INLINE int dump_node_info(FILE *F, ir_node *n)
if (Call_has_callees(call)) {
fprintf(F, "possible callees: \n");
for (i = 0; i < get_Call_n_callees(call); i++) {
if (!get_Call_callee(call, i)) {
fprintf(F, " %d external method\n", i);
} else {
fprintf(F, " %d: %s\n", i, get_ent_dump_name(get_Call_callee(call, i)));
}
fprintf(F, " %d: %s\n", i, get_ent_dump_name(get_Call_callee(call, i)));
}
}
} break;
......@@ -1695,8 +1627,7 @@ void dump_loop_nodes_into_graph(FILE *F, ir_graph *irg) {
/**
* dumps the VCG header
*/
static INLINE void
dump_vcg_header(FILE *F, const char *name, const char *orientation) {
INLINE void dump_vcg_header(FILE *F, const char *name, const char *orientation) {
char *label;
if (edge_label) {
......@@ -1719,6 +1650,7 @@ dump_vcg_header(FILE *F, const char *name, const char *orientation) {
"classname 16: \"interblock Data\"\n"
"classname 2: \"Block\"\n"
"classname 13: \"Control Flow\"\n"
"classname 18: \"Exception Control Flow for Interval Analysis\"\n"
"classname 14: \"intrablock Memory\"\n"
"classname 17: \"interblock Memory\"\n"
"classname 15: \"Dominators\"\n"
......@@ -1779,7 +1711,7 @@ dump_vcg_header(FILE *F, const char *name, const char *orientation) {
* @param suffix1 first filename suffix
* @param suffix2 second filename suffix
*/
static FILE *vcg_open (ir_graph *irg, const char * suffix1, const char *suffix2) {
FILE *vcg_open (ir_graph *irg, const char * suffix1, const char *suffix2) {
FILE *F;
const char *nm = get_irg_dump_name(irg);
int len = strlen(nm), i, j;
......@@ -1863,8 +1795,7 @@ static INLINE void dump_vcg_footer (FILE *F) {
/**
* close the vcg file
*/
static void
vcg_close (FILE *F) {
void vcg_close (FILE *F) {
dump_vcg_footer(F); /* print footer */
fclose (F); /* close vcg file */
}
......
#ifndef __IRDUMPT_T_H__
#define __IRDUMPT_T_H__
#include "firm_common_t.h"
/* Attributes of nodes */
#define PRINT_DEFAULT_NODE_ATTR
#define DEFAULT_NODE_ATTR " "
#define DEFAULT_TYPE_ATTRIBUTE " "
#define DEFAULT_ENUM_ITEM_ATTRIBUTE " "
/* Attributes of edges between Firm nodes */
#define INTRA_DATA_EDGE_ATTR "class:1 priority:50"
#define INTER_DATA_EDGE_ATTR "class:16 priority:10"
#define BLOCK_EDGE_ATTR "class:2 priority:50 linestyle:dotted"
#define CF_EDGE_ATTR "class:13 priority:60 color:red"
#define EXC_CF_EDGE_ATTR "class:18 priority:60 color:blue"
#define INTRA_MEM_EDGE_ATTR "class:14 priority:50 color:blue"
#define INTER_MEM_EDGE_ATTR "class:17 priority:10 color:blue"
#define DOMINATOR_EDGE_ATTR "class:15 color:red"
#define BACK_EDGE_ATTR "linestyle:dashed "
/* Attributes of edges between Firm nodes and type/entity nodes */
#define NODE2TYPE_EDGE_ATTR "class:2 priority:2 linestyle:dotted"
/* Attributes of edges in type/entity graphs. */
#define TYPE_METH_NODE_ATTR "color: lightyellow"
#define TYPE_CLASS_NODE_ATTR "color: green"
#define TYPE_DESCRIPTION_NODE_ATTR "color: lightgreen"
#define ENTITY_NODE_ATTR "color: yellow"
#define ENT_TYPE_EDGE_ATTR "class: 3 label: \"type\" color: red"
#define ENT_OWN_EDGE_ATTR "class: 4 label: \"owner\" color: black"
#define METH_PAR_EDGE_ATTR "class: 5 label: \"param %d\" color: green"
#define METH_RES_EDGE_ATTR "class: 6 label: \"res %d\" color: green"
#define TYPE_SUPER_EDGE_ATTR "class: 7 label: \"supertype\" color: red"
#define UNION_EDGE_ATTR "class: 8 label: \"component\" color: blue"
#define PTR_PTS_TO_EDGE_ATTR "class: 9 label: \"points to\" color:green"
#define ARR_ELT_TYPE_EDGE_ATTR "class: 10 label: \"arr elt tp\" color:green"
#define ARR_ENT_EDGE_ATTR "class: 10 label: \"arr ent\" color: green"
#define ENT_OVERWRITES_EDGE_ATTR "class: 11 label: \"overwrites\" color:red"
#define ENT_VALUE_EDGE_ATTR "label: \"value %d\""
#define ENT_CORR_EDGE_ATTR "label: \"value %d corresponds to \" "
#define TYPE_MEMBER_EDGE_ATTR "class: 12 label: \"member\" color:blue"
#define ENUM_ITEM_NODE_ATTR "color: green"
#define CALLGRAPH_EDGE_ATTR "calls"
#if DEBUG_libfirm && NODEID_AS_LABEL
#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_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))
#define PRINT_LOOPID(X) fprintf(F, "l%d", get_loop_loop_nr(X))
#define PRINT_ITEMID(X,Y) fprintf(F, "i%ldT%d", get_type_nr(X), (Y))
#else
#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_IRGID(X) fprintf(F, "g%p",(void *)(X))
#define PRINT_CONSTID(X,Y) fprintf(F, "\"n%pn%p\"", (void*)(X), (void*)(Y))
#define PRINT_LOOPID(X) fprintf(F, "l%p", (void *)(X))
#define PRINT_ITEMID(X,Y) fprintf(F, "i%pT%d", (void *) (X), (Y))
#endif
extern int dump_dominator_information_flag;
extern const char *dump_file_filter;
FILE *vcg_open (ir_graph *irg, const char * suffix1, const char *suffix2);
void dump_vcg_header(FILE *F, const char *name, const char *orientation);
const char *get_irg_dump_name(ir_graph *irg);
void vcg_close (FILE *F);
#endif /* __IRDUMPT_T_H__ */
......@@ -111,7 +111,7 @@ static void collect_irgs(ir_node * node, eset * irg_set) {
int i;
for (i = get_Call_n_callees(node) - 1; i >= 0; --i) {
entity * ent = get_Call_callee(node, i);
ir_graph * irg = ent ? get_entity_irg(ent) : NULL;
ir_graph * irg = get_entity_irg(ent);
if (irg && !eset_contains(irg_set, irg)) {
eset_insert(irg_set, irg);
irg_walk_graph(irg, (irg_walk_func *) collect_irgs, NULL, irg_set);
......@@ -480,9 +480,9 @@ static void walk_entity(entity *ent, void *env)
irg_walk(get_atomic_ent_value(ent), my_env->pre, my_env->post, my_env->env);
}
else {
int i, n = get_compound_ent_n_values(ent);
int i, n_vals = get_compound_ent_n_values(ent);
for (i = 0; i < n; i++)
for (i = 0; i < n_vals; i++)
irg_walk(get_compound_ent_value(ent, i), my_env->pre, my_env->post, my_env->env);
}
}
......@@ -513,11 +513,11 @@ void walk_const_code(irg_walk_func *pre, irg_walk_func *post, void *env) {
type *tp = get_irp_type(i);
if (is_array_type(tp)) {
for (j = 0; j < get_array_n_dimensions(tp); j++) {
ir_node *n;
n = get_array_lower_bound(tp, j);
if (n) irg_walk(n, pre, post, env);
n = get_array_upper_bound(tp, j);
if (n) irg_walk(n, pre, post, env);
ir_node *n;
n = get_array_lower_bound(tp, j);
if (n) irg_walk(n, pre, post, env);
n = get_array_upper_bound(tp, j);
if (n) irg_walk(n, pre, post, env);
}
}
}
......
......@@ -566,9 +566,8 @@ get_Block_n_cfgpreds (ir_node *node) {
ir_node *
get_Block_cfgpred (ir_node *node, int pos) {
assert(node);
assert (node->op == op_Block);
assert(-1 <= pos && pos < get_irn_arity(node));
assert(node->op == op_Block);
return get_irn_n(node, pos);
}
......
......@@ -36,7 +36,8 @@
#define ASSERT_AND_RET(expr, string, ret) \
do { \
if (opt_do_node_verification == NODE_VERIFICATION_ON) {\
if (!(expr)) dump_ir_block_graph(current_ir_graph, "-assert"); \
if (!(expr) && current_ir_graph != get_const_code_irg()) \
dump_ir_block_graph(current_ir_graph, "-assert"); \
assert((expr) && string); } \
if (!(expr)) { \
if (opt_do_node_verification == NODE_VERIFICATION_REPORT) \
......@@ -324,6 +325,7 @@ vrfy_Proj_proj(ir_node *p, ir_graph *irg) {
"wrong Proj from Call", 0,
show_proj_failure(p);
);
break;
case iro_FuncCall:
......@@ -492,6 +494,7 @@ vrfy_Proj_proj(ir_node *p, ir_graph *irg) {
ASSERT_AND_RET(
(mode == get_type_mode(get_method_res_type(mt, proj))),
"Mode of Proj from Call doesn't match mode of result type.", 0);
}
break;
......@@ -774,24 +777,32 @@ int irn_vrfy_irg(ir_node *n, ir_graph *irg)
}
for (i = 0; i < get_method_n_params(mt); i++) {
type *t = get_method_param_type(mt, i);
type *t = get_method_param_type(mt, i);
if (is_atomic_type(t)) {
ASSERT_AND_RET_DBG(
get_irn_mode(get_Call_param(n, i)) == get_type_mode(t),
"Mode of arg for Call doesn't match mode of arg type.", 0,
show_call_param(n, mt);
);
}
else {
/* call with a compound type, mode must be reference */
ASSERT_AND_RET_DBG(
mode_is_reference(get_irn_mode(get_Call_param(n, i))),
"Mode of arg for Call doesn't match mode of arg type.", 0,
show_call_param(n, mt);
);
}
if (is_atomic_type(t)) {
ASSERT_AND_RET_DBG(
get_irn_mode(get_Call_param(n, i)) == get_type_mode(t),
"Mode of arg for Call doesn't match mode of arg type.", 0,
show_call_param(n, mt);
);
}
else {
/* call with a compound type, mode must be reference */
ASSERT_AND_RET_DBG(
mode_is_reference(get_irn_mode(get_Call_param(n, i))),
"Mode of arg for Call doesn't match mode of arg type.", 0,
show_call_param(n, mt);
);
}
}
#if 0
if (Call_has_callees(n)) {
for (i = 0; i < get_Call_n_callees(n); i++) {
ASSERT_AND_RET(is_entity(get_Call_callee(n, i)), "callee array must contain entities.", 0);
}
}
#endif
break;
case iro_Add:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment