summaryrefslogtreecommitdiffstats
path: root/gcc
diff options
context:
space:
mode:
authoraldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4>2003-05-15 20:01:10 +0000
committeraldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4>2003-05-15 20:01:10 +0000
commit42ef6f258c18a99c5630f4a09de76d7baec9026f (patch)
tree983a8518c9508538d232b4edbaa0845c23b21587 /gcc
parentffa082ba1f9a224e50b9b36acbf9c8b4d401c38c (diff)
downloadppe42-gcc-42ef6f258c18a99c5630f4a09de76d7baec9026f.tar.gz
ppe42-gcc-42ef6f258c18a99c5630f4a09de76d7baec9026f.zip
2003-05-15 Aldy Hernandez <aldyh@redhat.com>
* config/rs6000/rs6000-protos.h (function_value): Protoize. * config/rs6000/rs6000.h (FUNCTION_VALUE): Call function. * config/rs6000/rs6000.c (rs6000_function_value): New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@66841 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/config/rs6000/rs6000-protos.h1
-rw-r--r--gcc/config/rs6000/rs6000.c38
-rw-r--r--gcc/config/rs6000/rs6000.h23
4 files changed, 50 insertions, 20 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 34752f14fec..363ea14cfb4 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2003-05-15 Aldy Hernandez <aldyh@redhat.com>
+
+ * config/rs6000/rs6000-protos.h (function_value): Protoize.
+
+ * config/rs6000/rs6000.h (FUNCTION_VALUE): Call function.
+
+ * config/rs6000/rs6000.c (rs6000_function_value): New.
+
2003-05-15 Philip Blundell <philb@gnu.org>
* config/arm/arm.c (arm_is_xscale): Rename to arm_arch_xscale.
diff --git a/gcc/config/rs6000/rs6000-protos.h b/gcc/config/rs6000/rs6000-protos.h
index 8ee39e21bc3..da75516de37 100644
--- a/gcc/config/rs6000/rs6000-protos.h
+++ b/gcc/config/rs6000/rs6000-protos.h
@@ -152,6 +152,7 @@ extern int function_arg_pass_by_reference PARAMS ((CUMULATIVE_ARGS *,
extern void setup_incoming_varargs PARAMS ((CUMULATIVE_ARGS *,
enum machine_mode, tree,
int *, int));
+extern rtx rs6000_function_value (tree, tree);
extern struct rtx_def *rs6000_va_arg PARAMS ((tree, tree));
extern int function_ok_for_sibcall PARAMS ((tree));
#ifdef ARGS_SIZE_RTX
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 965c3e1ad1a..e451f20c0ee 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -14396,6 +14396,44 @@ rs6000_memory_move_cost (mode, class, in)
return 4 + rs6000_register_move_cost (mode, class, GENERAL_REGS);
}
+/* Define how to find the value returned by a function.
+ VALTYPE is the data type of the value (as a tree).
+ If the precise function being called is known, FUNC is its FUNCTION_DECL;
+ otherwise, FUNC is 0.
+
+ On the SPE, both FPs and vectors are returned in r3.
+
+ On RS/6000 an integer value is in r3 and a floating-point value is in
+ fp1, unless -msoft-float. */
+
+rtx
+rs6000_function_value (tree valtype, tree func ATTRIBUTE_UNUSED)
+{
+ enum machine_mode mode;
+ unsigned int regno = GP_ARG_RETURN;
+
+ if ((INTEGRAL_TYPE_P (valtype)
+ && TYPE_PRECISION (valtype) < BITS_PER_WORD)
+ || POINTER_TYPE_P (valtype))
+ mode = word_mode;
+ else
+ mode = TYPE_MODE (valtype);
+
+ if (TREE_CODE (valtype) == REAL_TYPE)
+ {
+ if (TARGET_HARD_FLOAT && TARGET_FPRS)
+ regno = FP_ARG_RETURN;
+ else if (TARGET_SPE_ABI && !TARGET_FPRS)
+ regno = GP_ARG_RETURN;
+ }
+ else if (TARGET_ALTIVEC && TREE_CODE (valtype) == VECTOR_TYPE)
+ regno = ALTIVEC_ARG_RETURN;
+ else
+ regno = GP_ARG_RETURN;
+
+ return gen_rtx_REG (mode, regno);
+}
+
/* Return true if TYPE is of type __ev64_opaque__. */
static bool
diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h
index d07eb6edb30..8cd28acb374 100644
--- a/gcc/config/rs6000/rs6000.h
+++ b/gcc/config/rs6000/rs6000.h
@@ -1555,26 +1555,9 @@ typedef struct rs6000_stack {
/* Define how to find the value returned by a function.
VALTYPE is the data type of the value (as a tree).
If the precise function being called is known, FUNC is its FUNCTION_DECL;
- otherwise, FUNC is 0.
-
- On the SPE, both FPs and vectors are returned in r3.
-
- On RS/6000 an integer value is in r3 and a floating-point value is in
- fp1, unless -msoft-float. */
-
-#define FUNCTION_VALUE(VALTYPE, FUNC) \
- gen_rtx_REG ((INTEGRAL_TYPE_P (VALTYPE) \
- && TYPE_PRECISION (VALTYPE) < BITS_PER_WORD) \
- || POINTER_TYPE_P (VALTYPE) \
- ? word_mode : TYPE_MODE (VALTYPE), \
- TREE_CODE (VALTYPE) == VECTOR_TYPE \
- && TARGET_ALTIVEC ? ALTIVEC_ARG_RETURN \
- : TREE_CODE (VALTYPE) == REAL_TYPE \
- && TARGET_SPE_ABI && !TARGET_FPRS \
- ? GP_ARG_RETURN \
- : TREE_CODE (VALTYPE) == REAL_TYPE \
- && TARGET_HARD_FLOAT && TARGET_FPRS \
- ? FP_ARG_RETURN : GP_ARG_RETURN)
+ otherwise, FUNC is 0. */
+
+#define FUNCTION_VALUE(VALTYPE, FUNC) rs6000_function_value ((VALTYPE), (FUNC))
/* Define how to find the value returned by a library function
assuming the value has mode MODE. */
OpenPOWER on IntegriCloud