Commit 99db1ef0 by Richard Henderson Committed by Richard Henderson

c-common.c (handle_mode_attribute): When not modifying in place, create subtypes for enumerations.

        * c-common.c (handle_mode_attribute): When not modifying in place,
        create subtypes for enumerations.
        (sync_resolve_return): Use TYPE_MAIN_VARIANT.
        * gimplify.c (create_tmp_from_val): Likewise.

From-SVN: r104603
parent e347ff9e
2005-09-24 Richard Henderson <rth@redhat.com>
* c-common.c (handle_mode_attribute): When not modifying in place,
create subtypes for enumerations.
(sync_resolve_return): Use TYPE_MAIN_VARIANT.
* gimplify.c (create_tmp_from_val): Likewise.
2005-09-24 Alexandre Oliva <aoliva@redhat.com> 2005-09-24 Alexandre Oliva <aoliva@redhat.com>
* config/i386/i386.md (*tls_global_dynamic_64, * config/i386/i386.md (*tls_global_dynamic_64,
......
...@@ -4520,21 +4520,24 @@ handle_mode_attribute (tree *node, tree name, tree args, ...@@ -4520,21 +4520,24 @@ handle_mode_attribute (tree *node, tree name, tree args,
return NULL_TREE; return NULL_TREE;
} }
if (!(flags & (int) ATTR_FLAG_TYPE_IN_PLACE)) if (flags & ATTR_FLAG_TYPE_IN_PLACE)
type = build_variant_type_copy (type); {
TYPE_PRECISION (type) = TYPE_PRECISION (typefm);
/* We cannot use layout_type here, because that will attempt typefm = type;
to re-layout all variants, corrupting our original. */ }
TYPE_PRECISION (type) = TYPE_PRECISION (typefm); else
TYPE_MIN_VALUE (type) = TYPE_MIN_VALUE (typefm); {
TYPE_MAX_VALUE (type) = TYPE_MAX_VALUE (typefm); /* We cannot build a type variant, as there's code that assumes
TYPE_SIZE (type) = TYPE_SIZE (typefm); that TYPE_MAIN_VARIANT has the same mode. This includes the
TYPE_SIZE_UNIT (type) = TYPE_SIZE_UNIT (typefm); debug generators. Instead, create a subrange type. This
TYPE_MODE (type) = TYPE_MODE (typefm); results in all of the enumeral values being emitted only once
if (!TYPE_USER_ALIGN (type)) in the original, and the subtype gets them by reference. */
TYPE_ALIGN (type) = TYPE_ALIGN (typefm); if (TYPE_UNSIGNED (type))
typefm = make_unsigned_type (TYPE_PRECISION (typefm));
typefm = type; else
typefm = make_signed_type (TYPE_PRECISION (typefm));
TREE_TYPE (typefm) = type;
}
} }
else if (VECTOR_MODE_P (mode) else if (VECTOR_MODE_P (mode)
? TREE_CODE (type) != TREE_CODE (TREE_TYPE (typefm)) ? TREE_CODE (type) != TREE_CODE (TREE_TYPE (typefm))
...@@ -6119,6 +6122,7 @@ static tree ...@@ -6119,6 +6122,7 @@ static tree
sync_resolve_return (tree params, tree result) sync_resolve_return (tree params, tree result)
{ {
tree ptype = TREE_TYPE (TREE_TYPE (TREE_VALUE (params))); tree ptype = TREE_TYPE (TREE_TYPE (TREE_VALUE (params)));
ptype = TYPE_MAIN_VARIANT (ptype);
return convert (ptype, result); return convert (ptype, result);
} }
......
...@@ -404,7 +404,7 @@ get_name (tree t) ...@@ -404,7 +404,7 @@ get_name (tree t)
static inline tree static inline tree
create_tmp_from_val (tree val) create_tmp_from_val (tree val)
{ {
return create_tmp_var (TREE_TYPE (val), get_name (val)); return create_tmp_var (TYPE_MAIN_VARIANT (TREE_TYPE (val)), get_name (val));
} }
/* Create a temporary to hold the value of VAL. If IS_FORMAL, try to reuse /* Create a temporary to hold the value of VAL. If IS_FORMAL, try to reuse
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment