aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Evans <dje@sebabeach.org>2003-06-13 16:57:26 +0000
committerDoug Evans <devans@gcc.gnu.org>2003-06-13 16:57:26 +0000
commitd88e80e622609f3c4be7b852222d5daa7afca7c9 (patch)
treec79e5bf367177461afc3a2d513f54bd112425c0a
parent4581c6785660dd5d9fef416d15c9ad39051951d9 (diff)
downloadgcc-d88e80e622609f3c4be7b852222d5daa7afca7c9.zip
gcc-d88e80e622609f3c4be7b852222d5daa7afca7c9.tar.gz
gcc-d88e80e622609f3c4be7b852222d5daa7afca7c9.tar.bz2
m32r-protos.h (m32r_pass_by_reference): Declare.
* config/m32r/m32r-protos.h (m32r_pass_by_reference): Declare. * config/m32r/m32r.c (m32r_pass_by_reference): New fn. (m32r_va_arg): Use it. * config/m32r/m32r.h (FUNCTION_ARG_PASS_BY_REFERENCE): Ditto. (RETURN_IN_MEMORY): Ditto. Co-Authored-By: Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com> From-SVN: r67906
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/config/m32r/m32r-protos.h1
-rw-r--r--gcc/config/m32r/m32r.c17
-rw-r--r--gcc/config/m32r/m32r.h5
4 files changed, 28 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8327e0f..484152d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2003-06-13 Doug Evans <dje@sebabeach.org>
+ Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com>
+
+ * config/m32r/m32r-protos.h (m32r_pass_by_reference): Declare.
+ * config/m32r/m32r.c (m32r_pass_by_reference): New fn.
+ (m32r_va_arg): Use it.
+ * config/m32r/m32r.h (FUNCTION_ARG_PASS_BY_REFERENCE): Ditto.
+ (RETURN_IN_MEMORY): Ditto.
+
2003-06-13 Nathanael Nerode <neroden@gcc.gnu.org>
* c-typeck.c: Remove #if 0 clauses.
diff --git a/gcc/config/m32r/m32r-protos.h b/gcc/config/m32r/m32r-protos.h
index ec549ba..103bff7 100644
--- a/gcc/config/m32r/m32r-protos.h
+++ b/gcc/config/m32r/m32r-protos.h
@@ -93,6 +93,7 @@ extern int reg_or_zero_operand PARAMS ((rtx, Mmode));
#ifdef TREE_CODE
extern struct rtx_def * m32r_va_arg PARAMS ((tree, tree));
+extern int m32r_pass_by_reference PARAMS ((tree));
#endif /* TREE_CODE */
#endif /* RTX_CODE */
diff --git a/gcc/config/m32r/m32r.c b/gcc/config/m32r/m32r.c
index 4ea130f..8d42306 100644
--- a/gcc/config/m32r/m32r.c
+++ b/gcc/config/m32r/m32r.c
@@ -1002,6 +1002,21 @@ large_insn_p (op, mode)
return get_attr_length (op) != 2;
}
+/* Return non-zero if TYPE must be passed or returned in memory.
+ The m32r treats both directions the same so we handle both directions
+ in this function. */
+
+int
+m32r_pass_by_reference (type)
+ tree type;
+{
+ int size = int_size_in_bytes (type);
+
+ if (size < 0 || size > 8)
+ return 1;
+
+ return 0;
+}
/* Comparisons. */
@@ -1425,7 +1440,7 @@ m32r_va_arg (valist, type)
size = int_size_in_bytes (type);
rsize = (size + UNITS_PER_WORD - 1) & -UNITS_PER_WORD;
- if (size > 8)
+ if (m32r_pass_by_reference (type))
{
tree type_ptr, type_ptr_ptr;
diff --git a/gcc/config/m32r/m32r.h b/gcc/config/m32r/m32r.h
index 36bd206..13205ae 100644
--- a/gcc/config/m32r/m32r.h
+++ b/gcc/config/m32r/m32r.h
@@ -1134,7 +1134,7 @@ M32R_STACK_ALIGN (current_function_outgoing_args_size)
appropriate for passing a pointer to that type. */
/* All arguments greater than 8 bytes are passed this way. */
#define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \
- ((TYPE) && int_size_in_bytes (TYPE) > 8)
+ ((TYPE) && m32r_pass_by_reference (TYPE))
/* Update the data in CUM to advance over an argument
of mode MODE and data type TYPE.
@@ -1210,8 +1210,7 @@ M32R_STACK_ALIGN (current_function_outgoing_args_size)
to return the function value in memory, just as large structures are
always returned. Here TYPE will be a C expression of type `tree',
representing the data type of the value. */
-#define RETURN_IN_MEMORY(TYPE) \
-(int_size_in_bytes (TYPE) > 8)
+#define RETURN_IN_MEMORY(TYPE) m32r_pass_by_reference (TYPE)
/* Tell GCC to use RETURN_IN_MEMORY. */
#define DEFAULT_PCC_STRUCT_RETURN 0