Commit 4ebc4b64 authored by Michael Beck's avatar Michael Beck
Browse files

size/aligment of types is now unsigned and in bytes, this fixes fehler095.c (array to big)

[r16860]
parent 7d6fbaca
......@@ -531,7 +531,7 @@ void set_array_entity_values(ir_entity *ent, tarval **values, int num_vals);
* @param ent Any entity of compound type with at least pos initialization values.
* @param pos The position of the value for which the offset is requested.
*/
int get_compound_ent_value_offset_bit_remainder(ir_entity *ent, int pos);
unsigned get_compound_ent_value_offset_bit_remainder(ir_entity *ent, int pos);
/** Return the overall offset of value at position pos in bytes.
*
......@@ -541,7 +541,7 @@ int get_compound_ent_value_offset_bit_remainder(ir_entity *ent, int pos);
* @param ent Any entity of compound type with at least pos initialization values.
* @param pos The position of the value for which the offset is requested.
*/
int get_compound_ent_value_offset_bytes(ir_entity *ent, int pos);
unsigned get_compound_ent_value_offset_bytes(ir_entity *ent, int pos);
/* --- Fields of entities with a class type as owner --- */
/* Overwrites is a field that specifies that an access to the overwritten
......@@ -1331,32 +1331,21 @@ ir_mode *get_type_mode(const ir_type *tp);
*/
void set_type_mode(ir_type *tp, ir_mode* m);
/** Returns the size of a type in bytes, returns -1 if the size is NOT
* a byte size, i.e. not dividable by 8. */
int get_type_size_bytes(const ir_type *tp);
/** Returns the size of a type in bits. */
int get_type_size_bits(const ir_type *tp);
/** Returns the size of a type in bytes. */
unsigned get_type_size_bytes(const ir_type *tp);
/** Sets the size of a type in bytes.
*
* For primitive, enumeration, pointer and method types the size
* is always fixed. This call is legal but has no effect.
*/
void set_type_size_bytes(ir_type *tp, int size);
/** Sets the size of a type in bits.
*
* For primitive, enumeration, pointer and method types the size
* is always fixed. This call is legal but has no effect.
*/
void set_type_size_bits(ir_type *tp, int size);
void set_type_size_bytes(ir_type *tp, unsigned size);
/** Returns the alignment of a type in bytes.
*
* Returns -1 if the alignment is NOT
* a byte size, i.e. not dividable by 8. Calls get_type_alignment_bits(). */
int get_type_alignment_bytes(ir_type *tp);
unsigned get_type_alignment_bytes(ir_type *tp);
/** Returns the alignment of a type in bits.
*
......@@ -1366,19 +1355,9 @@ int get_type_alignment_bytes(ir_type *tp);
* -#.) compound types have the alignment of there biggest member.
* -#.) array types have the alignment of there element type.
* -#.) method types return 0 here.
* -#.) all other types return 8 here (i.e. aligned at byte).
*/
int get_type_alignment_bits(ir_type *tp);
/** Sets the alignment of a type in bytes. */
void set_type_alignment_bytes(ir_type *tp, int size);
/** Sets the alignment of a type in bits.
*
* For method types the alignment is always fixed.
* This call is legal but has no effect.
* -#.) all other types return 1 here (i.e. aligned at byte).
*/
void set_type_alignment_bits(ir_type *tp, int size);
void set_type_alignment_bytes(ir_type *tp, unsigned align);
/** Returns the visited count of a type. */
unsigned long get_type_visited(const ir_type *tp);
......@@ -2399,7 +2378,7 @@ ir_type *get_associated_type(const ir_type *tp);
*
* @return the entity representing the area
*/
ir_entity *frame_alloc_area(ir_type *frame_type, int size, int alignment, int at_start);
ir_entity *frame_alloc_area(ir_type *frame_type, int size, unsigned alignment, int at_start);
/*-----------------------------------------------------------------*/
/** Debug aides **/
......
......@@ -1576,7 +1576,7 @@ static void fix_address_of_parameter_access(be_abi_irg_t *env, ir_entity *value_
ir_node *frame, *imem, *nmem, *store, *mem, *args, *args_bl;
const ir_edge_t *edge;
optimization_state_t state;
int offset;
unsigned offset;
foreach_block_succ(start_bl, edge) {
ir_node *succ = get_edge_src_irn(edge);
......@@ -1630,11 +1630,11 @@ static void fix_address_of_parameter_access(be_abi_irg_t *env, ir_entity *value_
frame_tp = get_irg_frame_type(irg);
offset = get_type_size_bytes(frame_tp);
for (ent = new_list; ent; ent = get_entity_link(ent)) {
ir_type *tp = get_entity_type(ent);
int align = get_type_alignment_bytes(tp);
ir_type *tp = get_entity_type(ent);
unsigned align = get_type_alignment_bytes(tp);
offset += align - 1;
offset &= -align;
offset &= ~(align - 1);
set_entity_owner(ent, frame_tp);
add_class_member(frame_tp, ent);
/* must be automatic to set a fixed layout */
......@@ -2211,10 +2211,10 @@ static int process_stack_bias(be_abi_irg_t *env, ir_node *bl, int bias)
if(be_is_IncSP(irn)) {
if(ofs == BE_STACK_FRAME_SIZE_EXPAND) {
ofs = get_type_size_bytes(get_irg_frame_type(env->birg->irg));
ofs = (int)get_type_size_bytes(get_irg_frame_type(env->birg->irg));
be_set_IncSP_offset(irn, ofs);
} else if(ofs == BE_STACK_FRAME_SIZE_SHRINK) {
ofs = - get_type_size_bytes(get_irg_frame_type(env->birg->irg));
ofs = - (int)get_type_size_bytes(get_irg_frame_type(env->birg->irg));
be_set_IncSP_offset(irn, ofs);
}
}
......
......@@ -294,11 +294,11 @@ static void do_dump_atomic_init(be_gas_decl_env_t *env, obstack_t *obst,
break;
case symconst_type_size:
obstack_printf(obst, "%d", get_type_size_bytes(get_SymConst_type(init)));
obstack_printf(obst, "%u", get_type_size_bytes(get_SymConst_type(init)));
break;
case symconst_type_align:
obstack_printf(obst, "%d", get_type_alignment_bytes(get_SymConst_type(init)));
obstack_printf(obst, "%u", get_type_alignment_bytes(get_SymConst_type(init)));
break;
case symconst_enum_const:
......@@ -519,17 +519,17 @@ static void dump_compound_init(be_gas_decl_env_t *env, obstack_t *obst,
{
normal_or_bitfield *vals;
int i, j, n = get_compound_ent_n_values(ent);
int last_ofs;
unsigned k, last_ofs;
/* Find the initializer size. Sorrily gcc support a nasty feature:
The last field of a compound may be a flexible array. This allows
initializers bigger than the type size. */
last_ofs = get_type_size_bytes(get_entity_type(ent));
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);
ir_node *value = get_compound_ent_value(ent, i);
int value_len = get_mode_size_bits(get_irn_mode(value));
unsigned offset = get_compound_ent_value_offset_bytes(ent, i);
unsigned bits_remainder = get_compound_ent_value_offset_bit_remainder(ent, i);
ir_node *value = get_compound_ent_value(ent, i);
unsigned value_len = get_mode_size_bits(get_irn_mode(value));
offset += (value_len + bits_remainder + 7) >> 3;
......@@ -546,33 +546,33 @@ static void dump_compound_init(be_gas_decl_env_t *env, obstack_t *obst,
/* collect the values and store them at the offsets */
for (i = 0; i < n; ++i) {
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);
int value_len = get_mode_size_bits(get_irn_mode(value));
assert(offset >= 0);
unsigned 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);
int value_len = get_mode_size_bits(get_irn_mode(value));
assert(offset_bits >= 0);
if (offset_bits != 0 ||
(value_len != 8 && value_len != 16 && value_len != 32 && value_len != 64)) {
tarval *tv = get_atomic_init_tv(value);
unsigned char curr_bits, last_bits = 0;
unsigned char curr_bits, last_bits = 0;
if (tv == NULL) {
panic("Couldn't get numeric value for bitfield initializer '%s'\n",
get_entity_ld_name(ent));
}
/* normalize offset */
offset += offset_bits >> 3;
offset_bits &= 7;
/* normalize offset */
offset += offset_bits >> 3;
offset_bits &= 7;
for (j = 0; value_len + offset_bits > 0; ++j) {
assert(offset + j < last_ofs);
assert(vals[offset + j].kind == BITFIELD || vals[offset + j].v.value == NULL);
vals[offset + j].kind = BITFIELD;
curr_bits = get_tarval_sub_bits(tv, j);
curr_bits = get_tarval_sub_bits(tv, j);
vals[offset + j].v.bf_val |= (last_bits >> (8 - offset_bits)) | (curr_bits << offset_bits);
value_len -= 8;
last_bits = curr_bits;
last_bits = curr_bits;
}
} else {
int i;
......@@ -587,24 +587,24 @@ static void dump_compound_init(be_gas_decl_env_t *env, obstack_t *obst,
}
/* now write them sorted */
for (i = 0; i < last_ofs; ) {
for (k = 0; k < last_ofs; ) {
int space = 0, skip = 0;
if (vals[i].kind == NORMAL) {
if(vals[i].v.value != NULL) {
dump_atomic_init(env, obst, vals[i].v.value);
skip = get_mode_size_bytes(get_irn_mode(vals[i].v.value)) - 1;
if (vals[k].kind == NORMAL) {
if(vals[k].v.value != NULL) {
dump_atomic_init(env, obst, vals[k].v.value);
skip = get_mode_size_bytes(get_irn_mode(vals[k].v.value)) - 1;
} else {
space = 1;
}
} else {
assert(vals[i].kind == BITFIELD);
obstack_printf(obst, "\t.byte\t%d\n", vals[i].v.bf_val);
assert(vals[k].kind == BITFIELD);
obstack_printf(obst, "\t.byte\t%d\n", vals[k].v.bf_val);
}
++i;
while (i < last_ofs && vals[i].kind == NORMAL && vals[i].v.value == NULL) {
++k;
while (k < last_ofs && vals[k].kind == NORMAL && vals[k].v.value == NULL) {
++space;
++i;
++k;
}
space -= skip;
assert(space >= 0);
......@@ -628,7 +628,7 @@ static void dump_global(be_gas_decl_env_t *env, ir_entity *ent, int emit_commons
obstack_t *obst;
ir_type *type = get_entity_type(ent);
const char *ld_name = get_entity_ld_name(ent);
int align = get_type_alignment_bytes(type);
unsigned align = get_type_alignment_bytes(type);
int emit_as_common = 0;
ir_variability variability;
ir_visibility visibility;
......@@ -637,7 +637,7 @@ static void dump_global(be_gas_decl_env_t *env, ir_entity *ent, int emit_commons
if (is_Method_type(type)) {
if (get_method_img_section(ent) == section_constructors) {
obst = env->ctor_obst;
obstack_printf(obst, ".balign\t%d\n", align);
obstack_printf(obst, ".balign\t%u\n", align);
dump_size_type(obst, align);
obstack_printf(obst, "%s\n", ld_name);
}
......@@ -668,7 +668,7 @@ static void dump_global(be_gas_decl_env_t *env, ir_entity *ent, int emit_commons
}
/* alignment */
if (align > 1 && !emit_as_common) {
obstack_printf(obst, ".balign\t%d\n", align);
obstack_printf(obst, ".balign\t%u\n", align);
}
if (!emit_as_common) {
......@@ -678,13 +678,13 @@ static void dump_global(be_gas_decl_env_t *env, ir_entity *ent, int emit_commons
if (variability == variability_uninitialized) {
if(emit_as_common) {
if (be_gas_flavour == GAS_FLAVOUR_NORMAL)
obstack_printf(obst, "\t.comm %s,%d,%d\n",
obstack_printf(obst, "\t.comm %s,%u,%u\n",
ld_name, get_type_size_bytes(type), align);
else
obstack_printf(obst, "\t.comm %s,%d # %d\n",
obstack_printf(obst, "\t.comm %s,%u # %u\n",
ld_name, get_type_size_bytes(type), align);
} else {
obstack_printf(obst, "\t.zero %d\n", get_type_size_bytes(type));
obstack_printf(obst, "\t.zero %u\n", get_type_size_bytes(type));
}
} else {
if (is_atomic_entity(ent)) {
......
......@@ -1657,9 +1657,9 @@ static int dump_node(ir_node *irn, FILE *f, dump_reason_t reason)
if(be_has_frame_entity(irn)) {
be_frame_attr_t *a = (be_frame_attr_t *) at;
if (a->ent) {
int bits = get_type_size_bits(get_entity_type(a->ent));
ir_fprintf(f, "frame entity: %+F, offset 0x%x (%d), size 0x%x (%d) bits\n",
a->ent, a->offset, a->offset, bits, bits);
unsigned size = get_type_size_bytes(get_entity_type(a->ent));
ir_fprintf(f, "frame entity: %+F, offset 0x%x (%d), size 0x%x (%d) bytes\n",
a->ent, a->offset, a->offset, size, size);
}
}
......
......@@ -353,7 +353,8 @@ static void gen_struct_union_type(wenv_t *env, ir_type *tp) {
for (i = 0, n = get_compound_n_members(tp); i < n; ++i) {
ir_entity *ent = get_compound_member(tp, i);
ir_type *mtp = get_entity_type(ent);
int ofs, size;
int ofs;
unsigned size;
if (! IS_TYPE_READY(mtp))
waitq_put(env->wq, mtp);
......@@ -368,11 +369,11 @@ static void gen_struct_union_type(wenv_t *env, ir_type *tp) {
int bofs;
type_num = get_type_number(h, tp);
size = get_type_size_bits(tp);
size = get_type_size_bytes(tp) * 8;
bofs = (ofs + get_entity_offset(ent)) * 8 + get_entity_offset_bits_remainder(ent);
/* name:type, bit offset from the start of the struct', number of bits in the element. */
fprintf(h->f, "%s:%u,%d,%d;", get_entity_name(ent), type_num, bofs, size);
fprintf(h->f, "%s:%u,%d,%u;", get_entity_name(ent), type_num, bofs, size);
}
} else {
/* no bitfield */
......@@ -390,8 +391,8 @@ static void gen_struct_union_type(wenv_t *env, ir_type *tp) {
/* name:type, bit offset from the start of the struct', number of bits in the element. */
fprintf(h->f, "%u", type_num);
}
size = get_type_size_bits(mtp);
fprintf(h->f, ",%d,%d;", ofs * 8, size);
size = get_type_size_bytes(mtp) * 8;
fprintf(h->f, ",%d,%u;", ofs * 8, size);
}
}
fprintf(h->f, ";\",%d,0,0,0\n", N_LSYM);
......
......@@ -1293,25 +1293,25 @@ static void transform_MemPerm(ia32_code_gen_t *cg, ir_node *node) {
arity = be_get_MemPerm_entity_arity(node);
pops = alloca(arity * sizeof(pops[0]));
// create pushs
/* create Pushs */
for(i = 0; i < arity; ++i) {
ir_entity *inent = be_get_MemPerm_in_entity(node, i);
ir_entity *outent = be_get_MemPerm_out_entity(node, i);
ir_type *enttype = get_entity_type(inent);
int entbits = get_type_size_bits(enttype);
int entbits2 = get_type_size_bits(get_entity_type(outent));
unsigned entsize = get_type_size_bytes(enttype);
unsigned entsize2 = get_type_size_bytes(get_entity_type(outent));
ir_node *mem = get_irn_n(node, i + 1);
ir_node *push;
/* work around cases where entities have different sizes */
if(entbits2 < entbits)
entbits = entbits2;
assert( (entbits == 32 || entbits == 64) && "spillslot on x86 should be 32 or 64 bit");
if(entsize2 < entsize)
entsize = entsize2;
assert( (entsize == 4 || entsize == 8) && "spillslot on x86 should be 32 or 64 bit");
push = create_push(cg, node, node, sp, mem, inent);
sp = create_spproj(cg, node, push, pn_ia32_Push_stack);
if(entbits == 64) {
// add another push after the first one
if(entsize == 8) {
/* add another push after the first one */
push = create_push(cg, node, node, sp, mem, inent);
add_ia32_am_offs_int(push, 4);
sp = create_spproj(cg, node, push, pn_ia32_Push_stack);
......@@ -1320,26 +1320,26 @@ static void transform_MemPerm(ia32_code_gen_t *cg, ir_node *node) {
set_irn_n(node, i, new_Bad());
}
// create pops
/* create pops */
for(i = arity - 1; i >= 0; --i) {
ir_entity *inent = be_get_MemPerm_in_entity(node, i);
ir_entity *outent = be_get_MemPerm_out_entity(node, i);
ir_type *enttype = get_entity_type(outent);
int entbits = get_type_size_bits(enttype);
int entbits2 = get_type_size_bits(get_entity_type(inent));
unsigned entsize = get_type_size_bytes(enttype);
unsigned entsize2 = get_type_size_bytes(get_entity_type(inent));
ir_node *pop;
/* work around cases where entities have different sizes */
if(entbits2 < entbits)
entbits = entbits2;
assert( (entbits == 32 || entbits == 64) && "spillslot on x86 should be 32 or 64 bit");
if(entsize2 < entsize)
entsize = entsize2;
assert( (entsize == 4 || entsize == 8) && "spillslot on x86 should be 32 or 64 bit");
pop = create_pop(cg, node, node, sp, outent);
sp = create_spproj(cg, node, pop, pn_ia32_Pop_stack);
if(entbits == 64) {
if(entsize == 8) {
add_ia32_am_offs_int(pop, 4);
// add another pop after the first one
/* add another pop after the first one */
pop = create_pop(cg, node, node, sp, outent);
sp = create_spproj(cg, node, pop, pn_ia32_Pop_stack);
}
......@@ -1351,7 +1351,7 @@ static void transform_MemPerm(ia32_code_gen_t *cg, ir_node *node) {
keep = be_new_Keep(&ia32_reg_classes[CLASS_ia32_gp], irg, block, 1, in);
sched_add_before(node, keep);
// exchange memprojs
/* exchange memprojs */
foreach_out_edge_safe(node, edge, next) {
ir_node *proj = get_edge_src_irn(edge);
int p = get_Proj_proj(proj);
......@@ -1362,7 +1362,7 @@ static void transform_MemPerm(ia32_code_gen_t *cg, ir_node *node) {
set_Proj_proj(proj, pn_ia32_Pop_M);
}
// remove memperm
/* remove memperm */
arity = get_irn_arity(node);
for(i = 0; i < arity; ++i) {
set_irn_n(node, i, new_Bad());
......
......@@ -668,9 +668,9 @@ void dump_entity_to_file_prefix(FILE *F, ir_entity *ent, char *prefix, unsigned
for (i = 0; i < get_compound_ent_n_values(ent); ++i) {
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:%d ", prefix, get_entity_offset(ent0), get_entity_offset_bits_remainder(ent0));
fprintf(F, "\n%s %3d:%u ", prefix, get_entity_offset(ent0), get_entity_offset_bits_remainder(ent0));
if (get_type_state(type) == layout_fixed)
fprintf(F, "(%3d:%d) ", get_compound_ent_value_offset_bytes(ent, i), get_compound_ent_value_offset_bit_remainder(ent, i));
fprintf(F, "(%3u:%u) ", get_compound_ent_value_offset_bytes(ent, i), get_compound_ent_value_offset_bit_remainder(ent, i));
fprintf(F, "%s", get_entity_name(ent));
for (j = 0; j < get_compound_graph_path_length(path); ++j) {
ir_entity *node = get_compound_graph_path_node(path, j);
......@@ -1217,8 +1217,8 @@ void dump_type_to_file(FILE *F, ir_type *tp, dump_verbosity verbosity) {
fprintf(F, " visibility: %s,\n", get_visibility_name(get_type_visibility(tp)));
fprintf(F, " state: %s,\n", get_type_state_name(get_type_state(tp)));
fprintf(F, " size: %2d Bits,\n", get_type_size_bits(tp));
fprintf(F, " alignment: %2d Bits,\n", get_type_alignment_bits(tp));
fprintf(F, " size: %2u Bytes,\n", get_type_size_bytes(tp));
fprintf(F, " alignment: %2u Bytes,\n", get_type_alignment_bytes(tp));
if (is_atomic_type(tp) || is_Method_type(tp))
fprintf(F, " mode: %s,\n", get_mode_name(get_type_mode(tp)));
......
......@@ -337,7 +337,7 @@ ir_profile_instrument(const char *filename, unsigned flags)
tarval *tv;
int filename_len = strlen(filename)+1;
ident *cur_ident;
int align_l, align_n, size;
unsigned align_l, align_n, size;
ir_graph *rem;
block_id_walker_data_t wd;
symconst_symbol sym;
......
......@@ -385,7 +385,7 @@ static void transform_allocs(ir_graph *irg, walk_env_t *env)
if (tv != tarval_bad && tarval_is_long(tv) &&
get_type_state(atp) == layout_fixed &&
get_tarval_long(tv) == get_type_size_bytes(atp)) {
(unsigned)get_tarval_long(tv) == get_type_size_bytes(atp)) {
/* a already lowered type size */
tp = atp;
}
......
......@@ -986,10 +986,10 @@ set_array_entity_values(ir_entity *ent, tarval **values, int num_vals) {
} /* set_array_entity_values */
/* Return the overall offset of value at position pos in bytes. */
int get_compound_ent_value_offset_bytes(ir_entity *ent, int pos) {
unsigned get_compound_ent_value_offset_bytes(ir_entity *ent, int pos) {
compound_graph_path *path;
int path_len, i;
int offset = 0;
unsigned offset = 0;
ir_type *curr_tp;
assert(get_type_state(get_entity_type(ent)) == layout_fixed);
......@@ -1001,16 +1001,14 @@ int get_compound_ent_value_offset_bytes(ir_entity *ent, int pos) {
for (i = 0; i < path_len; ++i) {
if (is_Array_type(curr_tp)) {
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);
unsigned size = get_type_size_bytes(elem_type);
unsigned align = get_type_alignment_bytes(elem_type);
int idx;
assert(size > 0);
if(size % align > 0) {
size += align - (size % align);
}
assert(size % 8 == 0);
size /= 8;
idx = get_compound_graph_path_array_index(path, i);
assert(idx >= 0);
offset += size * idx;
......@@ -1026,7 +1024,7 @@ int get_compound_ent_value_offset_bytes(ir_entity *ent, int pos) {
} /* get_compound_ent_value_offset_bytes */
/* Return the offset in bits from the last byte address. */
int get_compound_ent_value_offset_bit_remainder(ir_entity *ent, int pos) {
unsigned get_compound_ent_value_offset_bit_remainder(ir_entity *ent, int pos) {
compound_graph_path *path;
int path_len;
ir_entity *last_node;
......
......@@ -75,7 +75,7 @@ static const tp_op_ops
free_class_entities,
NULL,
set_class_mode,
set_class_size_bits,
set_class_size,
get_class_n_members,
get_class_member,
get_class_member_index
......@@ -86,7 +86,7 @@ static const tp_op_ops
free_struct_entities,
NULL,
set_struct_mode,
set_struct_size_bits,
set_struct_size,
get_struct_n_members,
get_struct_member,
get_struct_member_index
......@@ -108,7 +108,7 @@ static const tp_op_ops
free_union_entities,
NULL,
NULL,
set_union_size_bits,
set_union_size,
get_union_n_members,
get_union_member,
get_union_member_index
......@@ -119,7 +119,7 @@ static const tp_op_ops
free_array_entities,
free_array_automatic_entities,
NULL,
set_array_size_bits,
set_array_size,
NULL,
NULL,
NULL
......@@ -152,7 +152,7 @@ static const tp_op_ops
NULL,
NULL,
NULL,
set_default_size_bits,
set_default_size,
NULL,
NULL,
NULL
......
......@@ -44,8 +44,8 @@ typedef void (*free_auto_entities_func)(ir_type *tp);
/** A function called to set the mode of a type. */
typedef void (*set_type_mode_func)(ir_type *tp, ir_mode *m);
/** A function called to set the size of a type in bits */
typedef void (*set_type_size_func)(ir_type *tp, int size);
/** A function called to set the size of a type in bytes. */
typedef void (*set_type_size_func)(ir_type *tp, unsigned size);
/** A function called to get the number of compound members */
typedef int (*get_n_members_func)(const ir_type *tp);
......@@ -62,14 +62,14 @@ typedef void (*insert_entity_func)(ir_type *tp, ir_entity *member);
* tp_op operations.
*/
typedef struct _tp_op_ops {
free_attrs_func free_attrs; /**< called to free the attributes of a type */
free_entities_func free_entities; /**< called to free the owned entities of a type */
free_auto_entities_func free_auto_entities; /**< called to free the automatic allocated entities of a type */
set_type_mode_func set_type_mode; /**< called to set a ir_mode of a type */
set_type_size_func set_type_size; /**< called to set the bit size of a type */
get_n_members_func get_n_members; /**< called to return the number of compound members */
get_member_func get_member; /**< called to get the pos'th compound member */
get_member_index_func get_member_index; /**< called to get the index of a compound member */
free_attrs_func free_attrs; /**< Called to free the attributes of a type. */
free_entities_func free_entities; /**< Called to free the owned entities of a type. */
free_auto_entities_func free_auto_entities; /**< Called to free the automatic allocated entities of a type. */
set_type_mode_func set_type_mode; /**< Called to set a ir_mode of a type. */
set_type_size_func set_type_size; /**< Called to set the byte size of a type. */
get_n_members_func get_n_members; /**< Called to return the number of compound members. */
get_member_func get_member; /**< Called to get the pos'th compound member. */
get_member_index_func get_member_index; /**< Called to get the index of a compound member. */
} tp_op_ops;
/** possible flags for a type opcode */
......@@ -77,13 +77,13 @@ enum tp_op_flags_t {
TP_OP_FLAG_COMPOUND = 1 /**< is a compound type */
};
/** The type opcode */
/** The type opcode. */
struct tp_op {
tp_opcode code; /**< the tpop code */
ident *name; /**< the name of the type opcode */
size_t attr_size; /**< the attribute size for a type of this opcode */
unsigned flags; /**< flags for this opcode */
tp_op_ops ops; /**< tp_op operations */
tp_opcode code; /**< The tpop code. */
ident *name; /**< The name of the type opcode. */
size_t attr_size; /**< The attribute size for a type of this opcode. */
unsigned flags; /**< Flags for this opcode. */
tp_op_ops ops; /**< tp_op operations. */
};
/**
......
......@@ -137,8 +137,8 @@ new_type(tp_op *type_op, ir_mode *mode, ident *name, dbg_info *db) {
res->name = name;
res->visibility = visibility_external_allocated;
res->flags = tf_none;
res->size = -1;
res->align = -1;
res->size = 0;
res->align = 0