OSDN Git Service

Use new macro AGGREGATE_TYPE_P.
authorbothner <bothner@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 26 Apr 1994 23:56:21 +0000 (23:56 +0000)
committerbothner <bothner@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 26 Apr 1994 23:56:21 +0000 (23:56 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@7160 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/calls.c
gcc/expr.c
gcc/function.c
gcc/stmt.c
gcc/varasm.c

index 2622b5b..5fcded2 100644 (file)
@@ -631,11 +631,7 @@ expand_call (exp, target, ignore)
 
   /* Warn if this value is an aggregate type,
      regardless of which calling convention we are using for it.  */
-  if (warn_aggregate_return
-      && (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))
+  if (warn_aggregate_return && AGGREGATE_TYPE_P (TREE_TYPE (exp)))
     warning ("function call has aggregate value");
 
   /* Set up a place to return a structure.  */
@@ -1039,11 +1035,7 @@ expand_call (exp, target, ignore)
                  copy = assign_stack_temp (TYPE_MODE (type), size, 1);
                }
 
-             MEM_IN_STRUCT_P (copy)
-               = (TREE_CODE (type) == RECORD_TYPE
-                  || TREE_CODE (type) == UNION_TYPE
-                  || TREE_CODE (type) == QUAL_UNION_TYPE
-                  || TREE_CODE (type) == ARRAY_TYPE);
+             MEM_IN_STRUCT_P (copy) = AGGREGATE_TYPE_P (type);
 
              store_expr (args[i].tree_value, copy, 0);
 
@@ -1498,10 +1490,7 @@ expand_call (exp, target, ignore)
          addr = plus_constant (addr, arg_offset);
          args[i].stack = gen_rtx (MEM, args[i].mode, addr);
          MEM_IN_STRUCT_P (args[i].stack)
-           = (TREE_CODE (TREE_TYPE (args[i].tree_value)) == RECORD_TYPE
-              || 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);
+           = AGGREGATE_TYPE_P (TREE_TYPE (args[i].tree_value));
 
          if (GET_CODE (slot_offset) == CONST_INT)
            addr = plus_constant (arg_reg, INTVAL (slot_offset));
@@ -1941,11 +1930,7 @@ expand_call (exp, target, ignore)
          target = gen_rtx (MEM, TYPE_MODE (TREE_TYPE (exp)),
                            memory_address (TYPE_MODE (TREE_TYPE (exp)),
                                            structure_value_addr));
-         MEM_IN_STRUCT_P (target)
-           = (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);
+         MEM_IN_STRUCT_P (target) = AGGREGATE_TYPE_P (TREE_TYPE (exp));
        }
     }
   else if (pcc_struct_value)
@@ -1964,11 +1949,7 @@ expand_call (exp, target, ignore)
                                          int_size_in_bytes (TREE_TYPE (exp)),
                                          0);
 
-             MEM_IN_STRUCT_P (target)
-               = (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);
+             MEM_IN_STRUCT_P (target) = AGGREGATE_TYPE_P (TREE_TYPE (exp));
 
              /* Save this temp slot around the pop below.  */
              preserve_temp_slots (target);
index a21ad1c..b2ec886 100644 (file)
@@ -3915,11 +3915,7 @@ expand_expr (exp, target, tmode, modifier)
            {
              temp
                = assign_stack_temp (mode, int_size_in_bytes (type), 0);
-             MEM_IN_STRUCT_P (temp)
-               = (TREE_CODE (type) == RECORD_TYPE
-                  || TREE_CODE (type) == UNION_TYPE
-                  || TREE_CODE (type) == QUAL_UNION_TYPE
-                  || TREE_CODE (type) == ARRAY_TYPE);
+             MEM_IN_STRUCT_P (temp) = AGGREGATE_TYPE_P (type);
            }
          else
            temp = gen_reg_rtx (promote_mode (type, mode, &unsignedp, 0));
@@ -4106,11 +4102,9 @@ expand_expr (exp, target, tmode, modifier)
                target = gen_reg_rtx (tmode != VOIDmode ? tmode : mode);
              else
                {
-                 enum tree_code c = TREE_CODE (type);
                  target
                    = assign_stack_temp (mode, int_size_in_bytes (type), 0);
-                 if (c == RECORD_TYPE || c == UNION_TYPE
-                     || c == QUAL_UNION_TYPE || c == ARRAY_TYPE)
+                 if (AGGREGATE_TYPE_P (type))
                    MEM_IN_STRUCT_P (target) = 1;
                }
            }
@@ -4153,16 +4147,10 @@ expand_expr (exp, target, tmode, modifier)
        if (TREE_CODE (TREE_OPERAND (exp, 0)) == PLUS_EXPR
            || (TREE_CODE (TREE_OPERAND (exp, 0)) == SAVE_EXPR
                && TREE_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)) == PLUS_EXPR)
-           || 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
+           || AGGREGATE_TYPE_P (TREE_TYPE (exp))
            || (TREE_CODE (exp1) == ADDR_EXPR
                && (exp2 = TREE_OPERAND (exp1, 0))
-               && (TREE_CODE (TREE_TYPE (exp2)) == ARRAY_TYPE
-                   || TREE_CODE (TREE_TYPE (exp2)) == RECORD_TYPE
-                   || TREE_CODE (TREE_TYPE (exp2)) == UNION_TYPE
-                   || TREE_CODE (TREE_TYPE (exp2)) == QUAL_UNION_TYPE)))
+               && AGGREGATE_TYPE_P (TREE_TYPE (exp2))))
          MEM_IN_STRUCT_P (temp) = 1;
        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
@@ -5341,11 +5329,7 @@ expand_expr (exp, target, tmode, modifier)
                                      (TREE_INT_CST_LOW (TYPE_SIZE (type))
                                       + BITS_PER_UNIT - 1)
                                      / BITS_PER_UNIT, 0);
-           MEM_IN_STRUCT_P (temp)
-             = (TREE_CODE (type) == RECORD_TYPE
-                || TREE_CODE (type) == UNION_TYPE
-                || TREE_CODE (type) == QUAL_UNION_TYPE
-                || TREE_CODE (type) == ARRAY_TYPE);
+           MEM_IN_STRUCT_P (temp) = AGGREGATE_TYPE_P (type);
          }
        else
          temp = gen_reg_rtx (mode);
index 27318d4..cc9fa50 100644 (file)
@@ -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,
      mark it as such for cse and loop optimize.  */
-  MEM_IN_STRUCT_P (reg)
-    = (TREE_CODE (type) == ARRAY_TYPE
-       || TREE_CODE (type) == RECORD_TYPE
-       || TREE_CODE (type) == UNION_TYPE
-       || TREE_CODE (type) == QUAL_UNION_TYPE);
+  MEM_IN_STRUCT_P (reg) = AGGREGATE_TYPE_P (type);
 
   /* Now make sure that all refs to the variable, previously made
      when it was a register, are fixed up to be valid again.  */
@@ -2996,11 +2992,7 @@ aggregate_value_p (exp)
 
   if (RETURN_IN_MEMORY (type))
     return 1;
-  if (flag_pcc_struct_return
-      && (TREE_CODE (type) == RECORD_TYPE
-         || TREE_CODE (type) == UNION_TYPE
-         || TREE_CODE (type) == QUAL_UNION_TYPE
-         || TREE_CODE (type) == ARRAY_TYPE))
+  if (flag_pcc_struct_return && AGGREGATE_TYPE_P (type))
     return 1;
   /* Make sure we have suitable call-clobbered regs to return
      the value in; if not, we must return it in memory.  */
@@ -3119,11 +3111,7 @@ assign_parms (fndecl, second_time)
 
   for (parm = fnargs; parm; parm = TREE_CHAIN (parm))
     {
-      int aggregate
-       = (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);
+      int aggregate = AGGREGATE_TYPE_P (TREE_TYPE (parm));
       struct args_size stack_offset;
       struct args_size arg_size;
       int passed_pointer = 0;
@@ -3704,11 +3692,7 @@ assign_parms (fndecl, second_time)
          DECL_RTL (result)
            = gen_rtx (MEM, DECL_MODE (result), DECL_RTL (parm));
 
-         MEM_IN_STRUCT_P (DECL_RTL (result))
-           = (TREE_CODE (restype) == RECORD_TYPE
-              || TREE_CODE (restype) == UNION_TYPE
-              || TREE_CODE (restype) == QUAL_UNION_TYPE
-              || TREE_CODE (restype) == ARRAY_TYPE);
+         MEM_IN_STRUCT_P (DECL_RTL (result)) = AGGREGATE_TYPE_P (restype);
        }
 
       if (TREE_THIS_VOLATILE (parm))
@@ -4031,10 +4015,7 @@ uninitialized_vars_warning (block)
             because assigning the fields one by one can fail to convince
             flow.c that the entire aggregate was initialized.
             Unions are troublesome because members may be shorter.  */
-         && TREE_CODE (TREE_TYPE (decl)) != RECORD_TYPE
-         && TREE_CODE (TREE_TYPE (decl)) != UNION_TYPE
-         && TREE_CODE (TREE_TYPE (decl)) != QUAL_UNION_TYPE
-         && TREE_CODE (TREE_TYPE (decl)) != ARRAY_TYPE
+         && ! AGGREGATE_TYPE_P (TREE_TYPE (decl))
          && DECL_RTL (decl) != 0
          && GET_CODE (DECL_RTL (decl)) == REG
          && regno_uninitialized (REGNO (DECL_RTL (decl))))
@@ -4662,10 +4643,7 @@ init_function_start (subr, filename, line)
   /* Warn if this value is an aggregate type,
      regardless of which calling convention we are using for it.  */
   if (warn_aggregate_return
-      && (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))) == QUAL_UNION_TYPE
-         || TREE_CODE (TREE_TYPE (DECL_RESULT (subr))) == ARRAY_TYPE))
+      && AGGREGATE_TYPE_P (TREE_TYPE (DECL_RESULT (subr))))
     warning ("function returns an aggregate");
 
   current_function_returns_pointer
@@ -4886,10 +4864,7 @@ expand_function_start (subr, parms_have_cleanups)
          DECL_RTL (DECL_RESULT (subr))
            = gen_rtx (MEM, DECL_MODE (DECL_RESULT (subr)), value_address);
          MEM_IN_STRUCT_P (DECL_RTL (DECL_RESULT (subr)))
-           = (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))) == QUAL_UNION_TYPE
-              || TREE_CODE (TREE_TYPE (DECL_RESULT (subr))) == ARRAY_TYPE);
+           = AGGREGATE_TYPE_P (TREE_TYPE (DECL_RESULT (subr)));
        }
     }
   else if (DECL_MODE (DECL_RESULT (subr)) == VOIDmode)
index bdf7dca..27bc9ec 100644 (file)
@@ -3500,11 +3500,7 @@ expand_decl (decl)
 
       /* If this is a memory ref that contains aggregate components,
         mark it as such for cse and loop optimize.  */
-      MEM_IN_STRUCT_P (DECL_RTL (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);
+      MEM_IN_STRUCT_P (DECL_RTL (decl)) = AGGREGATE_TYPE_P (TREE_TYPE (decl));
 #if 0
       /* If this is in memory because of -ffloat-store,
         set the volatile bit, to prevent optimizations from
@@ -3551,11 +3547,7 @@ expand_decl (decl)
 
       /* If this is a memory ref that contains aggregate components,
         mark it as such for cse and loop optimize.  */
-      MEM_IN_STRUCT_P (DECL_RTL (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);
+      MEM_IN_STRUCT_P (DECL_RTL (decl)) = AGGREGATE_TYPE_P (TREE_TYPE (decl));
 
       /* Indicate the alignment we actually gave this variable.  */
 #ifdef STACK_BOUNDARY
index 25ba2d1..ba6253c 100644 (file)
@@ -540,10 +540,7 @@ make_decl_rtl (decl, asmspec, top_level)
          if (TREE_READONLY (decl))
            RTX_UNCHANGING_P (DECL_RTL (decl)) = 1;
          MEM_IN_STRUCT_P (DECL_RTL (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);
+           = AGGREGATE_TYPE_P (TREE_TYPE (decl));
 
          /* Optionally set flags or add text to the name to record information
             such as that it is a function name.
@@ -2613,8 +2610,7 @@ output_constant_def (exp)
   TREE_CST_RTL (exp)
     = gen_rtx (MEM, TYPE_MODE (TREE_TYPE (exp)), def);
   RTX_UNCHANGING_P (TREE_CST_RTL (exp)) = 1;
-  if (TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE
-      || TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE)
+  if (AGGREGATE_TYPE_P (TREE_TYPE (exp)))
     MEM_IN_STRUCT_P (TREE_CST_RTL (exp)) = 1;
 
   pop_obstacks ();