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; }
void init_mode(void) { obstack_init(&modes); mode_list = NEW_ARR_F(ir_mode*, 0); /* initialize predefined modes */ mode_BB = new_internal_mode("BB", irms_block); mode_X = new_internal_mode("X", irms_control_flow); mode_M = new_internal_mode("M", irms_memory); mode_T = new_internal_mode("T", irms_tuple); mode_ANY = new_internal_mode("ANY", irms_any); mode_BAD = new_internal_mode("BAD", irms_bad); mode_b = new_internal_mode("b", irms_internal_boolean); mode_F = new_float_mode("F", irma_ieee754, 8, 23); mode_D = new_float_mode("D", irma_ieee754, 11, 52); mode_Q = new_float_mode("Q", irma_ieee754, 15, 112); 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_LLs = new_int_mode("LLs", irma_twos_complement, 128, 1, 128); mode_LLu = new_int_mode("LLu", irma_twos_complement, 128, 0, 128); mode_P = new_reference_mode("P", irma_twos_complement, 32, 32); set_reference_mode_signed_eq(mode_P, mode_Is); set_reference_mode_unsigned_eq(mode_P, mode_Iu); /* set the machine specific modes to the predefined ones */ mode_P_code = mode_P; mode_P_data = mode_P; }