# include "irtypeinfo.h"
# include "irsimpletype.h"
-# include "irprog.h"
+# include "irnode_t.h"
+# include "irprog_t.h"
# include "irgwalk.h"
# include "ident.h"
m == mode_b )
return none_type;
- switch(get_irn_opcode(pred)) {
+ switch (get_irn_opcode(pred)) {
case iro_Proj: {
+ ir_node *pred_pred;
/* Deal with Start / Call here: we need to know the Proj Nr. */
assert(get_irn_mode(pred) == mode_T);
- ir_node *pred_pred = get_Proj_pred(pred);
+ pred_pred = get_Proj_pred(pred);
if (get_irn_op(pred_pred) == op_Start) {
- type *mtp = get_entity_type(get_irg_ent(get_Start_irg(pred_pred)));
+ type *mtp = get_entity_type(get_irg_entity(get_irn_irg(pred_pred)));
tp = get_method_param_type(mtp, get_Proj_proj(n));
} else if (get_irn_op(pred_pred) == op_Call) {
type *mtp = get_Call_type(pred_pred);
} break;
case iro_Start: {
/* globals and frame pointer */
- if (get_Proj_proj(n) == pns_frame_base)
- tp = find_pointer_type_to(get_irg_frame_type(get_Start_irg(pred)));
- else if (get_Proj_proj(n) == pns_globals)
+ if (get_Proj_proj(n) == pn_Start_P_frame_base)
+ tp = find_pointer_type_to(get_irg_frame_type(get_irn_irg(pred)));
+ else if (get_Proj_proj(n) == pn_Start_P_globals)
tp = find_pointer_type_to(get_glob_type());
- else if (get_Proj_proj(n) == pns_value_arg_base) {
+ else if (get_Proj_proj(n) == pn_Start_P_value_arg_base) {
VERBOSE_UNKNOWN_TYPE(("Value arg base proj %ld from Start: unknown type\n", get_irn_node_nr(n)));
- tp = unknown_type; //find_pointer_type_to(get....(get_entity_type(get_irg_ent(get_Start_irg(pred)))));
+ tp = unknown_type; /* find_pointer_type_to(get....(get_entity_type(get_irg_entity(get_irn_irg(pred))))); */
} else {
VERBOSE_UNKNOWN_TYPE(("Proj %ld %ld from Start: unknown type\n", get_Proj_proj(n), get_irn_node_nr(n)));
tp = unknown_type;
} break;
case iro_Call: {
/* value args pointer */
- if (get_Proj_proj(n) == pncl_value_res_base) {
+ if (get_Proj_proj(n) == pn_Call_P_value_res_base) {
VERBOSE_UNKNOWN_TYPE(("Value res base Proj %ld from Call: unknown type\n", get_irn_node_nr(n)));
- tp = unknown_type; //find_pointer_type_to(get....get_Call_type(pred));
+ tp = unknown_type; /* find_pointer_type_to(get....get_Call_type(pred)); */
} else {
VERBOSE_UNKNOWN_TYPE(("Proj %ld %ld from Call: unknown type\n", get_Proj_proj(n), get_irn_node_nr(n)));
tp = unknown_type;
type *tp1 = NULL, *tp2 = NULL;
ir_node *a = NULL, *b = NULL;
- //DDMN(n);
+ /* DDMN(n); */
if (is_unop(n)) {
a = get_unop_op(n);
/* has no type */
case iro_Return: {
/* Check returned type. */
+ /*
int i;
- type *meth_type = get_entity_type(get_irg_ent(current_ir_graph));
+ type *meth_type = get_entity_type(get_irg_entity(current_ir_graph));
for (i = 0; i < get_method_n_ress(meth_type); i++) {
type *res_type = get_method_res_type(meth_type, i);
type *ana_res_type = get_irn_type(get_Return_res(n, i));
- /*(
if (ana_res_type == unknown_type) continue;
if (res_type != ana_res_type && "return value has wrong type") {
- DDMN(n);
- assert(res_type == ana_res_type && "return value has wrong type");
+ DDMN(n);
+ assert(res_type == ana_res_type && "return value has wrong type");
}
- */
}
+ */
}
case iro_Block:
case iro_Start:
tp1 = compute_irn_type(get_Phi_pred(n, i));
assert(tp1 != initial_type);
if ((tp1 != phi_cycle_type) && (tp1 != none_type))
- break;
+ break;
}
/* find a second real type */
for (; (i < n_preds); ++i) {
tp2 = compute_irn_type(get_Phi_pred(n, i));
if ((tp2 == phi_cycle_type) || (tp2 == none_type)) {
- tp2 = tp1;
- continue;
+ tp2 = tp1;
+ continue;
}
if (tp2 != tp1) break;
}
- //printf("Types in Phi %s and %s \n", get_type_name(tp1), get_type_name(tp2));
+ /* printf("Types in Phi %s and %s \n", get_type_name(tp1), get_type_name(tp2)); */
if (tp1 == tp2) { tp = tp1; break; }
VERBOSE_UNKNOWN_TYPE(("Phi %ld with two different types: %s, %s: unknown type.\n", get_irn_node_nr(n),
- get_type_name(tp1), get_type_name(tp2)));
+ get_type_name(tp1), get_type_name(tp2)));
tp = unknown_type;
} break;
case iro_Load: {
ir_node *a = get_Load_ptr(n);
if (get_irn_op(a) == op_Sel)
tp = get_entity_type(get_Sel_entity(a));
- else if ((get_irn_op(a) == op_Const) &&
- (tarval_is_entity(get_Const_tarval(a))))
- tp = get_entity_type(tarval_to_entity(get_Const_tarval(a)));
else if (is_pointer_type(compute_irn_type(a))) {
tp = get_pointer_points_to_type(get_irn_type(a));
if (is_array_type(tp)) tp = get_array_element_type(tp);
/* catch special cases with fallthrough to binop/unop cases in default. */
case iro_Sub: {
if (mode_is_int(get_irn_mode(n)) &&
- mode_is_reference(get_irn_mode(a)) &&
- mode_is_reference(get_irn_mode(b)) ) {
+ mode_is_reference(get_irn_mode(a)) &&
+ mode_is_reference(get_irn_mode(b)) ) {
VERBOSE_UNKNOWN_TYPE(("Sub %ld ptr - ptr = int: unknown type\n", get_irn_node_nr(n)));
tp = unknown_type; break;
}
} /* fall through to Add. */
case iro_Add: {
if (mode_is_reference(get_irn_mode(n)) &&
- mode_is_reference(get_irn_mode(a)) &&
- mode_is_int(get_irn_mode(b)) ) {
+ mode_is_reference(get_irn_mode(a)) &&
+ mode_is_int(get_irn_mode(b)) ) {
tp = tp1; break;
}
if (mode_is_reference(get_irn_mode(n)) &&
- mode_is_int(get_irn_mode(a)) &&
- mode_is_reference(get_irn_mode(b)) ) {
+ mode_is_int(get_irn_mode(a)) &&
+ mode_is_reference(get_irn_mode(b)) ) {
tp = tp2; break;
}
goto default_code;
if (is_binop(n)) {
if (tp1 == tp2) {
- tp = tp1;
- break;
+ tp = tp1;
+ break;
}
if((tp1 == phi_cycle_type) || (tp2 == phi_cycle_type)) {
- tp = phi_cycle_type;
- break;
+ tp = phi_cycle_type;
+ break;
}
VERBOSE_UNKNOWN_TYPE(("Binop %ld with two different types: %s, %s: unknown type \n", get_irn_node_nr(n),
- get_type_name(tp1), get_type_name(tp2)));
+ get_type_name(tp1), get_type_name(tp2)));
tp = unknown_type;
break;
}
} break; /* default */
} /* end switch */
- //printf (" found %s ", get_type_name(tp)); DDM;
+ /* printf (" found %s ", get_type_name(tp)); DDM; */
return tp;
}
static type* compute_irn_type(ir_node *n) {
- //DDMN(n);
+ /* DDMN(n); */
type *tp = get_irn_type(n);
set_irn_type(n, tp);
}
- //printf (" found %s ", get_type_name(tp)); DDM;
+ /* printf (" found %s ", get_type_name(tp)); DDM; */
return tp;
}
type *tp = get_irn_type(n);
if (tp == phi_cycle_type) {
- //printf(" recomputing for phi_cycle_type "); DDMN(n);
+ /* printf(" recomputing for phi_cycle_type "); DDMN(n); */
set_irn_type(n, initial_type);
}