[lto] Fix lto_type_for_mode
Diego Novillo
dnovillo@google.com
Mon Jun 1 12:35:00 GMT 2009
lto_type_for_mode was not handling some cases needed by the
timode tests in the torture tests. This fixes 36 tests in the
testsuite.
Tested on x86_64.
Diego.
* lto-lang.c (lto_type_for_mode): Handle all the modes
handled in c_common_type_for_mode.
Index: lto/lto-lang.c
===================================================================
--- lto/lto-lang.c (revision 148004)
+++ lto/lto-lang.c (working copy)
@@ -795,12 +795,37 @@ lto_type_for_mode (enum machine_mode mod
{
tree t;
- /* This hook is called by the middle-end. For example,
- assign_stack_local_1 uses this hook to determine whether
- additional alignment is required for stack variables for which no
- explicit alignment is provided. */
- if (SCALAR_INT_MODE_P (mode))
- return lto_type_for_size (GET_MODE_BITSIZE (mode), unsigned_p);
+ if (mode == TYPE_MODE (integer_type_node))
+ return unsigned_p ? unsigned_type_node : integer_type_node;
+
+ if (mode == TYPE_MODE (signed_char_type_node))
+ return unsigned_p ? unsigned_char_type_node : signed_char_type_node;
+
+ if (mode == TYPE_MODE (short_integer_type_node))
+ return unsigned_p ? short_unsigned_type_node : short_integer_type_node;
+
+ if (mode == TYPE_MODE (long_integer_type_node))
+ return unsigned_p ? long_unsigned_type_node : long_integer_type_node;
+
+ if (mode == TYPE_MODE (long_long_integer_type_node))
+ return unsigned_p ? long_long_unsigned_type_node : long_long_integer_type_node;
+
+ if (mode == QImode)
+ return unsigned_p ? unsigned_intQI_type_node : intQI_type_node;
+
+ if (mode == HImode)
+ return unsigned_p ? unsigned_intHI_type_node : intHI_type_node;
+
+ if (mode == SImode)
+ return unsigned_p ? unsigned_intSI_type_node : intSI_type_node;
+
+ if (mode == DImode)
+ return unsigned_p ? unsigned_intDI_type_node : intDI_type_node;
+
+#if HOST_BITS_PER_WIDE_INT >= 64
+ if (mode == TYPE_MODE (intTI_type_node))
+ return unsigned_p ? unsigned_intTI_type_node : intTI_type_node;
+#endif
if (mode == TYPE_MODE (float_type_node))
return float_type_node;
@@ -852,6 +877,102 @@ lto_type_for_mode (enum machine_mode mod
return build_vector_type_for_mode (inner_type, mode);
}
+ if (mode == TYPE_MODE (dfloat32_type_node))
+ return dfloat32_type_node;
+ if (mode == TYPE_MODE (dfloat64_type_node))
+ return dfloat64_type_node;
+ if (mode == TYPE_MODE (dfloat128_type_node))
+ return dfloat128_type_node;
+
+ if (ALL_SCALAR_FIXED_POINT_MODE_P (mode))
+ {
+ if (mode == TYPE_MODE (short_fract_type_node))
+ return unsigned_p ? sat_short_fract_type_node : short_fract_type_node;
+ if (mode == TYPE_MODE (fract_type_node))
+ return unsigned_p ? sat_fract_type_node : fract_type_node;
+ if (mode == TYPE_MODE (long_fract_type_node))
+ return unsigned_p ? sat_long_fract_type_node : long_fract_type_node;
+ if (mode == TYPE_MODE (long_long_fract_type_node))
+ return unsigned_p ? sat_long_long_fract_type_node
+ : long_long_fract_type_node;
+
+ if (mode == TYPE_MODE (unsigned_short_fract_type_node))
+ return unsigned_p ? sat_unsigned_short_fract_type_node
+ : unsigned_short_fract_type_node;
+ if (mode == TYPE_MODE (unsigned_fract_type_node))
+ return unsigned_p ? sat_unsigned_fract_type_node
+ : unsigned_fract_type_node;
+ if (mode == TYPE_MODE (unsigned_long_fract_type_node))
+ return unsigned_p ? sat_unsigned_long_fract_type_node
+ : unsigned_long_fract_type_node;
+ if (mode == TYPE_MODE (unsigned_long_long_fract_type_node))
+ return unsigned_p ? sat_unsigned_long_long_fract_type_node
+ : unsigned_long_long_fract_type_node;
+
+ if (mode == TYPE_MODE (short_accum_type_node))
+ return unsigned_p ? sat_short_accum_type_node : short_accum_type_node;
+ if (mode == TYPE_MODE (accum_type_node))
+ return unsigned_p ? sat_accum_type_node : accum_type_node;
+ if (mode == TYPE_MODE (long_accum_type_node))
+ return unsigned_p ? sat_long_accum_type_node : long_accum_type_node;
+ if (mode == TYPE_MODE (long_long_accum_type_node))
+ return unsigned_p ? sat_long_long_accum_type_node
+ : long_long_accum_type_node;
+
+ if (mode == TYPE_MODE (unsigned_short_accum_type_node))
+ return unsigned_p ? sat_unsigned_short_accum_type_node
+ : unsigned_short_accum_type_node;
+ if (mode == TYPE_MODE (unsigned_accum_type_node))
+ return unsigned_p ? sat_unsigned_accum_type_node
+ : unsigned_accum_type_node;
+ if (mode == TYPE_MODE (unsigned_long_accum_type_node))
+ return unsigned_p ? sat_unsigned_long_accum_type_node
+ : unsigned_long_accum_type_node;
+ if (mode == TYPE_MODE (unsigned_long_long_accum_type_node))
+ return unsigned_p ? sat_unsigned_long_long_accum_type_node
+ : unsigned_long_long_accum_type_node;
+
+ if (mode == QQmode)
+ return unsigned_p ? sat_qq_type_node : qq_type_node;
+ if (mode == HQmode)
+ return unsigned_p ? sat_hq_type_node : hq_type_node;
+ if (mode == SQmode)
+ return unsigned_p ? sat_sq_type_node : sq_type_node;
+ if (mode == DQmode)
+ return unsigned_p ? sat_dq_type_node : dq_type_node;
+ if (mode == TQmode)
+ return unsigned_p ? sat_tq_type_node : tq_type_node;
+
+ if (mode == UQQmode)
+ return unsigned_p ? sat_uqq_type_node : uqq_type_node;
+ if (mode == UHQmode)
+ return unsigned_p ? sat_uhq_type_node : uhq_type_node;
+ if (mode == USQmode)
+ return unsigned_p ? sat_usq_type_node : usq_type_node;
+ if (mode == UDQmode)
+ return unsigned_p ? sat_udq_type_node : udq_type_node;
+ if (mode == UTQmode)
+ return unsigned_p ? sat_utq_type_node : utq_type_node;
+
+ if (mode == HAmode)
+ return unsigned_p ? sat_ha_type_node : ha_type_node;
+ if (mode == SAmode)
+ return unsigned_p ? sat_sa_type_node : sa_type_node;
+ if (mode == DAmode)
+ return unsigned_p ? sat_da_type_node : da_type_node;
+ if (mode == TAmode)
+ return unsigned_p ? sat_ta_type_node : ta_type_node;
+
+ if (mode == UHAmode)
+ return unsigned_p ? sat_uha_type_node : uha_type_node;
+ if (mode == USAmode)
+ return unsigned_p ? sat_usa_type_node : usa_type_node;
+ if (mode == UDAmode)
+ return unsigned_p ? sat_uda_type_node : uda_type_node;
+ if (mode == UTAmode)
+ return unsigned_p ? sat_uta_type_node : uta_type_node;
+ }
+
for (t = registered_builtin_types; t; t = TREE_CHAIN (t))
if (TYPE_MODE (TREE_VALUE (t)) == mode)
return TREE_VALUE (t);
More information about the Gcc-patches
mailing list