t = make_node_stat (code PASS_MEM_STAT);
TREE_TYPE (t) = tt;
- side_effects = TREE_SIDE_EFFECTS (t);
+ /* As a special exception, if COND_EXPR has NULL branches, we
+ assume that it is a gimple statement and always consider
+ it to have side effects. */
+ if (code == COND_EXPR
+ && tt == void_type_node
+ && arg1 == NULL_TREE
+ && arg2 == NULL_TREE)
+ side_effects = true;
+ else
+ side_effects = TREE_SIDE_EFFECTS (t);
PROCESS_ARG(0);
PROCESS_ARG(1);
TYPE_MAIN_VARIANT (t) = t;
TYPE_NEXT_VARIANT (t) = 0;
+ /* VRP assumes that TREE_TYPE (TYPE_MIN_VALUE (type)) == type. */
+ if (INTEGRAL_TYPE_P (t) || SCALAR_FLOAT_TYPE_P (t))
+ {
+ if (TYPE_MIN_VALUE (t) != NULL_TREE)
+ TYPE_MIN_VALUE (t) = fold_convert (t, TYPE_MIN_VALUE (t));
+ if (TYPE_MAX_VALUE (t) != NULL_TREE)
+ TYPE_MAX_VALUE (t) = fold_convert (t, TYPE_MAX_VALUE (t));
+ }
+
return t;
}
name = 0;
if (name != 0)
- TYPE_NAME (t) = get_identifier (name);
+ TYPE_NAME (t) = build_decl (TYPE_DECL, get_identifier (name), t);
}
return build_qualified_type (t, TYPE_QUALS (component_type));
return !fit_double_type (low, high, &low, &high, type);
}
+/* Stores bounds of an integer TYPE in MIN and MAX. If TYPE has non-constant
+ bounds or is a POINTER_TYPE, the maximum and/or minimum values that can be
+ represented (assuming two's-complement arithmetic) within the bit
+ precision of the type are returned instead. */
+
+void
+get_type_static_bounds (tree type, mpz_t min, mpz_t max)
+{
+ if (!POINTER_TYPE_P (type) && TYPE_MIN_VALUE (type)
+ && TREE_CODE (TYPE_MIN_VALUE (type)) == INTEGER_CST)
+ mpz_set_double_int (min, tree_to_double_int (TYPE_MIN_VALUE (type)),
+ TYPE_UNSIGNED (type));
+ else
+ {
+ if (TYPE_UNSIGNED (type))
+ mpz_set_ui (min, 0);
+ else
+ {
+ double_int mn;
+ mn = double_int_mask (TYPE_PRECISION (type) - 1);
+ mn = double_int_sext (double_int_add (mn, double_int_one),
+ TYPE_PRECISION (type));
+ mpz_set_double_int (min, mn, false);
+ }
+ }
+
+ if (!POINTER_TYPE_P (type) && TYPE_MAX_VALUE (type)
+ && TREE_CODE (TYPE_MAX_VALUE (type)) == INTEGER_CST)
+ mpz_set_double_int (max, tree_to_double_int (TYPE_MAX_VALUE (type)),
+ TYPE_UNSIGNED (type));
+ else
+ {
+ if (TYPE_UNSIGNED (type))
+ mpz_set_double_int (max, double_int_mask (TYPE_PRECISION (type)),
+ true);
+ else
+ mpz_set_double_int (max, double_int_mask (TYPE_PRECISION (type) - 1),
+ true);
+ }
+}
+
/* Subprogram of following function. Called by walk_tree.
Return *TP if it is an automatic variable or parameter of the
TYPE_MODE (dfloat128_type_node) = TDmode;
dfloat128_ptr_type_node = build_pointer_type (dfloat128_type_node);
- complex_integer_type_node = make_node (COMPLEX_TYPE);
- TREE_TYPE (complex_integer_type_node) = integer_type_node;
- layout_type (complex_integer_type_node);
-
- complex_float_type_node = make_node (COMPLEX_TYPE);
- TREE_TYPE (complex_float_type_node) = float_type_node;
- layout_type (complex_float_type_node);
-
- complex_double_type_node = make_node (COMPLEX_TYPE);
- TREE_TYPE (complex_double_type_node) = double_type_node;
- layout_type (complex_double_type_node);
-
- complex_long_double_type_node = make_node (COMPLEX_TYPE);
- TREE_TYPE (complex_long_double_type_node) = long_double_type_node;
- layout_type (complex_long_double_type_node);
+ complex_integer_type_node = build_complex_type (integer_type_node);
+ complex_float_type_node = build_complex_type (float_type_node);
+ complex_double_type_node = build_complex_type (double_type_node);
+ complex_long_double_type_node = build_complex_type (long_double_type_node);
{
tree t = targetm.build_builtin_va_list ();
reconstruct_complex_type (tree type, tree bottom)
{
tree inner, outer;
-
- if (POINTER_TYPE_P (type))
+
+ if (TREE_CODE (type) == POINTER_TYPE)
+ {
+ inner = reconstruct_complex_type (TREE_TYPE (type), bottom);
+ outer = build_pointer_type_for_mode (inner, TYPE_MODE (type),
+ TYPE_REF_CAN_ALIAS_ALL (type));
+ }
+ else if (TREE_CODE (type) == REFERENCE_TYPE)
{
inner = reconstruct_complex_type (TREE_TYPE (type), bottom);
- outer = build_pointer_type (inner);
+ outer = build_reference_type_for_mode (inner, TYPE_MODE (type),
+ TYPE_REF_CAN_ALIAS_ALL (type));
}
else if (TREE_CODE (type) == ARRAY_TYPE)
{