+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)
+{
+ 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)
+{
+ 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, irma_x86_extended_float, 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);
+}
+
+ident *(get_mode_ident)(const ir_mode *mode)
+{
+ return get_mode_ident_(mode);
+}
+
+const char *get_mode_name(const ir_mode *mode)
+{
+ return get_id_str(mode->name);
+}