summaryrefslogtreecommitdiff
path: root/gcc/config/xtensa
diff options
context:
space:
mode:
authorbwilson <bwilson@138bc75d-0d04-0410-961f-82ee72b054a4>2004-01-23 22:12:34 +0000
committerbwilson <bwilson@138bc75d-0d04-0410-961f-82ee72b054a4>2004-01-23 22:12:34 +0000
commitabeadffeb0826db6d4564020e8f34c52c3a06b59 (patch)
tree8453d3009e4c41314b56ad71dbad9c7dd5e9c957 /gcc/config/xtensa
parent193c2805c11ca7af4857d3986010f14381ba9871 (diff)
downloadgcc-abeadffeb0826db6d4564020e8f34c52c3a06b59.tar.gz
* config/xtensa/xtensa.c (xtensa_va_arg): Handle complex values as
separate real and imaginary parts. * config/xtensa/xtensa.h (SPLIT_COMPLEX_ARGS): Define. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@76459 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/xtensa')
-rw-r--r--gcc/config/xtensa/xtensa.c19
-rw-r--r--gcc/config/xtensa/xtensa.h4
2 files changed, 22 insertions, 1 deletions
diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c
index d7e2902c277..0debc3ee615 100644
--- a/gcc/config/xtensa/xtensa.c
+++ b/gcc/config/xtensa/xtensa.c
@@ -2447,6 +2447,25 @@ xtensa_va_arg (tree valist, tree type)
rtx array, orig_ndx, r, addr, size, va_size;
rtx lab_false, lab_over, lab_false2;
+ /* Handle complex values as separate real and imaginary parts. */
+ if (TREE_CODE (type) == COMPLEX_TYPE)
+ {
+ rtx real_part, imag_part, concat_val, local_copy;
+
+ real_part = xtensa_va_arg (valist, TREE_TYPE (type));
+ imag_part = xtensa_va_arg (valist, TREE_TYPE (type));
+
+ /* Make a copy of the value in case the parts are not contiguous. */
+ real_part = gen_rtx_MEM (TYPE_MODE (TREE_TYPE (type)), real_part);
+ imag_part = gen_rtx_MEM (TYPE_MODE (TREE_TYPE (type)), imag_part);
+ concat_val = gen_rtx_CONCAT (TYPE_MODE (type), real_part, imag_part);
+
+ local_copy = assign_temp (type, 0, 1, 0);
+ emit_move_insn (local_copy, concat_val);
+
+ return XEXP (local_copy, 0);
+ }
+
f_stk = TYPE_FIELDS (va_list_type_node);
f_reg = TREE_CHAIN (f_stk);
f_ndx = TREE_CHAIN (f_reg);
diff --git a/gcc/config/xtensa/xtensa.h b/gcc/config/xtensa/xtensa.h
index a7f470ec0b5..88d1ba85189 100644
--- a/gcc/config/xtensa/xtensa.h
+++ b/gcc/config/xtensa/xtensa.h
@@ -806,7 +806,6 @@ typedef struct xtensa_args {
? PARM_BOUNDARY \
: GET_MODE_ALIGNMENT (MODE)))
-
/* Nonzero if we do not know how to pass TYPE solely in registers.
We cannot do so in the following cases:
@@ -823,6 +822,9 @@ typedef struct xtensa_args {
&& (TREE_CODE (TYPE_SIZE (TYPE)) != INTEGER_CST \
|| TREE_ADDRESSABLE (TYPE)))
+/* Pass complex arguments independently. */
+#define SPLIT_COMPLEX_ARGS 1
+
/* Profiling Xtensa code is typically done with the built-in profiling
feature of Tensilica's instruction set simulator, which does not
require any compiler support. Profiling code on a real (i.e.,