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

Rename get_type_{size|alignment}_bytes() to get_type{size|alignment}()

parent 002cc34b
...@@ -953,20 +953,20 @@ FIRM_API void set_type_state(ir_type *tp, ir_type_state state); ...@@ -953,20 +953,20 @@ FIRM_API void set_type_state(ir_type *tp, ir_type_state state);
FIRM_API ir_mode *get_type_mode(const ir_type *tp); FIRM_API ir_mode *get_type_mode(const ir_type *tp);
/** Returns the size of a type in bytes. */ /** Returns the size of a type in bytes. */
FIRM_API unsigned get_type_size_bytes(const ir_type *tp); FIRM_API unsigned get_type_size(const ir_type *tp);
/** Sets the size of a type in bytes. /** Sets the size of a type in bytes.
* *
* For primitive, pointer and method types the size is always fixed. * For primitive, pointer and method types the size is always fixed.
* This call is legal but has no effect. * This call is legal but has no effect.
*/ */
FIRM_API void set_type_size_bytes(ir_type *tp, unsigned size); FIRM_API void set_type_size(ir_type *tp, unsigned size);
/** Returns the alignment of a type in bytes. */ /** Returns the alignment of a type in bytes. */
FIRM_API unsigned get_type_alignment_bytes(const ir_type *tp); FIRM_API unsigned get_type_alignment(const ir_type *tp);
/** Sets the alignment of a type in bytes. */ /** Sets the alignment of a type in bytes. */
FIRM_API void set_type_alignment_bytes(ir_type *tp, unsigned align); FIRM_API void set_type_alignment(ir_type *tp, unsigned align);
/** Returns the visited counter of a type. /** Returns the visited counter of a type.
* @see @ref visited_counters */ * @see @ref visited_counters */
...@@ -1394,7 +1394,7 @@ FIRM_API ir_type *get_array_element_type(const ir_type *array); ...@@ -1394,7 +1394,7 @@ FIRM_API ir_type *get_array_element_type(const ir_type *array);
/** /**
* Sets the array variable size flag. * Sets the array variable size flag.
* If this flag is set then no upper/lower bounds need to be set and * If this flag is set then no upper/lower bounds need to be set and
* get_type_size_bytes() returns -1 * get_type_size() returns -1
*/ */
FIRM_API void set_array_variable_size(ir_type *array, int variable_size_flag); FIRM_API void set_array_variable_size(ir_type *array, int variable_size_flag);
...@@ -1541,9 +1541,9 @@ FIRM_API void remove_compound_member(ir_type *compound, ir_entity *entity); ...@@ -1541,9 +1541,9 @@ FIRM_API void remove_compound_member(ir_type *compound, ir_entity *entity);
/** /**
* Sets the variable size flag of a compound type. * Sets the variable size flag of a compound type.
* The last member of a variable size compound type may be an array type * The last member of a variable size compound type may be an array type
* without explicit size. So the get_type_size_bytes() of a variable size * without explicit size. So the get_type_size() of a variable size compound
* compound type only returns a minimum size for the type (the size if the * type only returns a minimum size for the type (the size if the last members
* last members size is 0) * size is 0)
*/ */
FIRM_API void set_compound_variable_size(ir_type *compound, int variable_size); FIRM_API void set_compound_variable_size(ir_type *compound, int variable_size);
......
...@@ -438,7 +438,7 @@ pointer: ...@@ -438,7 +438,7 @@ pointer:
ir_alias_relation rel; ir_alias_relation rel;
if (options & aa_opt_byte_type_may_alias) { if (options & aa_opt_byte_type_may_alias) {
if (get_type_size_bytes(objt1) == 1 || get_type_size_bytes(objt2) == 1) { if (get_type_size(objt1) == 1 || get_type_size(objt2) == 1) {
/* One of the types address a byte. Assume a ir_may_alias and leave /* One of the types address a byte. Assume a ir_may_alias and leave
the type based check. */ the type based check. */
goto leave_type_based_alias; goto leave_type_based_alias;
...@@ -447,7 +447,7 @@ pointer: ...@@ -447,7 +447,7 @@ pointer:
/* cheap check: If the type sizes did not match, the types MUST be different */ /* cheap check: If the type sizes did not match, the types MUST be different */
/* No, one might be part of the other. */ /* No, one might be part of the other. */
/* if (get_type_size_bytes(objt1) != get_type_size_bytes(objt2)) */ /* if (get_type_size(objt1) != get_type_size(objt2)) */
/* return ir_no_alias; */ /* return ir_no_alias; */
/* cheap test: if only one is a reference type, no alias */ /* cheap test: if only one is a reference type, no alias */
......
...@@ -173,7 +173,7 @@ static void emit_Return(const ir_node *node) ...@@ -173,7 +173,7 @@ static void emit_Return(const ir_node *node)
{ {
ir_graph *irg = get_irn_irg(node); ir_graph *irg = get_irn_irg(node);
ir_type *frame_type = get_irg_frame_type(irg); ir_type *frame_type = get_irg_frame_type(irg);
unsigned size = get_type_size_bytes(frame_type); unsigned size = get_type_size(frame_type);
/* emit function epilog here */ /* emit function epilog here */
......
...@@ -67,7 +67,7 @@ static void introduce_prologue(ir_graph *const irg) ...@@ -67,7 +67,7 @@ static void introduce_prologue(ir_graph *const irg)
ir_node *const block = get_nodes_block(start); ir_node *const block = get_nodes_block(start);
ir_node *const initial_sp = be_get_Start_proj(irg, sp); ir_node *const initial_sp = be_get_Start_proj(irg, sp);
ir_type *const frame_type = get_irg_frame_type(irg); ir_type *const frame_type = get_irg_frame_type(irg);
unsigned const frame_size = get_type_size_bytes(frame_type); unsigned const frame_size = get_type_size(frame_type);
ir_node *const incsp = be_new_IncSP(sp, block, initial_sp, frame_size, 0); ir_node *const incsp = be_new_IncSP(sp, block, initial_sp, frame_size, 0);
edges_reroute_except(initial_sp, incsp, incsp); edges_reroute_except(initial_sp, incsp, incsp);
sched_add_after(start, incsp); sched_add_after(start, incsp);
......
...@@ -3264,12 +3264,12 @@ static ir_type *amd64_get_between_type(bool omit_fp) ...@@ -3264,12 +3264,12 @@ static ir_type *amd64_get_between_type(bool omit_fp)
if (between_type == NULL) { if (between_type == NULL) {
between_type = new_type_class(new_id_from_str("amd64_between_type")); between_type = new_type_class(new_id_from_str("amd64_between_type"));
/* between type contains return address + saved base pointer */ /* between type contains return address + saved base pointer */
set_type_size_bytes(between_type, 2*get_mode_size_bytes(mode_gp)); set_type_size(between_type, 2*get_mode_size_bytes(mode_gp));
omit_fp_between_type omit_fp_between_type
= new_type_class(new_id_from_str("amd64_between_type")); = new_type_class(new_id_from_str("amd64_between_type"));
/* between type contains return address */ /* between type contains return address */
set_type_size_bytes(omit_fp_between_type, get_mode_size_bytes(mode_gp)); set_type_size(omit_fp_between_type, get_mode_size_bytes(mode_gp));
} }
return omit_fp ? omit_fp_between_type : between_type; return omit_fp ? omit_fp_between_type : between_type;
......
...@@ -178,8 +178,8 @@ static void transform_MemPerm(ir_node *node) ...@@ -178,8 +178,8 @@ static void transform_MemPerm(ir_node *node)
ir_entity *inent = be_get_MemPerm_in_entity(node, i); ir_entity *inent = be_get_MemPerm_in_entity(node, i);
ir_entity *outent = be_get_MemPerm_out_entity(node, i); ir_entity *outent = be_get_MemPerm_out_entity(node, i);
ir_type *enttype = get_entity_type(inent); ir_type *enttype = get_entity_type(inent);
unsigned entsize = get_type_size_bytes(enttype); unsigned entsize = get_type_size(enttype);
unsigned entsize2 = get_type_size_bytes(get_entity_type(outent)); unsigned entsize2 = get_type_size(get_entity_type(outent));
ir_node *mem = get_irn_n(node, i); ir_node *mem = get_irn_n(node, i);
/* work around cases where entities have different sizes */ /* work around cases where entities have different sizes */
...@@ -216,8 +216,8 @@ static void transform_MemPerm(ir_node *node) ...@@ -216,8 +216,8 @@ static void transform_MemPerm(ir_node *node)
ir_entity *inent = be_get_MemPerm_in_entity(node, i); ir_entity *inent = be_get_MemPerm_in_entity(node, i);
ir_entity *outent = be_get_MemPerm_out_entity(node, i); ir_entity *outent = be_get_MemPerm_out_entity(node, i);
ir_type *enttype = get_entity_type(outent); ir_type *enttype = get_entity_type(outent);
unsigned entsize = get_type_size_bytes(enttype); unsigned entsize = get_type_size(enttype);
unsigned entsize2 = get_type_size_bytes(get_entity_type(inent)); unsigned entsize2 = get_type_size(get_entity_type(inent));
/* work around cases where entities have different sizes */ /* work around cases where entities have different sizes */
if (entsize2 < entsize) if (entsize2 < entsize)
...@@ -524,7 +524,7 @@ static void introduce_epilogue(ir_node *ret) ...@@ -524,7 +524,7 @@ static void introduce_epilogue(ir_node *ret)
ir_graph *irg = get_irn_irg(ret); ir_graph *irg = get_irn_irg(ret);
ir_node *block = get_nodes_block(ret); ir_node *block = get_nodes_block(ret);
ir_type *frame_type = get_irg_frame_type(irg); ir_type *frame_type = get_irg_frame_type(irg);
unsigned frame_size = get_type_size_bytes(frame_type); unsigned frame_size = get_type_size(frame_type);
be_stack_layout_t *layout = be_get_irg_stack_layout(irg); be_stack_layout_t *layout = be_get_irg_stack_layout(irg);
ir_node *first_sp = get_irn_n(ret, n_amd64_ret_stack); ir_node *first_sp = get_irn_n(ret, n_amd64_ret_stack);
ir_node *curr_sp = first_sp; ir_node *curr_sp = first_sp;
...@@ -564,7 +564,7 @@ static void introduce_prologue(ir_graph *const irg) ...@@ -564,7 +564,7 @@ static void introduce_prologue(ir_graph *const irg)
ir_node *start = get_irg_start(irg); ir_node *start = get_irg_start(irg);
ir_node *block = get_nodes_block(start); ir_node *block = get_nodes_block(start);
ir_type *frame_type = get_irg_frame_type(irg); ir_type *frame_type = get_irg_frame_type(irg);
unsigned frame_size = get_type_size_bytes(frame_type); unsigned frame_size = get_type_size(frame_type);
be_stack_layout_t *layout = be_get_irg_stack_layout(irg); be_stack_layout_t *layout = be_get_irg_stack_layout(irg);
ir_node *initial_sp = be_get_Start_proj(irg, sp); ir_node *initial_sp = be_get_Start_proj(irg, sp);
......
...@@ -64,7 +64,7 @@ static void introduce_epilog(ir_node *ret) ...@@ -64,7 +64,7 @@ static void introduce_epilog(ir_node *ret)
ir_node *const block = get_nodes_block(ret); ir_node *const block = get_nodes_block(ret);
ir_graph *const irg = get_irn_irg(ret); ir_graph *const irg = get_irn_irg(ret);
ir_type *const frame_type = get_irg_frame_type(irg); ir_type *const frame_type = get_irg_frame_type(irg);
unsigned const frame_size = get_type_size_bytes(frame_type); unsigned const frame_size = get_type_size(frame_type);
ir_node *const incsp = be_new_IncSP(sp_reg, block, sp, -frame_size, 0); ir_node *const incsp = be_new_IncSP(sp_reg, block, sp, -frame_size, 0);
set_irn_n(ret, n_arm_Return_sp, incsp); set_irn_n(ret, n_arm_Return_sp, incsp);
sched_add_before(ret, incsp); sched_add_before(ret, incsp);
...@@ -83,7 +83,7 @@ static void introduce_prolog_epilog(ir_graph *irg) ...@@ -83,7 +83,7 @@ static void introduce_prolog_epilog(ir_graph *irg)
ir_node *block = get_nodes_block(start); ir_node *block = get_nodes_block(start);
ir_node *initial_sp = be_get_Start_proj(irg, sp_reg); ir_node *initial_sp = be_get_Start_proj(irg, sp_reg);
ir_type *frame_type = get_irg_frame_type(irg); ir_type *frame_type = get_irg_frame_type(irg);
unsigned frame_size = get_type_size_bytes(frame_type); unsigned frame_size = get_type_size(frame_type);
ir_node *const incsp = be_new_IncSP(sp_reg, block, initial_sp, frame_size, 0); ir_node *const incsp = be_new_IncSP(sp_reg, block, initial_sp, frame_size, 0);
edges_reroute_except(initial_sp, incsp, incsp); edges_reroute_except(initial_sp, incsp, incsp);
......
...@@ -1656,7 +1656,7 @@ static ir_type *arm_get_between_type(void) ...@@ -1656,7 +1656,7 @@ static ir_type *arm_get_between_type(void)
static ir_type *between_type = NULL; static ir_type *between_type = NULL;
if (between_type == NULL) { if (between_type == NULL) {
between_type = new_type_class(new_id_from_str("arm_between_type")); between_type = new_type_class(new_id_from_str("arm_between_type"));
set_type_size_bytes(between_type, 0); set_type_size(between_type, 0);
} }
return between_type; return between_type;
......
...@@ -577,7 +577,7 @@ static void emit_pointer_type_abbrev(void) ...@@ -577,7 +577,7 @@ static void emit_pointer_type_abbrev(void)
static void emit_pointer_type(const ir_type *type) static void emit_pointer_type(const ir_type *type)
{ {
ir_type *points_to = get_pointer_points_to_type(type); ir_type *points_to = get_pointer_points_to_type(type);
unsigned size = get_type_size_bytes(type); unsigned size = get_type_size(type);
assert(size < 256); assert(size < 256);
if (!is_Primitive_type(points_to) || get_type_mode(points_to) != mode_ANY) { if (!is_Primitive_type(points_to) || get_type_mode(points_to) != mode_ANY) {
...@@ -681,7 +681,7 @@ static void emit_compound_type(const ir_type *type) ...@@ -681,7 +681,7 @@ static void emit_compound_type(const ir_type *type)
assert(is_Class_type(type)); assert(is_Class_type(type));
emit_uleb128(abbrev_class_type); emit_uleb128(abbrev_class_type);
} }
emit_uleb128(get_type_size_bytes(type)); emit_uleb128(get_type_size(type));
for (size_t i = 0; i < n_members; ++i) { for (size_t i = 0; i < n_members; ++i) {
ir_entity *member = get_compound_member(type, i); ir_entity *member = get_compound_member(type, i);
ir_type *member_type = get_entity_type(member); ir_type *member_type = get_entity_type(member);
...@@ -690,7 +690,7 @@ static void emit_compound_type(const ir_type *type) ...@@ -690,7 +690,7 @@ static void emit_compound_type(const ir_type *type)
if (get_entity_bitfield_size(member) > 0) { if (get_entity_bitfield_size(member) > 0) {
unsigned bit_offset = get_entity_bitfield_offset(member); unsigned bit_offset = get_entity_bitfield_offset(member);
unsigned bit_size = get_entity_bitfield_size(member); unsigned bit_size = get_entity_bitfield_size(member);
unsigned base_size = get_type_size_bytes(member_type); unsigned base_size = get_type_size(member_type);
bit_offset = base_size*8 - bit_offset - bit_size; bit_offset = base_size*8 - bit_offset - bit_size;
......
...@@ -754,11 +754,11 @@ static void emit_init_expression(ir_node *const init) ...@@ -754,11 +754,11 @@ static void emit_init_expression(ir_node *const init)
return; return;
case iro_Align: case iro_Align:
be_emit_irprintf("%u", get_type_alignment_bytes(get_Align_type(init))); be_emit_irprintf("%u", get_type_alignment(get_Align_type(init)));
return; return;
case iro_Size: case iro_Size:
be_emit_irprintf("%u", get_type_size_bytes(get_Size_type(init))); be_emit_irprintf("%u", get_type_size(get_Size_type(init)));
return; return;
case iro_Add: case iro_Add:
...@@ -894,28 +894,27 @@ static size_t get_initializer_size(const ir_initializer_t *initializer, ...@@ -894,28 +894,27 @@ static size_t get_initializer_size(const ir_initializer_t *initializer,
switch (get_initializer_kind(initializer)) { switch (get_initializer_kind(initializer)) {
case IR_INITIALIZER_TARVAL: case IR_INITIALIZER_TARVAL:
assert(get_tarval_mode(get_initializer_tarval_value(initializer)) == get_type_mode(type)); assert(get_tarval_mode(get_initializer_tarval_value(initializer)) == get_type_mode(type));
return get_type_size_bytes(type); return get_type_size(type);
case IR_INITIALIZER_CONST: case IR_INITIALIZER_CONST:
case IR_INITIALIZER_NULL: case IR_INITIALIZER_NULL:
return get_type_size_bytes(type); return get_type_size(type);
case IR_INITIALIZER_COMPOUND: case IR_INITIALIZER_COMPOUND:
if (is_Array_type(type)) { if (is_Array_type(type)) {
if (is_array_variable_size(type)) { if (is_array_variable_size(type)) {
ir_type *element_type = get_array_element_type(type); ir_type *element_type = get_array_element_type(type);
unsigned element_size = get_type_size_bytes(element_type); unsigned element_size = get_type_size(element_type);
unsigned element_align unsigned element_align = get_type_alignment(element_type);
= get_type_alignment_bytes(element_type); unsigned misalign = element_size % element_align;
unsigned misalign = element_size % element_align;
size_t n_inits size_t n_inits
= get_initializer_compound_n_entries(initializer); = get_initializer_compound_n_entries(initializer);
element_size += element_align - misalign; element_size += element_align - misalign;
return n_inits * element_size; return n_inits * element_size;
} else { } else {
return get_type_size_bytes(type); return get_type_size(type);
} }
} else { } else {
assert(is_compound_type(type)); assert(is_compound_type(type));
size_t size = get_type_size_bytes(type); size_t size = get_type_size(type);
if (is_compound_variable_size(type)) { if (is_compound_variable_size(type)) {
/* last initializer has to be an array of variable size */ /* last initializer has to be an array of variable size */
size_t l = get_initializer_compound_n_entries(initializer)-1; size_t l = get_initializer_compound_n_entries(initializer)-1;
...@@ -936,7 +935,7 @@ static size_t get_initializer_size(const ir_initializer_t *initializer, ...@@ -936,7 +935,7 @@ static size_t get_initializer_size(const ir_initializer_t *initializer,
static unsigned long compute_entity_size(ir_entity const *const entity) static unsigned long compute_entity_size(ir_entity const *const entity)
{ {
ir_type *const type = get_entity_type(entity); ir_type *const type = get_entity_type(entity);
unsigned long size = get_type_size_bytes(type); unsigned long size = get_type_size(type);
if (is_alias_entity(entity)) if (is_alias_entity(entity))
return size; return size;
...@@ -981,7 +980,7 @@ static void emit_bitfield(normal_or_bitfield *vals, unsigned offset_bits, ...@@ -981,7 +980,7 @@ static void emit_bitfield(normal_or_bitfield *vals, unsigned offset_bits,
panic("couldn't get numeric value for bitfield initializer"); panic("couldn't get numeric value for bitfield initializer");
} }
int value_len = get_type_size_bytes(type); int value_len = get_type_size(type);
size_t bit_offset = 0; size_t bit_offset = 0;
size_t end = bitfield_size; size_t end = bitfield_size;
bool big_endian = be_get_backend_param()->byte_order_big_endian; bool big_endian = be_get_backend_param()->byte_order_big_endian;
...@@ -1041,7 +1040,7 @@ static void emit_ir_initializer(normal_or_bitfield *vals, ...@@ -1041,7 +1040,7 @@ static void emit_ir_initializer(normal_or_bitfield *vals,
vals->type = type; vals->type = type;
vals->v.tarval = get_initializer_tarval_value(initializer); vals->v.tarval = get_initializer_tarval_value(initializer);
assert(get_type_mode(type) == get_tarval_mode(vals->v.tarval)); assert(get_type_mode(type) == get_tarval_mode(vals->v.tarval));
for (size_t i = 1; i < get_type_size_bytes(type); ++i) { for (size_t i = 1; i < get_type_size(type); ++i) {
vals[i].kind = NORMAL; vals[i].kind = NORMAL;
vals[i].type = NULL; vals[i].type = NULL;
vals[i].v.value = NULL; vals[i].v.value = NULL;
...@@ -1053,7 +1052,7 @@ static void emit_ir_initializer(normal_or_bitfield *vals, ...@@ -1053,7 +1052,7 @@ static void emit_ir_initializer(normal_or_bitfield *vals,
vals->kind = NORMAL; vals->kind = NORMAL;
vals->type = type; vals->type = type;
vals->v.value = get_initializer_const_value(initializer); vals->v.value = get_initializer_const_value(initializer);
for (size_t i = 1; i < get_type_size_bytes(type); ++i) { for (size_t i = 1; i < get_type_size(type); ++i) {
vals[i].kind = NORMAL; vals[i].kind = NORMAL;
vals[i].type = NULL; vals[i].type = NULL;
vals[i].v.value = NULL; vals[i].v.value = NULL;
...@@ -1063,8 +1062,8 @@ static void emit_ir_initializer(normal_or_bitfield *vals, ...@@ -1063,8 +1062,8 @@ static void emit_ir_initializer(normal_or_bitfield *vals,
case IR_INITIALIZER_COMPOUND: case IR_INITIALIZER_COMPOUND:
if (is_Array_type(type)) { if (is_Array_type(type)) {
ir_type *element_type = get_array_element_type(type); ir_type *element_type = get_array_element_type(type);
size_t skip = get_type_size_bytes(element_type); size_t skip = get_type_size(element_type);
size_t alignment = get_type_alignment_bytes(element_type); size_t alignment = get_type_alignment(element_type);
size_t misalign = skip % alignment; size_t misalign = skip % alignment;
if (misalign != 0) { if (misalign != 0) {
skip += alignment - misalign; skip += alignment - misalign;
...@@ -1111,7 +1110,7 @@ static void emit_ir_initializer(normal_or_bitfield *vals, ...@@ -1111,7 +1110,7 @@ static void emit_ir_initializer(normal_or_bitfield *vals,
static void emit_tarval_data(ir_type *type, ir_tarval *tv) static void emit_tarval_data(ir_type *type, ir_tarval *tv)
{ {
size_t size = get_type_size_bytes(type); size_t size = get_type_size(type);
if (size > 8) { if (size > 8) {
assert(size % 4 == 0); assert(size % 4 == 0);
if (be_get_backend_param()->byte_order_big_endian) { if (be_get_backend_param()->byte_order_big_endian) {
...@@ -1145,7 +1144,7 @@ static void emit_tarval_data(ir_type *type, ir_tarval *tv) ...@@ -1145,7 +1144,7 @@ static void emit_tarval_data(ir_type *type, ir_tarval *tv)
*/ */
static void emit_node_data(ir_node *const init, ir_type *const type) static void emit_node_data(ir_node *const init, ir_type *const type)
{ {
size_t size = get_type_size_bytes(type); size_t size = get_type_size(type);
if (size == 12 || size == 16) { if (size == 12 || size == 16) {
if (!is_Const(init)) { if (!is_Const(init)) {
panic("12/16byte initializers only support Const nodes yet"); panic("12/16byte initializers only support Const nodes yet");
...@@ -1195,14 +1194,14 @@ static void emit_initializer(ir_entity const *const entity, ...@@ -1195,14 +1194,14 @@ static void emit_initializer(ir_entity const *const entity,
case NORMAL: case NORMAL:
if (vals[k].v.value != NULL) { if (vals[k].v.value != NULL) {
emit_node_data(vals[k].v.value, vals[k].type); emit_node_data(vals[k].v.value, vals[k].type);
elem_size = get_type_size_bytes(vals[k].type); elem_size = get_type_size(vals[k].type);
} else { } else {
elem_size = 0; elem_size = 0;
} }
break; break;
case TARVAL: case TARVAL:
emit_tarval_data(vals[k].type, vals[k].v.tarval); emit_tarval_data(vals[k].type, vals[k].v.tarval);
elem_size = get_type_size_bytes(vals[k].type); elem_size = get_type_size(vals[k].type);
break; break;
case STRING: case STRING:
elem_size = emit_string_initializer(vals[k].v.string); elem_size = emit_string_initializer(vals[k].v.string);
...@@ -1242,7 +1241,7 @@ static unsigned get_effective_entity_alignment(const ir_entity *entity) ...@@ -1242,7 +1241,7 @@ static unsigned get_effective_entity_alignment(const ir_entity *entity)
unsigned alignment = get_entity_alignment(entity); unsigned alignment = get_entity_alignment(entity);
if (alignment == 0) { if (alignment == 0) {
ir_type *type = get_entity_type(entity); ir_type *type = get_entity_type(entity);
alignment = get_type_alignment_bytes(type); alignment = get_type_alignment(type);
} }
return alignment; return alignment;
} }
...@@ -1514,7 +1513,7 @@ static void emit_global(be_main_env_t const *const main_env, ...@@ -1514,7 +1513,7 @@ static void emit_global(be_main_env_t const *const main_env,
be_emit_cstring("object\n\t.size\t"); be_emit_cstring("object\n\t.size\t");
be_gas_emit_entity(entity); be_gas_emit_entity(entity);
ir_type *const type = get_entity_type(entity); ir_type *const type = get_entity_type(entity);
be_emit_irprintf(", %u\n", get_type_size_bytes(type)); be_emit_irprintf(", %u\n", get_type_size(type));
} }
ident *ld_ident = get_entity_ld_ident(entity); ident *ld_ident = get_entity_ld_ident(entity);
......
...@@ -137,8 +137,7 @@ static void merge_spilltypes(spillweb_t *web, const ir_type *type1) ...@@ -137,8 +137,7 @@ static void merge_spilltypes(spillweb_t *web, const ir_type *type1)
return; return;
} }
assert(modes_compatible(get_type_mode(type0), get_type_mode(type1))); assert(modes_compatible(get_type_mode(type0), get_type_mode(type1)));
web->type = get_type_size_bytes(type1) > get_type_size_bytes(type0) web->type = get_type_size(type1) > get_type_size(type0) ? type1 : type0;
? type1 : type0;
} }
static spillweb_t *get_spill_web(spillweb_t *begin) static spillweb_t *get_spill_web(spillweb_t *begin)
...@@ -482,8 +481,8 @@ static void assign_spillslots(be_fec_env_t *env) ...@@ -482,8 +481,8 @@ static void assign_spillslots(be_fec_env_t *env)
int slotid = spill->spillslot; int slotid = spill->spillslot;
const spillweb_t *web = get_spill_web(spill->web); const spillweb_t *web = get_spill_web(spill->web);
const ir_type *type = web->type; const ir_type *type = web->type;
int size = get_type_size_bytes(type); int size = get_type_size(type);
int align = get_type_alignment_bytes(type); int align = get_type_alignment(type);
spill_slot_t *slot = &spillslots[slotid]; spill_slot_t *slot = &spillslots[slotid];
if (slot->align == 0 && slot->size == 0) { if (slot->align == 0 && slot->size == 0) {
......
...@@ -37,7 +37,7 @@ int be_get_stack_entity_offset(be_stack_layout_t *frame, ir_entity *ent, ...@@ -37,7 +37,7 @@ int be_get_stack_entity_offset(be_stack_layout_t *frame, ir_entity *ent,
if (frame->order[index] == t) if (frame->order[index] == t)
break; break;
/* Add the size of all the types below the one of the entity to the entity's offset */ /* Add the size of all the types below the one of the entity to the entity's offset */
ofs += get_type_size_bytes(frame->order[index]); ofs += get_type_size(frame->order[index]);
} }
/* correct the offset by the initial position of the frame pointer */ /* correct the offset by the initial position of the frame pointer */
ofs -= frame->initial_offset; ofs -= frame->initial_offset;
...@@ -64,7 +64,7 @@ static void stack_frame_compute_initial_offset(be_stack_layout_t *frame) ...@@ -64,7 +64,7 @@ static void stack_frame_compute_initial_offset(be_stack_layout_t *frame)
ir_type *base = frame->between_type; ir_type *base = frame->between_type;
ir_entity *ent = search_ent_with_offset(base, 0); ir_entity *ent = search_ent_with_offset(base, 0);
if (ent == NULL) { if (ent == NULL) {
frame->initial_offset = get_type_size_bytes(frame->frame_type); frame->initial_offset = get_type_size(frame->frame_type);
} else { } else {
frame->initial_offset = be_get_stack_entity_offset(frame, ent, 0); frame->initial_offset = be_get_stack_entity_offset(frame, ent, 0);
} }
...@@ -116,7 +116,7 @@ static void process_stack_bias(bias_walk *bw, ir_node *bl, int real_bias, int wa ...@@ -116,7 +116,7 @@ static void process_stack_bias(bias_walk *bw, ir_node *bl, int real_bias, int wa
/* fill in real stack frame size */ /* fill in real stack frame size */
if (align > 0) { if (align > 0) {
/* patch IncSP to produce an aligned stack pointer */ /* patch IncSP to produce an aligned stack pointer */
int const between_size = get_type_size_bytes(layout->between_type); int const between_size = get_type_size(layout->between_type);
int const alignment = 1 << align; int const alignment = 1 << align;
int const delta = (real_bias + ofs + between_size) & (alignment - 1); int const delta = (real_bias + ofs + between_size) & (alignment - 1);
assert(ofs >= 0); assert(ofs >= 0);
......
...@@ -42,7 +42,8 @@ void be_default_lower_va_arg(ir_node *node) ...@@ -42,7 +42,8 @@ void be_default_lower_va_arg(ir_node *node)
} }
backend_params const *const be_params = be_get_backend_param(); backend_params const *const be_params = be_get_backend_param();
unsigned round_up = round_up2(get_type_size_bytes(aptype), be_params->stack_param_align); unsigned const round_up = round_up2(get_type_size(aptype),
be_params->stack_param_align);
ir_mode *const offset_mode = get_reference_offset_mode(mode_P); ir_mode *const offset_mode = get_reference_offset_mode(mode_P);
ir_node *const offset = new_r_Const_long(irg, offset_mode, round_up); ir_node *const offset = new_r_Const_long(irg, offset_mode, round_up);
ir_node *const new_ap = new_rd_Add(dbgi, block, ap, offset, mode_P); ir_node *const new_ap = new_rd_Add(dbgi, block, ap, offset, mode_P);
......
...@@ -229,15 +229,15 @@ static void ia32_build_between_type(void) ...@@ -229,15 +229,15 @@ static void ia32_build_between_type(void)
ret_addr_ent = new_entity(between_type, NEW_IDENT("ret_addr"), ret_addr_type); ret_addr_ent = new_entity(between_type, NEW_IDENT("ret_addr"), ret_addr_type);
set_entity_offset(old_bp_ent, <