void init_mode(void) { obstack_init(&modes); mode_list = NEW_ARR_F(ir_mode*, 0); /* initialize predefined modes */ mode_BB = new_non_data_mode("BB"); mode_X = new_non_data_mode("X"); mode_M = new_non_data_mode("M"); mode_T = new_non_data_mode("T"); mode_ANY = new_non_data_mode("ANY"); mode_BAD = new_non_data_mode("BAD"); mode_b = alloc_mode("b", irms_internal_boolean, irma_none, 1, 0, 0); mode_b = register_mode(mode_b); mode_F = new_float_mode("F", irma_ieee754, 8, 23, ir_overflow_min_max); mode_D = new_float_mode("D", irma_ieee754, 11, 52, ir_overflow_min_max); mode_Bs = new_int_mode("Bs", irma_twos_complement, 8, 1, 32); mode_Bu = new_int_mode("Bu", irma_twos_complement, 8, 0, 32); mode_Hs = new_int_mode("Hs", irma_twos_complement, 16, 1, 32); mode_Hu = new_int_mode("Hu", irma_twos_complement, 16, 0, 32); mode_Is = new_int_mode("Is", irma_twos_complement, 32, 1, 32); mode_Iu = new_int_mode("Iu", irma_twos_complement, 32, 0, 32); mode_Ls = new_int_mode("Ls", irma_twos_complement, 64, 1, 64); mode_Lu = new_int_mode("Lu", irma_twos_complement, 64, 0, 64); mode_P = new_reference_mode("P", irma_twos_complement, 32, 32); }
ir_mode *new_reference_mode(const char *name, ir_mode_arithmetic arithmetic, unsigned bit_size, unsigned modulo_shift) { ir_mode *result = alloc_mode(name, irms_reference, arithmetic, bit_size, 0, modulo_shift); return register_mode(result); }
ir_mode *new_float_mode(const char *name, ir_mode_arithmetic arithmetic, unsigned exponent_size, unsigned mantissa_size, float_int_conversion_overflow_style_t conv_overflow) { bool explicit_one = false; unsigned bit_size = exponent_size + mantissa_size + 1; if (arithmetic == irma_x86_extended_float) { explicit_one = true; } else if (arithmetic != irma_ieee754) { panic("arithmetic %s invalid for float"); } if (exponent_size >= 256) panic("exponents >= 256 bits not supported"); if (mantissa_size >= 256) panic("mantissa >= 256 bits not supported"); if (exponent_size >= (unsigned)sc_get_precision()) panic("cannot create mode: more bits than tarval module maximum"); if (mantissa_size >= (unsigned)sc_get_precision()) panic("cannot create mode: more bits than tarval module maximum"); ir_mode *result = alloc_mode(name, irms_float_number, arithmetic, bit_size, 1, 0); result->int_conv_overflow = conv_overflow; result->float_desc.exponent_size = exponent_size; result->float_desc.mantissa_size = mantissa_size; result->float_desc.explicit_one = explicit_one; return register_mode(result); }
ir_mode *new_int_mode(const char *name, ir_mode_arithmetic arithmetic, unsigned bit_size, int sign, unsigned modulo_shift) { ir_mode *result = alloc_mode(name, irms_int_number, arithmetic, bit_size, sign, modulo_shift); return register_mode(result); }
ir_mode *new_reference_mode(const char *name, ir_mode_arithmetic arithmetic, unsigned bit_size, unsigned modulo_shift) { if (bit_size >= (unsigned)sc_get_precision()) panic("cannot create mode: more bits than tarval module maximum"); ir_mode *result = alloc_mode(name, irms_reference, arithmetic, bit_size, 0, modulo_shift); ir_mode *res = register_mode(result); /* construct the unsigned_eq mode */ char buf[64]; snprintf(buf, sizeof(buf), "%s_iu", name); ir_mode *unsigned_eq = alloc_mode(buf, irms_int_number, arithmetic, bit_size, 0, modulo_shift); unsigned_eq = register_mode(unsigned_eq); set_reference_mode_unsigned_eq(res, unsigned_eq); return res; }
ir_mode *new_int_mode(const char *name, ir_mode_arithmetic arithmetic, unsigned bit_size, int sign, unsigned modulo_shift) { if (bit_size >= (unsigned)sc_get_precision()) panic("cannot create mode: more bits than tarval module maximum"); ir_mode *result = alloc_mode(name, irms_int_number, arithmetic, bit_size, sign, modulo_shift); return register_mode(result); }
ir_mode *new_float_mode(const char *name, ir_mode_arithmetic arithmetic, unsigned exponent_size, unsigned mantissa_size) { bool explicit_one = false; unsigned bit_size = exponent_size + mantissa_size + 1; ir_mode *result; if (arithmetic == irma_x86_extended_float) { explicit_one = true; bit_size++; } else if (arithmetic != irma_ieee754) { panic("Arithmetic %s invalid for float"); } if (exponent_size >= 256) panic("Exponents >= 256 bits not supported"); if (mantissa_size >= 256) panic("Mantissa >= 256 bits not supported"); result = alloc_mode(name, irms_float_number, arithmetic, bit_size, 1, 0); result->float_desc.exponent_size = exponent_size; result->float_desc.mantissa_size = mantissa_size; result->float_desc.explicit_one = explicit_one; return register_mode(result); }
static ir_mode *new_non_data_mode(const char *name) { ir_mode *result = alloc_mode(name, irms_auxiliary, irma_none, 0, 0, 0); return register_mode(result); }
ir_mode *new_non_arithmetic_mode(const char *name, unsigned bit_size) { ir_mode *result = alloc_mode(name, irms_data, irma_none, bit_size, 0, 0); return register_mode(result); }
static ir_mode *new_internal_mode(const char *name, ir_mode_sort sort) { ir_mode *mode = alloc_mode(name, sort, irma_none, 0, 0, 0); return register_mode(mode); }