summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@libertysurf.fr>2004-01-20 08:38:18 +0100
committerEric Botcazou <ebotcazou@gcc.gnu.org>2004-01-20 07:38:18 +0000
commit4043d6fb405863ac024cdc3b1cca035e63833497 (patch)
tree3ea858ffd65c2aa274ad51f09b33c6482e341ffa /gcc
parent54020b29a8760669d695760325b82e97f260df2c (diff)
downloadgcc-4043d6fb405863ac024cdc3b1cca035e63833497.tar.gz
re PR target/13557 (deviation from the psABI for small structures)
PR target/13557 * config/sparc/sparc.c (function_arg): Reorder the cases. From-SVN: r76202
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/sparc/sparc.c46
2 files changed, 28 insertions, 23 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7dc7aee6235..c48b56ef316 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index 6c0865370eb..6002a5d7300 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -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. */