diff gcc/config/moxie/moxie.c @ 67:f6334be47118

update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
author nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
date Tue, 22 Mar 2011 17:18:12 +0900
parents b7f97abdc517
children 04ced10e8804
line wrap: on
line diff
--- a/gcc/config/moxie/moxie.c	Tue May 25 18:58:51 2010 +0900
+++ b/gcc/config/moxie/moxie.c	Tue Mar 22 17:18:12 2011 +0900
@@ -33,7 +33,7 @@
 #include "flags.h"
 #include "recog.h"
 #include "reload.h"
-#include "toplev.h"
+#include "diagnostic-core.h"
 #include "obstack.h"
 #include "tree.h"
 #include "expr.h"
@@ -70,7 +70,7 @@
 
    We always return values in register $r0 for moxie.  */
 
-rtx
+static rtx
 moxie_function_value (const_tree valtype, 
 		      const_tree fntype_or_decl ATTRIBUTE_UNUSED,
 		      bool outgoing ATTRIBUTE_UNUSED)
@@ -78,6 +78,27 @@
   return gen_rtx_REG (TYPE_MODE (valtype), MOXIE_R0);
 }
 
+/* Define how to find the value returned by a library function.
+
+   We always return values in register $r0 for moxie.  */
+
+static rtx
+moxie_libcall_value (enum machine_mode mode,
+                     const_rtx fun ATTRIBUTE_UNUSED)
+{
+  return gen_rtx_REG (mode, MOXIE_R0);
+}
+
+/* Handle TARGET_FUNCTION_VALUE_REGNO_P.
+
+   We always return values in register $r0 for moxie.  */
+
+static bool
+moxie_function_value_regno_p (const unsigned int regno)
+{
+  return (regno == MOXIE_R0);
+}
+
 /* Emit an error message when we're in an asm, and a fatal error for
    "normal" insns.  Formatted output isn't easily implemented, since we
    use output_operand_lossage to output the actual message and handle the
@@ -205,14 +226,14 @@
 static struct machine_function *
 moxie_init_machine_status (void)
 {
-  return GGC_CNEW (struct machine_function);
+  return ggc_alloc_cleared_machine_function ();
 }
 
 
-/* The OVERRIDE_OPTIONS worker.
+/* The TARGET_OPTION_OVERRIDE worker.
    All this curently does is set init_machine_status.  */
-void
-moxie_override_options (void)
+static void
+moxie_option_override (void)
 {
   /* Set the per-function-data initializer.  */
   init_machine_status = moxie_init_machine_status;
@@ -295,7 +316,7 @@
 moxie_expand_epilogue (void)
 {
   int regno;
-  rtx insn, reg, cfa_restores = NULL;
+  rtx reg;
 
   if (cfun->machine->callee_saved_reg_size != 0)
     {
@@ -318,7 +339,7 @@
 	    && df_regs_ever_live_p (regno))
 	  {
 	    rtx preg = gen_rtx_REG (Pmode, regno);
-	    insn = emit_insn (gen_movsi_pop (reg, preg));
+	    emit_insn (gen_movsi_pop (reg, preg));
 	  }
     }
 
@@ -387,16 +408,30 @@
 /* Return the next register to be used to hold a function argument or
    NULL_RTX if there's no more space.  */
 
-rtx
-moxie_function_arg (CUMULATIVE_ARGS cum, enum machine_mode mode,
-		    tree type ATTRIBUTE_UNUSED, int named ATTRIBUTE_UNUSED)
+static rtx
+moxie_function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode,
+		    const_tree type ATTRIBUTE_UNUSED,
+		    bool named ATTRIBUTE_UNUSED)
 {
-  if (cum < 8)
-    return gen_rtx_REG (mode, cum);
+  if (*cum < 8)
+    return gen_rtx_REG (mode, *cum);
   else 
     return NULL_RTX;
 }
 
+#define MOXIE_FUNCTION_ARG_SIZE(MODE, TYPE)	\
+  ((MODE) != BLKmode ? GET_MODE_SIZE (MODE)	\
+   : (unsigned) int_size_in_bytes (TYPE))
+
+static void
+moxie_function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode,
+			    const_tree type, bool named ATTRIBUTE_UNUSED)
+{
+  *cum = (*cum < MOXIE_R6
+	  ? *cum + ((3 + MOXIE_FUNCTION_ARG_SIZE (mode, type)) / 4)
+	  : *cum);
+}
+
 /* Return non-zero if the function argument described by TYPE is to be
    passed by reference.  */
 
@@ -517,6 +552,10 @@
 #define TARGET_PASS_BY_REFERENCE        moxie_pass_by_reference
 #undef  TARGET_ARG_PARTIAL_BYTES
 #define TARGET_ARG_PARTIAL_BYTES        moxie_arg_partial_bytes
+#undef  TARGET_FUNCTION_ARG
+#define TARGET_FUNCTION_ARG		moxie_function_arg
+#undef  TARGET_FUNCTION_ARG_ADVANCE
+#define TARGET_FUNCTION_ARG_ADVANCE	moxie_function_arg_advance
 
 
 #undef  TARGET_SETUP_INCOMING_VARARGS
@@ -530,6 +569,10 @@
    node node representing a data type.  */
 #undef TARGET_FUNCTION_VALUE
 #define TARGET_FUNCTION_VALUE moxie_function_value
+#undef TARGET_LIBCALL_VALUE
+#define TARGET_LIBCALL_VALUE moxie_libcall_value
+#undef TARGET_FUNCTION_VALUE_REGNO_P
+#define TARGET_FUNCTION_VALUE_REGNO_P moxie_function_value_regno_p
 
 #undef TARGET_FRAME_POINTER_REQUIRED
 #define TARGET_FRAME_POINTER_REQUIRED hook_bool_void_true
@@ -541,6 +584,9 @@
 #undef TARGET_TRAMPOLINE_INIT
 #define TARGET_TRAMPOLINE_INIT moxie_trampoline_init
 
+#undef TARGET_OPTION_OVERRIDE
+#define TARGET_OPTION_OVERRIDE moxie_option_override
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 #include "gt-moxie.h"