Commit c1b98a95 by Richard Kenner

Treat QUAL_UNION_TYPE like UNION_TYPE when seeing if aggregate.

From-SVN: r4118
parent e7f3c83f
...@@ -588,6 +588,7 @@ expand_call (exp, target, ignore) ...@@ -588,6 +588,7 @@ expand_call (exp, target, ignore)
if (warn_aggregate_return if (warn_aggregate_return
&& (TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE && (TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE
|| TREE_CODE (TREE_TYPE (exp)) == UNION_TYPE || TREE_CODE (TREE_TYPE (exp)) == UNION_TYPE
|| TREE_CODE (TREE_TYPE (exp)) == QUAL_UNION_TYPE
|| TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE)) || TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE))
warning ("function call has aggregate value"); warning ("function call has aggregate value");
...@@ -1798,7 +1799,8 @@ expand_call (exp, target, ignore) ...@@ -1798,7 +1799,8 @@ expand_call (exp, target, ignore)
MEM_IN_STRUCT_P (target) MEM_IN_STRUCT_P (target)
= (TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE = (TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE
|| TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE || TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE
|| TREE_CODE (TREE_TYPE (exp)) == UNION_TYPE); || TREE_CODE (TREE_TYPE (exp)) == UNION_TYPE
|| TREE_CODE (TREE_TYPE (exp)) == QUAL_UNION_TYPE);
} }
} }
else if (pcc_struct_value) else if (pcc_struct_value)
...@@ -1810,7 +1812,8 @@ expand_call (exp, target, ignore) ...@@ -1810,7 +1812,8 @@ expand_call (exp, target, ignore)
MEM_IN_STRUCT_P (target) MEM_IN_STRUCT_P (target)
= (TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE = (TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE
|| TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE || TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE
|| TREE_CODE (TREE_TYPE (exp)) == UNION_TYPE); || TREE_CODE (TREE_TYPE (exp)) == UNION_TYPE
|| TREE_CODE (TREE_TYPE (exp)) == QUAL_UNION_TYPE);
} }
else if (TYPE_MODE (TREE_TYPE (exp)) != BLKmode) else if (TYPE_MODE (TREE_TYPE (exp)) != BLKmode)
emit_move_insn (target, gen_rtx (MEM, TYPE_MODE (TREE_TYPE (exp)), emit_move_insn (target, gen_rtx (MEM, TYPE_MODE (TREE_TYPE (exp)),
......
...@@ -568,6 +568,7 @@ dbxout_type_fields (type) ...@@ -568,6 +568,7 @@ dbxout_type_fields (type)
/* For nameless subunions and subrecords, treat their fields as ours. */ /* For nameless subunions and subrecords, treat their fields as ours. */
if (DECL_NAME (tem) == NULL_TREE if (DECL_NAME (tem) == NULL_TREE
&& (TREE_CODE (TREE_TYPE (tem)) == UNION_TYPE && (TREE_CODE (TREE_TYPE (tem)) == UNION_TYPE
|| TREE_CODE (TREE_TYPE (tem)) == QUAL_UNION_TYPE
|| TREE_CODE (TREE_TYPE (tem)) == RECORD_TYPE)) || TREE_CODE (TREE_TYPE (tem)) == RECORD_TYPE))
dbxout_type_fields (TREE_TYPE (tem)); dbxout_type_fields (TREE_TYPE (tem));
/* Omit here local type decls until we know how to support them. */ /* Omit here local type decls until we know how to support them. */
...@@ -952,6 +953,7 @@ dbxout_type (type, full, show_arg_types) ...@@ -952,6 +953,7 @@ dbxout_type (type, full, show_arg_types)
leave the type-number completely undefined rather than output leave the type-number completely undefined rather than output
a cross-reference. */ a cross-reference. */
if (TREE_CODE (type) == RECORD_TYPE || TREE_CODE (type) == UNION_TYPE if (TREE_CODE (type) == RECORD_TYPE || TREE_CODE (type) == UNION_TYPE
|| TREE_CODE (type) == QUAL_UNION_TYPE
|| TREE_CODE (type) == ENUMERAL_TYPE) || TREE_CODE (type) == ENUMERAL_TYPE)
if ((TYPE_NAME (type) != 0 && !full) if ((TYPE_NAME (type) != 0 && !full)
...@@ -1093,6 +1095,7 @@ dbxout_type (type, full, show_arg_types) ...@@ -1093,6 +1095,7 @@ dbxout_type (type, full, show_arg_types)
case RECORD_TYPE: case RECORD_TYPE:
case UNION_TYPE: case UNION_TYPE:
case QUAL_UNION_TYPE:
{ {
int i, n_baseclasses = 0; int i, n_baseclasses = 0;
...@@ -1505,7 +1508,8 @@ dbxout_symbol (decl, local) ...@@ -1505,7 +1508,8 @@ dbxout_symbol (decl, local)
which gives both a typedef name and a tag. */ which gives both a typedef name and a tag. */
/* dbx requires the tag first and the typedef second. */ /* dbx requires the tag first and the typedef second. */
if ((TREE_CODE (type) == RECORD_TYPE if ((TREE_CODE (type) == RECORD_TYPE
|| TREE_CODE (type) == UNION_TYPE) || TREE_CODE (type) == UNION_TYPE
|| TREE_CODE (type) == QUAL_UNION_TYPE)
&& TYPE_NAME (type) == decl && TYPE_NAME (type) == decl
&& !(use_gnu_debug_info_extensions && have_used_extensions) && !(use_gnu_debug_info_extensions && have_used_extensions)
&& !TREE_ASM_WRITTEN (TYPE_NAME (type)) && !TREE_ASM_WRITTEN (TYPE_NAME (type))
...@@ -1534,7 +1538,8 @@ dbxout_symbol (decl, local) ...@@ -1534,7 +1538,8 @@ dbxout_symbol (decl, local)
/* Short cut way to output a tag also. */ /* Short cut way to output a tag also. */
if ((TREE_CODE (type) == RECORD_TYPE if ((TREE_CODE (type) == RECORD_TYPE
|| TREE_CODE (type) == UNION_TYPE) || TREE_CODE (type) == UNION_TYPE
|| TREE_CODE (type) == QUAL_UNION_TYPE)
&& TYPE_NAME (type) == decl) && TYPE_NAME (type) == decl)
{ {
if (use_gnu_debug_info_extensions && have_used_extensions) if (use_gnu_debug_info_extensions && have_used_extensions)
......
...@@ -770,7 +770,8 @@ is_tagged_type (type) ...@@ -770,7 +770,8 @@ is_tagged_type (type)
{ {
register enum tree_code code = TREE_CODE (type); register enum tree_code code = TREE_CODE (type);
return (code == RECORD_TYPE || code == UNION_TYPE || code == ENUMERAL_TYPE); return (code == RECORD_TYPE || code == UNION_TYPE
|| code == QUAL_UNION_TYPE || code == ENUMERAL_TYPE);
} }
static char * static char *
...@@ -1379,6 +1380,7 @@ type_is_fundamental (type) ...@@ -1379,6 +1380,7 @@ type_is_fundamental (type)
case ARRAY_TYPE: case ARRAY_TYPE:
case RECORD_TYPE: case RECORD_TYPE:
case UNION_TYPE: case UNION_TYPE:
case QUAL_UNION_TYPE:
case ENUMERAL_TYPE: case ENUMERAL_TYPE:
case FUNCTION_TYPE: case FUNCTION_TYPE:
case METHOD_TYPE: case METHOD_TYPE:
...@@ -2390,6 +2392,7 @@ byte_size_attribute (tree_node) ...@@ -2390,6 +2392,7 @@ byte_size_attribute (tree_node)
case ENUMERAL_TYPE: case ENUMERAL_TYPE:
case RECORD_TYPE: case RECORD_TYPE:
case UNION_TYPE: case UNION_TYPE:
case QUAL_UNION_TYPE:
size = int_size_in_bytes (tree_node); size = int_size_in_bytes (tree_node);
break; break;
...@@ -3760,11 +3763,12 @@ pend_type (type) ...@@ -3760,11 +3763,12 @@ pend_type (type)
FUNCTION_DECL node (for types local to the heading of some function FUNCTION_DECL node (for types local to the heading of some function
definition), or to a FUNCTION_TYPE node (for types local to the definition), or to a FUNCTION_TYPE node (for types local to the
prototyped parameter list of a function type specification), or to a prototyped parameter list of a function type specification), or to a
RECORD_TYPE or UNION_TYPE node (in the case of C++ nested types). RECORD_TYPE, UNION_TYPE, or QUAL_UNION_TYPE node
(in the case of C++ nested types).
The `scope' parameter should likewise be NULL or should point to a The `scope' parameter should likewise be NULL or should point to a
BLOCK node, a FUNCTION_DECL node, a FUNCTION_TYPE node, a RECORD_TYPE BLOCK node, a FUNCTION_DECL node, a FUNCTION_TYPE node, a RECORD_TYPE
node, or a UNION_TYPE node. node, a UNION_TYPE node, or a QUAL_UNION_TYPE node.
This function is used only for deciding when to "pend" and when to This function is used only for deciding when to "pend" and when to
"un-pend" types to/from the pending_types_list. "un-pend" types to/from the pending_types_list.
...@@ -3949,15 +3953,16 @@ output_type (type, containing_scope) ...@@ -3949,15 +3953,16 @@ output_type (type, containing_scope)
case ENUMERAL_TYPE: case ENUMERAL_TYPE:
case RECORD_TYPE: case RECORD_TYPE:
case UNION_TYPE: case UNION_TYPE:
case QUAL_UNION_TYPE:
/* For a non-file-scope tagged type, we can always go ahead and /* For a non-file-scope tagged type, we can always go ahead and
output a Dwarf description of this type right now, even if output a Dwarf description of this type right now, even if
the type in question is still incomplete, because if this the type in question is still incomplete, because if this
local type *was* ever completed anywhere within its scope, local type *was* ever completed anywhere within its scope,
that complete definition would already have been attached to that complete definition would already have been attached to
this RECORD_TYPE, UNION_TYPE or ENUMERAL_TYPE node by the this RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE or ENUMERAL_TYPE
time we reach this point. That's true because of the way the node by the time we reach this point. That's true because of the
front-end does its processing of file-scope declarations (of way the front-end does its processing of file-scope declarations (of
functions and class types) within which other types might be functions and class types) within which other types might be
nested. The C and C++ front-ends always gobble up such "local nested. The C and C++ front-ends always gobble up such "local
scope" things en-mass before they try to output *any* debugging scope" things en-mass before they try to output *any* debugging
...@@ -4002,6 +4007,7 @@ output_type (type, containing_scope) ...@@ -4002,6 +4007,7 @@ output_type (type, containing_scope)
break; break;
case UNION_TYPE: case UNION_TYPE:
case QUAL_UNION_TYPE:
output_die (output_union_type_die, type); output_die (output_union_type_die, type);
break; break;
...@@ -4066,9 +4072,9 @@ output_type (type, containing_scope) ...@@ -4066,9 +4072,9 @@ output_type (type, containing_scope)
} }
} }
/* RECORD_TYPEs and UNION_TYPEs are themselves scopes (at least /* RECORD_TYPEs, UNION_TYPEs, and QUAL_UNION_TYPEs are themselves
in C++) so we must now output any nested pending types which scopes (at least in C++) so we must now output any nested
are local just to this RECORD_TYPE or UNION_TYPE. */ pending types which are local just to this type. */
output_pending_types_for_scope (type); output_pending_types_for_scope (type);
...@@ -4125,6 +4131,7 @@ output_tagged_type_instantiation (type) ...@@ -4125,6 +4131,7 @@ output_tagged_type_instantiation (type)
break; break;
case UNION_TYPE: case UNION_TYPE:
case QUAL_UNION_TYPE:
output_die (output_inlined_union_type_die, type); output_die (output_inlined_union_type_die, type);
break; break;
......
...@@ -883,7 +883,8 @@ put_var_into_stack (decl) ...@@ -883,7 +883,8 @@ put_var_into_stack (decl)
MEM_IN_STRUCT_P (reg) MEM_IN_STRUCT_P (reg)
= (TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE = (TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE
|| TREE_CODE (TREE_TYPE (decl)) == RECORD_TYPE || TREE_CODE (TREE_TYPE (decl)) == RECORD_TYPE
|| TREE_CODE (TREE_TYPE (decl)) == UNION_TYPE); || TREE_CODE (TREE_TYPE (decl)) == UNION_TYPE
|| TREE_CODE (TREE_TYPE (decl)) == QUAL_UNION_TYPE);
/* Now make sure that all refs to the variable, previously made /* Now make sure that all refs to the variable, previously made
when it was a register, are fixed up to be valid again. */ when it was a register, are fixed up to be valid again. */
...@@ -2650,7 +2651,8 @@ aggregate_value_p (exp) ...@@ -2650,7 +2651,8 @@ aggregate_value_p (exp)
return 1; return 1;
if (flag_pcc_struct_return if (flag_pcc_struct_return
&& (TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE && (TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE
|| TREE_CODE (TREE_TYPE (exp)) == UNION_TYPE)) || TREE_CODE (TREE_TYPE (exp)) == UNION_TYPE
|| TREE_CODE (TREE_TYPE (exp)) == QUAL_UNION_TYPE))
return 1; return 1;
/* Make sure we have suitable call-clobbered regs to return /* Make sure we have suitable call-clobbered regs to return
the value in; if not, we must return it in memory. */ the value in; if not, we must return it in memory. */
...@@ -2768,7 +2770,8 @@ assign_parms (fndecl, second_time) ...@@ -2768,7 +2770,8 @@ assign_parms (fndecl, second_time)
int aggregate int aggregate
= (TREE_CODE (TREE_TYPE (parm)) == ARRAY_TYPE = (TREE_CODE (TREE_TYPE (parm)) == ARRAY_TYPE
|| TREE_CODE (TREE_TYPE (parm)) == RECORD_TYPE || TREE_CODE (TREE_TYPE (parm)) == RECORD_TYPE
|| TREE_CODE (TREE_TYPE (parm)) == UNION_TYPE); || TREE_CODE (TREE_TYPE (parm)) == UNION_TYPE
|| TREE_CODE (TREE_TYPE (parm)) == QUAL_UNION_TYPE);
struct args_size stack_offset; struct args_size stack_offset;
struct args_size arg_size; struct args_size arg_size;
int passed_pointer = 0; int passed_pointer = 0;
...@@ -3593,6 +3596,7 @@ uninitialized_vars_warning (block) ...@@ -3593,6 +3596,7 @@ uninitialized_vars_warning (block)
Unions are troublesome because members may be shorter. */ Unions are troublesome because members may be shorter. */
&& TREE_CODE (TREE_TYPE (decl)) != RECORD_TYPE && TREE_CODE (TREE_TYPE (decl)) != RECORD_TYPE
&& TREE_CODE (TREE_TYPE (decl)) != UNION_TYPE && TREE_CODE (TREE_TYPE (decl)) != UNION_TYPE
&& TREE_CODE (TREE_TYPE (decl)) != QUAL_UNION_TYPE
&& TREE_CODE (TREE_TYPE (decl)) != ARRAY_TYPE && TREE_CODE (TREE_TYPE (decl)) != ARRAY_TYPE
&& DECL_RTL (decl) != 0 && DECL_RTL (decl) != 0
&& GET_CODE (DECL_RTL (decl)) == REG && GET_CODE (DECL_RTL (decl)) == REG
...@@ -4166,6 +4170,7 @@ init_function_start (subr, filename, line) ...@@ -4166,6 +4170,7 @@ init_function_start (subr, filename, line)
if (warn_aggregate_return if (warn_aggregate_return
&& (TREE_CODE (TREE_TYPE (DECL_RESULT (subr))) == RECORD_TYPE && (TREE_CODE (TREE_TYPE (DECL_RESULT (subr))) == RECORD_TYPE
|| TREE_CODE (TREE_TYPE (DECL_RESULT (subr))) == UNION_TYPE || TREE_CODE (TREE_TYPE (DECL_RESULT (subr))) == UNION_TYPE
|| TREE_CODE (TREE_TYPE (DECL_RESULT (subr))) == QUAL_UNION_TYPE
|| TREE_CODE (TREE_TYPE (DECL_RESULT (subr))) == ARRAY_TYPE)) || TREE_CODE (TREE_TYPE (DECL_RESULT (subr))) == ARRAY_TYPE))
warning ("function returns an aggregate"); warning ("function returns an aggregate");
......
...@@ -449,7 +449,9 @@ print_node (file, prefix, node, indent) ...@@ -449,7 +449,9 @@ print_node (file, prefix, node, indent)
} }
else if (TREE_CODE (node) == REAL_TYPE) else if (TREE_CODE (node) == REAL_TYPE)
fprintf (file, " precision %d", TYPE_PRECISION (node)); fprintf (file, " precision %d", TYPE_PRECISION (node));
else if (TREE_CODE (node) == RECORD_TYPE || TREE_CODE (node) == UNION_TYPE) else if (TREE_CODE (node) == RECORD_TYPE
|| TREE_CODE (node) == UNION_TYPE
|| TREE_CODE (node) == QUAL_UNION_TYPE)
print_node (file, "fields", TYPE_FIELDS (node), indent + 4); print_node (file, "fields", TYPE_FIELDS (node), indent + 4);
else if (TREE_CODE (node) == FUNCTION_TYPE || TREE_CODE (node) == METHOD_TYPE) else if (TREE_CODE (node) == FUNCTION_TYPE || TREE_CODE (node) == METHOD_TYPE)
{ {
......
...@@ -527,6 +527,7 @@ plain_type_1 (type) ...@@ -527,6 +527,7 @@ plain_type_1 (type)
case RECORD_TYPE: case RECORD_TYPE:
case UNION_TYPE: case UNION_TYPE:
case QUAL_UNION_TYPE:
case ENUMERAL_TYPE: case ENUMERAL_TYPE:
{ {
char *tag; char *tag;
...@@ -558,6 +559,7 @@ plain_type_1 (type) ...@@ -558,6 +559,7 @@ plain_type_1 (type)
} }
return ((TREE_CODE (type) == RECORD_TYPE) ? T_STRUCT return ((TREE_CODE (type) == RECORD_TYPE) ? T_STRUCT
: (TREE_CODE (type) == UNION_TYPE) ? T_UNION : (TREE_CODE (type) == UNION_TYPE) ? T_UNION
: (TREE_CODE (type) == QUAL_UNION_TYPE) ? T_UNION
: T_ENUM); : T_ENUM);
} }
case POINTER_TYPE: case POINTER_TYPE:
...@@ -753,7 +755,8 @@ sdbout_symbol (decl, local) ...@@ -753,7 +755,8 @@ sdbout_symbol (decl, local)
within functions. */ within functions. */
if (TREE_CODE (type) == ENUMERAL_TYPE if (TREE_CODE (type) == ENUMERAL_TYPE
|| TREE_CODE (type) == RECORD_TYPE || TREE_CODE (type) == RECORD_TYPE
|| TREE_CODE (type) == UNION_TYPE) || TREE_CODE (type) == UNION_TYPE
|| TREE_CODE (type) == QUAL_UNION_TYPE)
{ {
if (TYPE_SIZE (type) != 0 /* not a forward reference */ if (TYPE_SIZE (type) != 0 /* not a forward reference */
&& KNOWN_TYPE_TAG (type) == 0) /* not yet declared */ && KNOWN_TYPE_TAG (type) == 0) /* not yet declared */
...@@ -992,6 +995,7 @@ sdbout_one_type (type) ...@@ -992,6 +995,7 @@ sdbout_one_type (type)
{ {
case RECORD_TYPE: case RECORD_TYPE:
case UNION_TYPE: case UNION_TYPE:
case QUAL_UNION_TYPE:
case ENUMERAL_TYPE: case ENUMERAL_TYPE:
type = TYPE_MAIN_VARIANT (type); type = TYPE_MAIN_VARIANT (type);
/* Don't output a type twice. */ /* Don't output a type twice. */
...@@ -1053,6 +1057,7 @@ sdbout_one_type (type) ...@@ -1053,6 +1057,7 @@ sdbout_one_type (type)
switch (TREE_CODE (type)) switch (TREE_CODE (type))
{ {
case UNION_TYPE: case UNION_TYPE:
case QUAL_UNION_TYPE:
PUT_SDB_SCL (C_UNTAG); PUT_SDB_SCL (C_UNTAG);
PUT_SDB_TYPE (T_UNION); PUT_SDB_TYPE (T_UNION);
member_scl = C_MOU; member_scl = C_MOU;
......
...@@ -2931,7 +2931,8 @@ expand_decl (decl) ...@@ -2931,7 +2931,8 @@ expand_decl (decl)
MEM_IN_STRUCT_P (DECL_RTL (decl)) MEM_IN_STRUCT_P (DECL_RTL (decl))
= (TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE = (TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE
|| TREE_CODE (TREE_TYPE (decl)) == RECORD_TYPE || TREE_CODE (TREE_TYPE (decl)) == RECORD_TYPE
|| TREE_CODE (TREE_TYPE (decl)) == UNION_TYPE); || TREE_CODE (TREE_TYPE (decl)) == UNION_TYPE
|| TREE_CODE (TREE_TYPE (decl)) == QUAL_UNION_TYPE);
#if 0 #if 0
/* If this is in memory because of -ffloat-store, /* If this is in memory because of -ffloat-store,
set the volatile bit, to prevent optimizations from set the volatile bit, to prevent optimizations from
...@@ -2981,7 +2982,8 @@ expand_decl (decl) ...@@ -2981,7 +2982,8 @@ expand_decl (decl)
MEM_IN_STRUCT_P (DECL_RTL (decl)) MEM_IN_STRUCT_P (DECL_RTL (decl))
= (TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE = (TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE
|| TREE_CODE (TREE_TYPE (decl)) == RECORD_TYPE || TREE_CODE (TREE_TYPE (decl)) == RECORD_TYPE
|| TREE_CODE (TREE_TYPE (decl)) == UNION_TYPE); || TREE_CODE (TREE_TYPE (decl)) == UNION_TYPE
|| TREE_CODE (TREE_TYPE (decl)) == QUAL_UNION_TYPE);
/* Indicate the alignment we actually gave this variable. */ /* Indicate the alignment we actually gave this variable. */
#ifdef STACK_BOUNDARY #ifdef STACK_BOUNDARY
......
...@@ -394,7 +394,8 @@ make_decl_rtl (decl, asmspec, top_level) ...@@ -394,7 +394,8 @@ make_decl_rtl (decl, asmspec, top_level)
MEM_IN_STRUCT_P (DECL_RTL (decl)) MEM_IN_STRUCT_P (DECL_RTL (decl))
= (TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE = (TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE
|| TREE_CODE (TREE_TYPE (decl)) == RECORD_TYPE || TREE_CODE (TREE_TYPE (decl)) == RECORD_TYPE
|| TREE_CODE (TREE_TYPE (decl)) == UNION_TYPE); || TREE_CODE (TREE_TYPE (decl)) == UNION_TYPE
|| TREE_CODE (TREE_TYPE (decl)) == QUAL_UNION_TYPE);
/* Optionally set flags or add text to the name to record information /* Optionally set flags or add text to the name to record information
such as that it is a function name. such as that it is a function name.
......
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