Commit 05e3bdb9 by Per Bothner

Use new macro AGGREGATE_TYPE_P.

From-SVN: r7160
parent 947765f9
...@@ -631,11 +631,7 @@ expand_call (exp, target, ignore) ...@@ -631,11 +631,7 @@ expand_call (exp, target, ignore)
/* Warn if this value is an aggregate type, /* Warn if this value is an aggregate type,
regardless of which calling convention we are using for it. */ regardless of which calling convention we are using for it. */
if (warn_aggregate_return if (warn_aggregate_return && AGGREGATE_TYPE_P (TREE_TYPE (exp)))
&& (TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE
|| TREE_CODE (TREE_TYPE (exp)) == UNION_TYPE
|| TREE_CODE (TREE_TYPE (exp)) == QUAL_UNION_TYPE
|| TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE))
warning ("function call has aggregate value"); warning ("function call has aggregate value");
/* Set up a place to return a structure. */ /* Set up a place to return a structure. */
...@@ -1039,11 +1035,7 @@ expand_call (exp, target, ignore) ...@@ -1039,11 +1035,7 @@ expand_call (exp, target, ignore)
copy = assign_stack_temp (TYPE_MODE (type), size, 1); copy = assign_stack_temp (TYPE_MODE (type), size, 1);
} }
MEM_IN_STRUCT_P (copy) MEM_IN_STRUCT_P (copy) = AGGREGATE_TYPE_P (type);
= (TREE_CODE (type) == RECORD_TYPE
|| TREE_CODE (type) == UNION_TYPE
|| TREE_CODE (type) == QUAL_UNION_TYPE
|| TREE_CODE (type) == ARRAY_TYPE);
store_expr (args[i].tree_value, copy, 0); store_expr (args[i].tree_value, copy, 0);
...@@ -1498,10 +1490,7 @@ expand_call (exp, target, ignore) ...@@ -1498,10 +1490,7 @@ expand_call (exp, target, ignore)
addr = plus_constant (addr, arg_offset); addr = plus_constant (addr, arg_offset);
args[i].stack = gen_rtx (MEM, args[i].mode, addr); args[i].stack = gen_rtx (MEM, args[i].mode, addr);
MEM_IN_STRUCT_P (args[i].stack) MEM_IN_STRUCT_P (args[i].stack)
= (TREE_CODE (TREE_TYPE (args[i].tree_value)) == RECORD_TYPE = AGGREGATE_TYPE_P (TREE_TYPE (args[i].tree_value));
|| TREE_CODE (TREE_TYPE (args[i].tree_value)) == UNION_TYPE
|| TREE_CODE (TREE_TYPE (args[i].tree_value)) == QUAL_UNION_TYPE
|| TREE_CODE (TREE_TYPE (args[i].tree_value)) == ARRAY_TYPE);
if (GET_CODE (slot_offset) == CONST_INT) if (GET_CODE (slot_offset) == CONST_INT)
addr = plus_constant (arg_reg, INTVAL (slot_offset)); addr = plus_constant (arg_reg, INTVAL (slot_offset));
...@@ -1941,11 +1930,7 @@ expand_call (exp, target, ignore) ...@@ -1941,11 +1930,7 @@ expand_call (exp, target, ignore)
target = gen_rtx (MEM, TYPE_MODE (TREE_TYPE (exp)), target = gen_rtx (MEM, TYPE_MODE (TREE_TYPE (exp)),
memory_address (TYPE_MODE (TREE_TYPE (exp)), memory_address (TYPE_MODE (TREE_TYPE (exp)),
structure_value_addr)); structure_value_addr));
MEM_IN_STRUCT_P (target) MEM_IN_STRUCT_P (target) = AGGREGATE_TYPE_P (TREE_TYPE (exp));
= (TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE
|| TREE_CODE (TREE_TYPE (exp)) == RECORD_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)
...@@ -1964,11 +1949,7 @@ expand_call (exp, target, ignore) ...@@ -1964,11 +1949,7 @@ expand_call (exp, target, ignore)
int_size_in_bytes (TREE_TYPE (exp)), int_size_in_bytes (TREE_TYPE (exp)),
0); 0);
MEM_IN_STRUCT_P (target) MEM_IN_STRUCT_P (target) = AGGREGATE_TYPE_P (TREE_TYPE (exp));
= (TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE
|| TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE
|| TREE_CODE (TREE_TYPE (exp)) == UNION_TYPE
|| TREE_CODE (TREE_TYPE (exp)) == QUAL_UNION_TYPE);
/* Save this temp slot around the pop below. */ /* Save this temp slot around the pop below. */
preserve_temp_slots (target); preserve_temp_slots (target);
......
...@@ -3915,11 +3915,7 @@ expand_expr (exp, target, tmode, modifier) ...@@ -3915,11 +3915,7 @@ expand_expr (exp, target, tmode, modifier)
{ {
temp temp
= assign_stack_temp (mode, int_size_in_bytes (type), 0); = assign_stack_temp (mode, int_size_in_bytes (type), 0);
MEM_IN_STRUCT_P (temp) MEM_IN_STRUCT_P (temp) = AGGREGATE_TYPE_P (type);
= (TREE_CODE (type) == RECORD_TYPE
|| TREE_CODE (type) == UNION_TYPE
|| TREE_CODE (type) == QUAL_UNION_TYPE
|| TREE_CODE (type) == ARRAY_TYPE);
} }
else else
temp = gen_reg_rtx (promote_mode (type, mode, &unsignedp, 0)); temp = gen_reg_rtx (promote_mode (type, mode, &unsignedp, 0));
...@@ -4106,11 +4102,9 @@ expand_expr (exp, target, tmode, modifier) ...@@ -4106,11 +4102,9 @@ expand_expr (exp, target, tmode, modifier)
target = gen_reg_rtx (tmode != VOIDmode ? tmode : mode); target = gen_reg_rtx (tmode != VOIDmode ? tmode : mode);
else else
{ {
enum tree_code c = TREE_CODE (type);
target target
= assign_stack_temp (mode, int_size_in_bytes (type), 0); = assign_stack_temp (mode, int_size_in_bytes (type), 0);
if (c == RECORD_TYPE || c == UNION_TYPE if (AGGREGATE_TYPE_P (type))
|| c == QUAL_UNION_TYPE || c == ARRAY_TYPE)
MEM_IN_STRUCT_P (target) = 1; MEM_IN_STRUCT_P (target) = 1;
} }
} }
...@@ -4153,16 +4147,10 @@ expand_expr (exp, target, tmode, modifier) ...@@ -4153,16 +4147,10 @@ expand_expr (exp, target, tmode, modifier)
if (TREE_CODE (TREE_OPERAND (exp, 0)) == PLUS_EXPR if (TREE_CODE (TREE_OPERAND (exp, 0)) == PLUS_EXPR
|| (TREE_CODE (TREE_OPERAND (exp, 0)) == SAVE_EXPR || (TREE_CODE (TREE_OPERAND (exp, 0)) == SAVE_EXPR
&& TREE_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)) == PLUS_EXPR) && TREE_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)) == PLUS_EXPR)
|| TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE || AGGREGATE_TYPE_P (TREE_TYPE (exp))
|| TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE
|| TREE_CODE (TREE_TYPE (exp)) == UNION_TYPE
|| TREE_CODE (TREE_TYPE (exp)) == QUAL_UNION_TYPE
|| (TREE_CODE (exp1) == ADDR_EXPR || (TREE_CODE (exp1) == ADDR_EXPR
&& (exp2 = TREE_OPERAND (exp1, 0)) && (exp2 = TREE_OPERAND (exp1, 0))
&& (TREE_CODE (TREE_TYPE (exp2)) == ARRAY_TYPE && AGGREGATE_TYPE_P (TREE_TYPE (exp2))))
|| TREE_CODE (TREE_TYPE (exp2)) == RECORD_TYPE
|| TREE_CODE (TREE_TYPE (exp2)) == UNION_TYPE
|| TREE_CODE (TREE_TYPE (exp2)) == QUAL_UNION_TYPE)))
MEM_IN_STRUCT_P (temp) = 1; MEM_IN_STRUCT_P (temp) = 1;
MEM_VOLATILE_P (temp) = TREE_THIS_VOLATILE (exp) | flag_volatile; MEM_VOLATILE_P (temp) = TREE_THIS_VOLATILE (exp) | flag_volatile;
#if 0 /* It is incorrect to set RTX_UNCHANGING_P here, because the fact that #if 0 /* It is incorrect to set RTX_UNCHANGING_P here, because the fact that
...@@ -5341,11 +5329,7 @@ expand_expr (exp, target, tmode, modifier) ...@@ -5341,11 +5329,7 @@ expand_expr (exp, target, tmode, modifier)
(TREE_INT_CST_LOW (TYPE_SIZE (type)) (TREE_INT_CST_LOW (TYPE_SIZE (type))
+ BITS_PER_UNIT - 1) + BITS_PER_UNIT - 1)
/ BITS_PER_UNIT, 0); / BITS_PER_UNIT, 0);
MEM_IN_STRUCT_P (temp) MEM_IN_STRUCT_P (temp) = AGGREGATE_TYPE_P (type);
= (TREE_CODE (type) == RECORD_TYPE
|| TREE_CODE (type) == UNION_TYPE
|| TREE_CODE (type) == QUAL_UNION_TYPE
|| TREE_CODE (type) == ARRAY_TYPE);
} }
else else
temp = gen_reg_rtx (mode); temp = gen_reg_rtx (mode);
......
...@@ -1218,11 +1218,7 @@ put_reg_into_stack (function, reg, type, promoted_mode, decl_mode) ...@@ -1218,11 +1218,7 @@ put_reg_into_stack (function, reg, type, promoted_mode, decl_mode)
/* If this is a memory ref that contains aggregate components, /* If this is a memory ref that contains aggregate components,
mark it as such for cse and loop optimize. */ mark it as such for cse and loop optimize. */
MEM_IN_STRUCT_P (reg) MEM_IN_STRUCT_P (reg) = AGGREGATE_TYPE_P (type);
= (TREE_CODE (type) == ARRAY_TYPE
|| TREE_CODE (type) == RECORD_TYPE
|| TREE_CODE (type) == UNION_TYPE
|| TREE_CODE (type) == 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. */
...@@ -2996,11 +2992,7 @@ aggregate_value_p (exp) ...@@ -2996,11 +2992,7 @@ aggregate_value_p (exp)
if (RETURN_IN_MEMORY (type)) if (RETURN_IN_MEMORY (type))
return 1; return 1;
if (flag_pcc_struct_return if (flag_pcc_struct_return && AGGREGATE_TYPE_P (type))
&& (TREE_CODE (type) == RECORD_TYPE
|| TREE_CODE (type) == UNION_TYPE
|| TREE_CODE (type) == QUAL_UNION_TYPE
|| TREE_CODE (type) == ARRAY_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. */
...@@ -3119,11 +3111,7 @@ assign_parms (fndecl, second_time) ...@@ -3119,11 +3111,7 @@ assign_parms (fndecl, second_time)
for (parm = fnargs; parm; parm = TREE_CHAIN (parm)) for (parm = fnargs; parm; parm = TREE_CHAIN (parm))
{ {
int aggregate int aggregate = AGGREGATE_TYPE_P (TREE_TYPE (parm));
= (TREE_CODE (TREE_TYPE (parm)) == ARRAY_TYPE
|| TREE_CODE (TREE_TYPE (parm)) == RECORD_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;
...@@ -3704,11 +3692,7 @@ assign_parms (fndecl, second_time) ...@@ -3704,11 +3692,7 @@ assign_parms (fndecl, second_time)
DECL_RTL (result) DECL_RTL (result)
= gen_rtx (MEM, DECL_MODE (result), DECL_RTL (parm)); = gen_rtx (MEM, DECL_MODE (result), DECL_RTL (parm));
MEM_IN_STRUCT_P (DECL_RTL (result)) MEM_IN_STRUCT_P (DECL_RTL (result)) = AGGREGATE_TYPE_P (restype);
= (TREE_CODE (restype) == RECORD_TYPE
|| TREE_CODE (restype) == UNION_TYPE
|| TREE_CODE (restype) == QUAL_UNION_TYPE
|| TREE_CODE (restype) == ARRAY_TYPE);
} }
if (TREE_THIS_VOLATILE (parm)) if (TREE_THIS_VOLATILE (parm))
...@@ -4031,10 +4015,7 @@ uninitialized_vars_warning (block) ...@@ -4031,10 +4015,7 @@ uninitialized_vars_warning (block)
because assigning the fields one by one can fail to convince because assigning the fields one by one can fail to convince
flow.c that the entire aggregate was initialized. flow.c that the entire aggregate was initialized.
Unions are troublesome because members may be shorter. */ Unions are troublesome because members may be shorter. */
&& TREE_CODE (TREE_TYPE (decl)) != RECORD_TYPE && ! AGGREGATE_TYPE_P (TREE_TYPE (decl))
&& TREE_CODE (TREE_TYPE (decl)) != UNION_TYPE
&& TREE_CODE (TREE_TYPE (decl)) != QUAL_UNION_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
&& regno_uninitialized (REGNO (DECL_RTL (decl)))) && regno_uninitialized (REGNO (DECL_RTL (decl))))
...@@ -4662,10 +4643,7 @@ init_function_start (subr, filename, line) ...@@ -4662,10 +4643,7 @@ init_function_start (subr, filename, line)
/* Warn if this value is an aggregate type, /* Warn if this value is an aggregate type,
regardless of which calling convention we are using for it. */ regardless of which calling convention we are using for it. */
if (warn_aggregate_return if (warn_aggregate_return
&& (TREE_CODE (TREE_TYPE (DECL_RESULT (subr))) == RECORD_TYPE && AGGREGATE_TYPE_P (TREE_TYPE (DECL_RESULT (subr))))
|| 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))
warning ("function returns an aggregate"); warning ("function returns an aggregate");
current_function_returns_pointer current_function_returns_pointer
...@@ -4886,10 +4864,7 @@ expand_function_start (subr, parms_have_cleanups) ...@@ -4886,10 +4864,7 @@ expand_function_start (subr, parms_have_cleanups)
DECL_RTL (DECL_RESULT (subr)) DECL_RTL (DECL_RESULT (subr))
= gen_rtx (MEM, DECL_MODE (DECL_RESULT (subr)), value_address); = gen_rtx (MEM, DECL_MODE (DECL_RESULT (subr)), value_address);
MEM_IN_STRUCT_P (DECL_RTL (DECL_RESULT (subr))) MEM_IN_STRUCT_P (DECL_RTL (DECL_RESULT (subr)))
= (TREE_CODE (TREE_TYPE (DECL_RESULT (subr))) == RECORD_TYPE = AGGREGATE_TYPE_P (TREE_TYPE (DECL_RESULT (subr)));
|| 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);
} }
} }
else if (DECL_MODE (DECL_RESULT (subr)) == VOIDmode) else if (DECL_MODE (DECL_RESULT (subr)) == VOIDmode)
......
...@@ -3500,11 +3500,7 @@ expand_decl (decl) ...@@ -3500,11 +3500,7 @@ expand_decl (decl)
/* If this is a memory ref that contains aggregate components, /* If this is a memory ref that contains aggregate components,
mark it as such for cse and loop optimize. */ mark it as such for cse and loop optimize. */
MEM_IN_STRUCT_P (DECL_RTL (decl)) MEM_IN_STRUCT_P (DECL_RTL (decl)) = AGGREGATE_TYPE_P (TREE_TYPE (decl));
= (TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE
|| TREE_CODE (TREE_TYPE (decl)) == RECORD_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
...@@ -3551,11 +3547,7 @@ expand_decl (decl) ...@@ -3551,11 +3547,7 @@ expand_decl (decl)
/* If this is a memory ref that contains aggregate components, /* If this is a memory ref that contains aggregate components,
mark it as such for cse and loop optimize. */ mark it as such for cse and loop optimize. */
MEM_IN_STRUCT_P (DECL_RTL (decl)) MEM_IN_STRUCT_P (DECL_RTL (decl)) = AGGREGATE_TYPE_P (TREE_TYPE (decl));
= (TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE
|| TREE_CODE (TREE_TYPE (decl)) == RECORD_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
......
...@@ -540,10 +540,7 @@ make_decl_rtl (decl, asmspec, top_level) ...@@ -540,10 +540,7 @@ make_decl_rtl (decl, asmspec, top_level)
if (TREE_READONLY (decl)) if (TREE_READONLY (decl))
RTX_UNCHANGING_P (DECL_RTL (decl)) = 1; RTX_UNCHANGING_P (DECL_RTL (decl)) = 1;
MEM_IN_STRUCT_P (DECL_RTL (decl)) MEM_IN_STRUCT_P (DECL_RTL (decl))
= (TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE = AGGREGATE_TYPE_P (TREE_TYPE (decl));
|| TREE_CODE (TREE_TYPE (decl)) == RECORD_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.
...@@ -2613,8 +2610,7 @@ output_constant_def (exp) ...@@ -2613,8 +2610,7 @@ output_constant_def (exp)
TREE_CST_RTL (exp) TREE_CST_RTL (exp)
= gen_rtx (MEM, TYPE_MODE (TREE_TYPE (exp)), def); = gen_rtx (MEM, TYPE_MODE (TREE_TYPE (exp)), def);
RTX_UNCHANGING_P (TREE_CST_RTL (exp)) = 1; RTX_UNCHANGING_P (TREE_CST_RTL (exp)) = 1;
if (TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE if (AGGREGATE_TYPE_P (TREE_TYPE (exp)))
|| TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE)
MEM_IN_STRUCT_P (TREE_CST_RTL (exp)) = 1; MEM_IN_STRUCT_P (TREE_CST_RTL (exp)) = 1;
pop_obstacks (); pop_obstacks ();
......
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