-/* Data Modes */
- newmode.vector_elem = 1;
-
- /* Float Number Modes */
- newmode.sort = irms_float_number;
- newmode.arithmetic = irma_ieee754;
-
- /* float */
- newmode.name = id_from_str("F", 1);
- newmode.code = irm_F;
- newmode.sign = 1;
- newmode.align = 4;
- newmode.size = 32;
-
- mode_F = register_mode(&newmode);
-
- /* double */
- newmode.name = id_from_str("D", 1);
- newmode.code = irm_D;
- newmode.sign = 1;
- newmode.align = 4;
- newmode.size = 64;
-
- mode_D = register_mode(&newmode);
-
- /* extended */
- newmode.name = id_from_str("E", 1);
- newmode.code = irm_E;
- newmode.sign = 1;
- newmode.align = 4;
- newmode.size = 80;
-
- mode_E = register_mode(&newmode);
-
- /* Integer Number Modes */
- newmode.sort = irms_int_number;
- newmode.arithmetic = irma_twos_complement;
-
- /* signed byte */
- newmode.name = id_from_str("Bs", 2);
- newmode.code = irm_Bs;
- newmode.sign = 1;
- newmode.align = 1;
- newmode.size = 8;
- newmode.modulo_shift = 32;
-
- mode_Bs = register_mode(&newmode);
-
- /* unsigned byte */
- newmode.name = id_from_str("Bu", 2);
- newmode.code = irm_Bu;
- newmode.arithmetic = irma_twos_complement;
- newmode.sign = 0;
- newmode.align = 1;
- newmode.size = 8;
- newmode.modulo_shift = 32;
-
- mode_Bu = register_mode(&newmode);
-
- /* signed short integer */
- newmode.name = id_from_str("Hs", 2);
- newmode.code = irm_Hs;
- newmode.sign = 1;
- newmode.align = 2;
- newmode.size = 16;
- newmode.modulo_shift = 32;
-
- mode_Hs = register_mode(&newmode);
-
- /* unsigned short integer */
- newmode.name = id_from_str("Hu", 2);
- newmode.code = irm_Hu;
- newmode.sign = 0;
- newmode.align = 2;
- newmode.size = 16;
- newmode.modulo_shift = 32;
-
- mode_Hu = register_mode(&newmode);
-
- /* signed integer */
- newmode.name = id_from_str("Is", 2);
- newmode.code = irm_Is;
- newmode.sign = 1;
- newmode.align = 4;
- newmode.size = 32;
- newmode.modulo_shift = 32;
-
- mode_Is = register_mode(&newmode);
-
- /* unsigned integer */
- newmode.name = id_from_str("Iu", 2);
- newmode.code = irm_Iu;
- newmode.sign = 0;
- newmode.align = 4;
- newmode.size = 32;
- newmode.modulo_shift = 32;
-
- mode_Iu = register_mode(&newmode);
-
- /* signed long integer */
- newmode.name = id_from_str("Ls", 2);
- newmode.code = irm_Ls;
- newmode.sign = 1;
- newmode.align = 4;
- newmode.size = 64;
- newmode.modulo_shift = 64;
-
- mode_Ls = register_mode(&newmode);
-
- /* unsigned long integer */
- newmode.name = id_from_str("Lu", 2);
- newmode.code = irm_Lu;
- newmode.sign = 0;
- newmode.align = 4;
- newmode.size = 64;
- newmode.modulo_shift = 64;
-
- mode_Lu = register_mode(&newmode);
-
- /* Character Modes */
- newmode.sort = irms_character;
- newmode.arithmetic = irma_none;
-
- /* Character */
- newmode.name = id_from_str("C", 1);
- newmode.code = irm_C;
- newmode.sign = 0;
- newmode.align = 1;
- newmode.size = 8;
- newmode.modulo_shift = 32;
-
- mode_C = register_mode(&newmode);
-
- /* Unicode character */
- newmode.name = id_from_str("U", 1);
- newmode.code = irm_U;
- newmode.sign = 0;
- newmode.align = 2;
- newmode.size = 16;
- newmode.modulo_shift = 32;
-
- mode_U = register_mode(&newmode);
-
- /* Reference Modes */
- newmode.sort = irms_reference;
- newmode.arithmetic = irma_twos_complement;
-
- /* pointer */
- newmode.name = id_from_str("P", 1);
- newmode.code = irm_P;
- newmode.sign = 0;
- newmode.align = 4;
- newmode.size = 32;
- newmode.modulo_shift = 0;
-
- mode_P = register_mode(&newmode);
-
- /* set the machine specific modes to the predifined ones */
- mode_P_mach = mode_P;
+ /* signed long integer */
+ newmode.name = new_id_from_chars("Ls", 2);
+ newmode.code = irm_Ls;
+ newmode.sign = 1;
+ newmode.size = 64;
+ newmode.modulo_shift = 64;
+
+ mode_Ls = register_mode(&newmode);
+
+ /* unsigned long integer */
+ newmode.name = new_id_from_chars("Lu", 2);
+ newmode.code = irm_Lu;
+ newmode.sign = 0;
+ newmode.size = 64;
+ newmode.modulo_shift = 64;
+
+ mode_Lu = register_mode(&newmode);
+
+ /* signed long long integer */
+ newmode.name = new_id_from_chars("LLs", 3);
+ newmode.code = irm_LLs;
+ newmode.sign = 1;
+ newmode.size = 128;
+ newmode.modulo_shift = 128;
+
+ mode_LLs = register_mode(&newmode);
+
+ /* unsigned long long integer */
+ newmode.name = new_id_from_chars("LLu", 3);
+ newmode.code = irm_LLu;
+ newmode.sign = 0;
+ newmode.size = 128;
+ newmode.modulo_shift = 128;
+
+ mode_LLu = register_mode(&newmode);
+
+ /* Reference Mode */
+ newmode.sort = irms_reference;
+ newmode.arithmetic = irma_twos_complement;
+
+ /* pointer */
+ newmode.name = new_id_from_chars("P", 1);
+ newmode.code = irm_P;
+ newmode.sign = 0;
+ newmode.size = 32;
+ newmode.modulo_shift = 0;
+ newmode.eq_signed = mode_Is;
+ newmode.eq_unsigned = mode_Iu;
+
+ mode_P = register_mode(&newmode);
+
+ /* set the machine specific modes to the predefined ones */
+ mode_P_code = mode_P;
+ mode_P_data = mode_P;
+}
+
+/* find a signed mode for an unsigned integer mode */
+ir_mode *find_unsigned_mode(const ir_mode *mode) {
+ ir_mode n = *mode;
+
+ assert(mode->sort == irms_int_number);
+ n.sign = 0;
+ return find_mode(&n);
+}
+
+/* find an unsigned mode for a signed integer mode */
+ir_mode *find_signed_mode(const ir_mode *mode) {
+ ir_mode n = *mode;
+
+ assert(mode->sort == irms_int_number);
+ n.sign = 1;
+ return find_mode(&n);