for (i = 0; i < n; ++i) {
int offset = get_compound_ent_value_offset_bytes(ent, i);
int bits_remainder = get_compound_ent_value_offset_bit_remainder(ent, i);
- const compound_graph_path *path = get_compound_ent_value_path(ent, i);
- int path_len = get_compound_graph_path_length(path);
- ir_entity *last_ent = get_compound_graph_path_node(path, path_len - 1);
- int value_len = get_type_size_bits(get_entity_type(last_ent));
+ ir_node *value = get_compound_ent_value(ent, i);
+ int value_len = get_mode_size_bits(get_irn_mode(value));
offset += (value_len + bits_remainder + 7) >> 3;
/* collect the values and store them at the offsets */
for (i = 0; i < n; ++i) {
- const compound_graph_path *path = get_compound_ent_value_path(ent, i);
- int path_len = get_compound_graph_path_length(path);
int offset = get_compound_ent_value_offset_bytes(ent, i);
int offset_bits = get_compound_ent_value_offset_bit_remainder(ent, i);
- ir_node *value = get_compound_ent_value(ent, i);
- ir_entity *last_ent = get_compound_graph_path_node(path, path_len - 1);
- int value_len = get_type_size_bits(get_entity_type(last_ent));
+ ir_node *value = get_compound_ent_value(ent, i);
+ int value_len = get_mode_size_bits(get_irn_mode(value));
assert(offset >= 0);
assert(offset_bits >= 0);
assert(get_type_state(get_entity_type(ent)) == layout_fixed);
- path = get_compound_ent_value_path(ent, pos);
+ path = get_compound_ent_value_path(ent, pos);
path_len = get_compound_graph_path_length(path);
- curr_tp = path->tp;
+ curr_tp = path->tp;
for (i = 0; i < path_len; ++i) {
- ir_entity *node = get_compound_graph_path_node(path, i);
- ir_type *node_tp = get_entity_type(node);
-
if (is_Array_type(curr_tp)) {
- int size = get_type_size_bits(node_tp);
- int align = get_type_alignment_bits(node_tp);
- int idx;
+ ir_type *elem_type = get_array_element_type(curr_tp);
+ int size = get_type_size_bits(elem_type);
+ int align = get_type_alignment_bits(elem_type);
+ int idx;
assert(size > 0);
if(size % align > 0) {
idx = get_compound_graph_path_array_index(path, i);
assert(idx >= 0);
offset += size * idx;
+ curr_tp = elem_type;
} else {
+ ir_entity *node = get_compound_graph_path_node(path, i);
offset += get_entity_offset(node);
+ curr_tp = get_entity_type(node);
}
- curr_tp = node_tp;
}
return offset;
assert(get_type_state(get_entity_type(ent)) == layout_fixed);
- path = get_compound_ent_value_path(ent, pos);
- path_len = get_compound_graph_path_length(path);
+ path = get_compound_ent_value_path(ent, pos);
+ path_len = get_compound_graph_path_length(path);
last_node = get_compound_graph_path_node(path, path_len - 1);
+ if(last_node == NULL)
+ return 0;
+
return get_entity_offset_bits_remainder(last_node);
} /* get_compound_ent_value_offset_bit_remainder */