double get_type_estimated_mem_consumption_bytes(type *tp) {
assert(0);
+ return 0.0;
}
int get_type_estimated_n_fields(type *tp) {
/* ------------------------------------------------------------------------- */
static void acc_temp (type *tp) {
- assert(is_Class_type(tp));
+ int i, n_subtypes, n_members;
+ double inst;
- int i, n_subtypes = get_class_n_subtypes(tp);
+ assert(is_Class_type(tp));
/* Recursive descend. */
+ n_subtypes = get_class_n_subtypes(tp);
for (i = 0; i < n_subtypes; ++i) {
type *stp = get_class_subtype(tp, i);
if (type_not_visited(stp)) {
}
/* Deal with entity numbers. */
- int n_members = get_class_n_members(tp);
+ n_members = get_class_n_members(tp);
for (i = 0; i < n_members; ++i) {
entity *mem = get_class_member(tp, i);
double acc_loads = get_entity_estimated_n_loads (mem);
}
/* Deal with type numbers. */
- double inst = get_type_estimated_n_instances(tp);
+ inst = get_type_estimated_n_instances(tp);
for (i = 0; i < n_subtypes; ++i) {
type *stp = get_class_subtype(tp, i);
inst += get_type_acc_estimated_n_instances(stp);
int j, n_subtypes = get_class_n_subtypes(tp);
int has_unmarked_subtype = false;
for (j = 0; j < n_subtypes && !has_unmarked_subtype; ++j) {
- type *stp = get_class_subtype(tp, j);
- if (type_not_visited(stp)) has_unmarked_subtype = true;
+ type *stp = get_class_subtype(tp, j);
+ if (type_not_visited(stp)) has_unmarked_subtype = true;
}
if (!has_unmarked_subtype)
- acc_temp(tp);
+ acc_temp(tp);
}
}
*/
ir_node *transform_node_Sel(ir_node *node)
{
- entity *ent = get_Sel_entity(node);
- ir_node *new_node;
+ ir_node *new_node, *ptr;
+ type *dyn_tp;
+ entity *ent = get_Sel_entity(node);
if (get_irp_phase_state() == phase_building) return node;
}
/* If we know the dynamic type, we can replace the Sel by a constant. */
- ir_node *ptr = get_Sel_ptr(node); /* The address we select from. */
- type *dyn_tp = get_dynamic_type(ptr); /* The runtime type of ptr. */
+ ptr = get_Sel_ptr(node); /* The address we select from. */
+ dyn_tp = get_dynamic_type(ptr); /* The runtime type of ptr. */
if (dyn_tp != firm_unknown_type) {
entity *called_ent;
+ ir_node *rem_block;
/* We know which method will be called, no dispatch necessary. */
called_ent = resolve_ent_polymorphy(dyn_tp, ent);
/* called_ent may not be description: has no Address/Const to Call! */
assert(get_entity_peculiarity(called_ent) != peculiarity_description);
- ir_node *rem_block = get_cur_block();
+ rem_block = get_cur_block();
set_cur_block(get_nodes_block(node));
new_node = copy_const_value(get_atomic_ent_value(called_ent));
set_cur_block(rem_block);
*/
ir_node *transform_node_Load(ir_node *n)
{
+ ir_node *field_ptr, *new_node, *ptr;
+ entity *ent;
+ type *dyn_tp;
+
if (!(get_opt_optimize() && get_opt_dyn_meth_dispatch()))
return n;
- ir_node *field_ptr = get_Load_ptr(n);
+ field_ptr = get_Load_ptr(n);
if (get_irn_op(field_ptr) != op_Sel) return n;
- entity *ent = get_Sel_entity(field_ptr);
- ir_node *new_node;
-
+ ent = get_Sel_entity(field_ptr);
if ((get_entity_allocation(ent) != allocation_static) ||
(get_entity_variability(ent) != variability_constant) )
return n;
}
/* If we know the dynamic type, we can replace the Sel by a constant. */
- ir_node *ptr = get_Sel_ptr(field_ptr); /* The address we select from. */
- type *dyn_tp = get_dynamic_type(ptr); /* The runtime type of ptr. */
+ ptr = get_Sel_ptr(field_ptr); /* The address we select from. */
+ dyn_tp = get_dynamic_type(ptr); /* The runtime type of ptr. */
if (dyn_tp != firm_unknown_type) {
entity *loaded_ent;
return ent->val_paths[pos];
}
+/**
+ * Returns non-zero, if two compound_graph_pathes are equal
+ */
static int equal_paths(compound_graph_path *path1, int *visited_indicees, compound_graph_path *path2) {
int i;
int len1 = get_compound_graph_path_length(path1);
if (len2 > len1) return false;
for (i = 0; i < len1; i++) {
+ type *tp;
entity *node1 = get_compound_graph_path_node(path1, i);
entity *node2 = get_compound_graph_path_node(path2, i);
+
if (node1 != node2) return false;
- type *tp = get_entity_owner(node1);
+
+ tp = get_entity_owner(node1);
if (is_Array_type(tp)) {
+ long low;
+
/* Compute the index of this node. */
assert(get_array_n_dimensions(tp) == 1 && "multidim not implemented");
- long low = get_array_lower_bound_int(tp, 0);
- if (low+visited_indicees[i] < get_compound_graph_path_array_index(path2, i)) {
- visited_indicees[i]++;
- return false;
+
+ low = get_array_lower_bound_int(tp, 0);
+ if (low + visited_indicees[i] < get_compound_graph_path_array_index(path2, i)) {
+ visited_indicees[i]++;
+ return false;
} else {
- assert(low+visited_indicees[i] == get_compound_graph_path_array_index(path2, i));
+ assert(low + visited_indicees[i] == get_compound_graph_path_array_index(path2, i));
}
}
}