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

Do not make a separate type for the x87 80bit floating point mode, but adjust...

Do not make a separate type for the x87 80bit floating point mode, but adjust the mode's type accordingly.

This removes unnecessary special case handling for 80bit floating point.
parent 1fdd74c0
......@@ -785,8 +785,8 @@ static void amd64_init_types(void)
* create constants with the xmm mode... */
amd64_mode_xmm = new_int_mode("x86_xmm", irma_twos_complement, 128, 0, 0);
x86_init_x87_type();
amd64_backend_params.type_long_double = x86_type_E;
ir_type *const type_f80 = x86_init_x87_type();
amd64_backend_params.type_long_double = type_f80;
amd64_backend_params.vararg.va_list_type = amd64_build_va_list_type();
}
......
......@@ -329,7 +329,7 @@ ir_entity *create_float_const_entity(ir_tarval *const tv)
return entity;
ir_mode *mode = get_tarval_mode(tv);
ir_type *type = mode == x86_mode_E ? x86_type_E : get_type_for_mode(mode);
ir_type *type = get_type_for_mode(mode);
ir_type *glob = get_glob_type();
entity = new_global_entity(glob, id_unique("C"), type,
......
......@@ -1406,9 +1406,9 @@ static void ia32_init(void)
ia32_backend_params.mode_float_arithmetic = NULL;
ia32_backend_params.type_long_double = NULL;
} else {
x86_init_x87_type();
ia32_backend_params.mode_float_arithmetic = x86_mode_E;
ia32_backend_params.type_long_double = x86_type_E;
ir_type *const type_f80 = x86_init_x87_type();
ia32_backend_params.mode_float_arithmetic = get_type_mode(type_f80);
ia32_backend_params.type_long_double = type_f80;
}
ia32_register_init();
......
......@@ -288,15 +288,6 @@ static ir_node *try_create_Immediate(const ir_node *node, char const constraint)
return ia32_create_Immediate_full(irg, &immediate);
}
static ir_type *get_prim_type(const ir_mode *mode)
{
if (mode == x86_mode_E) {
return x86_type_E;
} else {
return get_type_for_mode(mode);
}
}
static ir_entity *create_float_const_entity(ir_tarval *tv, ident *name)
{
ir_mode *mode = get_tarval_mode(tv);
......@@ -320,7 +311,7 @@ static ir_entity *create_float_const_entity(ir_tarval *tv, ident *name)
if (!name)
name = id_unique("C");
ir_type *const tp = get_prim_type(mode);
ir_type *const tp = get_type_for_mode(mode);
res = new_global_entity(get_glob_type(), name, tp,
ir_visibility_private,
IR_LINKAGE_CONSTANT | IR_LINKAGE_NO_IDENTITY);
......@@ -545,7 +536,7 @@ ir_entity *ia32_gen_fp_known_const(ia32_known_const_t const kct)
ir_tarval *tv = new_tarval_from_str(cnst_str, strlen(cnst_str), mode);
if (kct == ia32_ULLBIAS) {
ir_type *type = get_prim_type(ia32_mode_float32);
ir_type *type = get_type_for_mode(ia32_mode_float32);
ir_type *atype = ia32_create_float_array(type);
ent = new_global_entity(get_glob_type(), name, atype,
......@@ -3238,7 +3229,7 @@ static ir_entity *ia32_create_const_array(ir_node *c0, ir_node *c1,
}
ir_type *tp = get_prim_type(mode);
ir_type *tp = get_type_for_mode(mode);
tp = ia32_create_float_array(tp);
ir_entity *ent
......
......@@ -1650,13 +1650,14 @@ void x86_init_x87(void)
FIRM_DBG_REGISTER(dbg, "firm.be.x86.x87");
}
void x86_init_x87_type(void)
ir_type *x86_init_x87_type(void)
{
/* note mantissa is 64bit but with explicitely encoded 1 so the really
* usable part as counted by firm is only 63 bits */
x86_mode_E = new_float_mode("E", irma_x86_extended_float, 15, 64,
ir_overflow_indefinite);
x86_type_E = new_type_primitive(x86_mode_E);
set_type_size(x86_type_E, 12);
set_type_alignment(x86_type_E, 4);
ir_type *const type_f80 = get_type_for_mode(x86_mode_E);
set_type_size(type_f80, 12);
set_type_alignment(type_f80, 4);
return type_f80;
}
......@@ -109,7 +109,7 @@ void x86_x87_simulate_graph(ir_graph *irg, const x87_simulator_config_t *cfg);
void x86_init_x87(void);
/** Initialize x87 mode+type/ */
void x86_init_x87_type(void);
ir_type *x86_init_x87_type(void);
extern ir_mode *x86_mode_E;
extern ir_type *x86_type_E;
......
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