Commit d1c1f3df authored by Christoph Mallon's avatar Christoph Mallon
Browse files

Do not unnecessarily create new types for modes.

parent 80e73631
......@@ -53,8 +53,8 @@ void amd64_set_va_stack_args_param(ir_entity *param)
ir_type *amd64_build_va_list_type(void)
{
ir_type *const int_type = new_type_primitive(mode_Is);
ir_type *const ptr_type = new_type_pointer(new_type_primitive(mode_ANY));
ir_type *const int_type = get_type_for_mode(mode_Is);
ir_type *const ptr_type = new_type_pointer(get_type_for_mode(mode_ANY));
ir_type *const va_list_type = new_type_struct(new_id_from_str("builtin:va_list"));
va_list_members.gp_offset = new_entity(va_list_type, new_id_from_str("gp_offset"), int_type);
......
......@@ -1389,17 +1389,17 @@ static void ia32_init(void)
ir_mode *mode_long_long
= new_int_mode("long long", irma_twos_complement, 64, 1, 64);
ir_type *type_long_long = new_type_primitive(mode_long_long);
ir_type *type_long_long = get_type_for_mode(mode_long_long);
ir_mode *mode_unsigned_long_long
= new_int_mode("unsigned long long", irma_twos_complement, 64, 0, 64);
ir_type *type_unsigned_long_long
= new_type_primitive(mode_unsigned_long_long);
= get_type_for_mode(mode_unsigned_long_long);
ia32_backend_params.type_long_long = type_long_long;
ia32_backend_params.type_unsigned_long_long = type_unsigned_long_long;
// va_list is a void pointer
ir_type *type_va_list = new_type_pointer(new_type_primitive(mode_ANY));
ir_type *type_va_list = new_type_pointer(get_type_for_mode(mode_ANY));
ia32_backend_params.vararg.va_list_type = type_va_list;
if (ia32_cg_config.use_sse2 || ia32_cg_config.use_softfloat) {
......
......@@ -300,11 +300,11 @@ static void sparc_create_runtime_entities(void)
if (rem != NULL)
return;
ir_type *const int_tp = new_type_primitive(mode_Is);
ir_type *const int_tp = get_type_for_mode(mode_Is);
ir_type *const mod_tp = make_mod_type(int_tp);
rem = create_compilerlib_entity(new_id_from_str(".rem"), mod_tp);
ir_type *const uint_tp = new_type_primitive(mode_Iu);
ir_type *const uint_tp = get_type_for_mode(mode_Iu);
ir_type *const umod_tp = make_mod_type(uint_tp);
urem = create_compilerlib_entity(new_id_from_str(".urem"), umod_tp);
}
......@@ -549,13 +549,13 @@ static const backend_params *sparc_get_backend_params(void)
ir_mode *mode_long_long
= new_int_mode("long long", irma_twos_complement, 64, 1, 64);
ir_type *type_long_long = new_type_primitive(mode_long_long);
ir_type *type_long_long = get_type_for_mode(mode_long_long);
ir_mode *mode_unsigned_long_long
= new_int_mode("unsigned long long", irma_twos_complement, 64, 0, 64);
ir_type *type_unsigned_long_long
= new_type_primitive(mode_unsigned_long_long);
= get_type_for_mode(mode_unsigned_long_long);
ir_type *type_va_list
= new_type_pointer(new_type_primitive(mode_ANY));
= new_type_pointer(get_type_for_mode(mode_ANY));
p.type_long_long = type_long_long;
p.type_unsigned_long_long = type_unsigned_long_long;
......@@ -563,7 +563,7 @@ static const backend_params *sparc_get_backend_params(void)
sparc_mode_Q
= new_float_mode("Q", irma_ieee754, 15, 112, ir_overflow_min_max);
ir_type *type_long_double = new_type_primitive(sparc_mode_Q);
ir_type *type_long_double = get_type_for_mode(sparc_mode_Q);
set_type_alignment(type_long_double, 8);
set_type_size(type_long_double, 16);
p.type_long_double = type_long_double;
......
......@@ -153,9 +153,9 @@ static ir_entity *get_init_firmprof_ref(void)
{
ident *const init_name = new_id_from_str("__init_firmprof");
ir_type *const init_type = new_type_method(3, 0, false);
ir_type *const uint = new_type_primitive(mode_Iu);
ir_type *const uint = get_type_for_mode(mode_Iu);
ir_type *const uintptr = new_type_pointer(uint);
ir_type *const string = new_type_pointer(new_type_primitive(mode_Bs));
ir_type *const string = new_type_pointer(get_type_for_mode(mode_Bs));
set_method_param_type(init_type, 0, string);
set_method_param_type(init_type, 1, uintptr);
......@@ -356,7 +356,7 @@ static void instrument_irg(ir_graph *irg, ir_entity *counters, block_id_walker_d
*/
static ir_entity *new_array_entity(ident *name, int size)
{
ir_type *const uint_type = new_type_primitive(mode_Iu);
ir_type *const uint_type = get_type_for_mode(mode_Iu);
ir_type *const array_type = new_type_array(uint_type, size);
ir_type *const owner = get_glob_type();
......@@ -370,7 +370,7 @@ static ir_entity *new_array_entity(ident *name, int size)
static ir_entity *new_static_string_entity(ident *name, const char *string)
{
/* Create the type for a fixed-length string */
ir_type *const char_type = new_type_primitive(mode_Bs);
ir_type *const char_type = get_type_for_mode(mode_Bs);
size_t const length = strlen(string) + 1;
ir_type *const string_type = new_type_array(char_type, length);
......
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