Commit b49d4ae9 authored by Matthias Braun's avatar Matthias Braun
Browse files

some fixes after bitfield commit

parent f56426a9
......@@ -567,7 +567,7 @@ static void dump_entity_to_file_prefix(FILE *const F,
ir_fprintf(F, "%s %+F: %s", prefix, type, get_entity_name(ent));
if (is_Method_type(type))
fputs("(...)", F);
if (ent->entity_kind == IR_ENTITY_COMPOUND_MEMBER) {
if (is_entity_compound_member(ent)) {
ir_fprintf(F, " offset: %d", get_entity_offset(ent));
unsigned bitfield_size = get_entity_bitfield_size(ent);
if (bitfield_size > 0) {
......@@ -600,7 +600,15 @@ static void dump_entity_to_file_prefix(FILE *const F,
fprintf(F, "\n%s aligned: %s", prefix, get_align_name(get_entity_aligned(ent)));
fprintf(F, "\n%s alignment: %u", prefix, get_entity_alignment(ent));
fprintf(F, "\n%s ld_name: %s", prefix, ent->ld_name ? get_entity_ld_name(ent) : "no yet set");
fprintf(F, "\n%s offset: %d bytes", prefix, get_entity_offset(ent));
if (is_entity_compound_member(ent)) {
fprintf(F, "\n%s offset: %d bytes", prefix, get_entity_offset(ent));
unsigned bitfield_size = get_entity_bitfield_size(ent);
if (bitfield_size > 0) {
unsigned bitfield_offset = get_entity_bitfield_offset(ent);
fprintf(F, "\n%s bitfield offset: %u", prefix, bitfield_offset);
fprintf(F, "\n%s bitfield size: %u", prefix, bitfield_size);
}
}
if (is_Method_type(type)) {
const ir_graph *irg = get_entity_irg(ent);
if (irg != NULL) {
......
......@@ -771,6 +771,9 @@ static void write_entity(write_env_t *env, ir_entity *ent)
} else {
write_size_t(env, num);
}
write_long(env, get_entity_offset(ent));
write_unsigned(env, get_entity_bitfield_offset(ent));
write_unsigned(env, get_entity_bitfield_size(ent));
break;
}
case IR_ENTITY_UNKNOWN:
......@@ -1888,6 +1891,9 @@ static void read_entity(read_env_t *env, ir_entity_kind kind)
}
obstack_free(&env->obst, str);
entity = new_parameter_entity(owner, parameter_number, type);
set_entity_offset(entity, read_int(env));
set_entity_bitfield_offset(entity, read_unsigned(env));
set_entity_bitfield_size(entity, read_unsigned(env));
break;
}
case IR_ENTITY_LABEL: {
......
......@@ -336,6 +336,12 @@ static inline void _set_entity_usage(ir_entity *ent, ir_entity_usage state)
ent->usage = state;
}
static inline bool is_entity_compound_member(const ir_entity *entity)
{
return entity->entity_kind == IR_ENTITY_COMPOUND_MEMBER
|| entity->entity_kind == IR_ENTITY_PARAMETER;
}
static inline int _get_entity_offset(const ir_entity *ent)
{
assert(ent->entity_kind == IR_ENTITY_COMPOUND_MEMBER
......
Markdown is supported
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