re PR target/13557 (deviation from the psABI for small structures)
authorEric Botcazou <ebotcazou@libertysurf.fr>
Tue, 20 Jan 2004 07:38:18 +0000 (08:38 +0100)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Tue, 20 Jan 2004 07:38:18 +0000 (07:38 +0000)
PR target/13557
* config/sparc/sparc.c (function_arg): Reorder the cases.

From-SVN: r76202

gcc/ChangeLog
gcc/config/sparc/sparc.c

index 7dc7aee62355b6640a63dbd563b50e8def341a81..c48b56ef316ef1d05cb67b48e6e02d00f66923a8 100644 (file)
@@ -1,3 +1,8 @@
+2004-01-20  Eric Botcazou  <ebotcazou@libertysurf.fr>
+
+       PR target/13557
+       * config/sparc/sparc.c (function_arg): Reorder the cases.
+
 2004-01-19  Per Bothner  <per@bothner.com>
 
        Move cpp_reader's line_maps field to a shared global.
index 6c0865370ebee2de3519adf4fad52537c83cc285..6002a5d73002035fe17e9ff4abe4364e5e154878 100644 (file)
@@ -5353,13 +5353,34 @@ function_arg (const struct sparc_args *cum, enum machine_mode mode,
       reg = gen_rtx_REG (mode, regno);
       return reg;
     }
+    
+  if (type && TREE_CODE (type) == RECORD_TYPE)
+    {
+      /* Structures up to 16 bytes in size are passed in arg slots on the
+        stack and are promoted to registers where possible.  */
+
+      if (int_size_in_bytes (type) > 16)
+       abort (); /* shouldn't get here */
+
+      return function_arg_record_value (type, mode, slotno, named, regbase);
+    }
+  else if (type && TREE_CODE (type) == UNION_TYPE)
+    {
+      enum machine_mode mode;
+      int bytes = int_size_in_bytes (type);
+
+      if (bytes > 16)
+       abort ();
 
+      mode = mode_for_size (bytes * BITS_PER_UNIT, MODE_INT, 0);
+      reg = gen_rtx_REG (mode, regno);
+    }
   /* v9 fp args in reg slots beyond the int reg slots get passed in regs
      but also have the slot allocated for them.
      If no prototype is in scope fp values in register slots get passed
      in two places, either fp regs and int regs or fp regs and memory.  */
-  if ((GET_MODE_CLASS (mode) == MODE_FLOAT
-       || GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT)
+  else if ((GET_MODE_CLASS (mode) == MODE_FLOAT
+           || GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT)
       && SPARC_FP_REG_P (regno))
     {
       reg = gen_rtx_REG (mode, regno);
@@ -5423,27 +5444,6 @@ function_arg (const struct sparc_args *cum, enum machine_mode mode,
            }
        }
     }
-  else if (type && TREE_CODE (type) == RECORD_TYPE)
-    {
-      /* Structures up to 16 bytes in size are passed in arg slots on the
-        stack and are promoted to registers where possible.  */
-
-      if (int_size_in_bytes (type) > 16)
-       abort (); /* shouldn't get here */
-
-      return function_arg_record_value (type, mode, slotno, named, regbase);
-    }
-  else if (type && TREE_CODE (type) == UNION_TYPE)
-    {
-      enum machine_mode mode;
-      int bytes = int_size_in_bytes (type);
-
-      if (bytes > 16)
-       abort ();
-
-      mode = mode_for_size (bytes * BITS_PER_UNIT, MODE_INT, 0);
-      reg = gen_rtx_REG (mode, regno);
-    }
   else
     {
       /* Scalar or complex int.  */