Patchwork [microblaze] hookize FUNCTION_ARG &co.

login
register
mail settings
Submitter Nathan Froyd
Date Oct. 28, 2010, 8:44 p.m.
Message ID <20101028204451.GW6758@nightcrawler>
Download mbox | patch
Permalink /patch/69498/
State New
Headers show

Comments

Nathan Froyd - Oct. 28, 2010, 8:44 p.m.
The patch below hookize FUNCTION_ARG and related macros for the
microblaze target.  Not much different than the 30+ other targets that
have gone before.

Tested by inspection with a cross to microblaze-elf.  I plan on
committing this under the obvious rule after waiting a week for
comments.

-Nathan

	* config/microblaze/microblaze-protos.h (function_arg): Delete.
	(function_arg_advance): Delete.
	* config/microblaze/microblaze.h (FUNCTION_ARG_ADVANCE): Delete.
	(FUNCTION_ARG): Delete.
	* config/microblaze/microblaze.c (function_arg_advance): Rename to...
	(microblaze_function_arg_advance): ...this.  Make static.  Take a
	const_tree and a bool.
	(function-arg): Rename to...
	(microblaze_function_arg): ...this.  Make static.  Take a const_tree
	and a bool.
	(microblaze_expand_prologue): Call targetm.calls.function_arg and
	targetm.calls.function_arg_advance.
	(TARGET_FUNCTION_ARG, TARGET_FUNCTION_ARG_ADVANCE): Define.
Michael Eager - Nov. 1, 2010, 8:55 p.m.
Nathan Froyd wrote:
> The patch below hookize FUNCTION_ARG and related macros for the
> microblaze target.  Not much different than the 30+ other targets that
> have gone before.
> 
> Tested by inspection with a cross to microblaze-elf.  I plan on
> committing this under the obvious rule after waiting a week for
> comments.

Works for me.  OK to check in.

Patch

Index: config/microblaze/microblaze-protos.h
===================================================================
--- config/microblaze/microblaze-protos.h	(revision 166032)
+++ config/microblaze/microblaze-protos.h	(working copy)
@@ -52,12 +52,6 @@  extern void microblaze_declare_object (F
 extern void microblaze_asm_output_ident (FILE *, const char *);
 #endif  /* RTX_CODE */
 
-#ifdef TREE_CODE
-extern void function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode,
-				  tree, int);
-extern rtx function_arg (CUMULATIVE_ARGS *, enum machine_mode, tree, int);
-#endif /* TREE_CODE */
-
 /* Declare functions in microblaze-c.c.  */
 extern void microblaze_cpp_define (struct cpp_reader *); 
 
Index: config/microblaze/microblaze.c
===================================================================
--- config/microblaze/microblaze.c	(revision 166032)
+++ config/microblaze/microblaze.c	(working copy)
@@ -1088,9 +1088,9 @@  init_cumulative_args (CUMULATIVE_ARGS * 
 
 /* Advance the argument to the next argument position.  */
 
-void
-function_arg_advance (CUMULATIVE_ARGS * cum, enum machine_mode mode,
-		      tree type, int named ATTRIBUTE_UNUSED)
+static void
+microblaze_function_arg_advance (CUMULATIVE_ARGS * cum, enum machine_mode mode,
+				 const_tree type, bool named ATTRIBUTE_UNUSED)
 {
   cum->arg_number++;
   switch (mode)
@@ -1143,9 +1143,10 @@  function_arg_advance (CUMULATIVE_ARGS * 
 /* Return an RTL expression containing the register for the given mode,
    or 0 if the argument is to be passed on the stack.  */
 
-rtx
-function_arg (CUMULATIVE_ARGS * cum, enum machine_mode mode, 
-	      tree type ATTRIBUTE_UNUSED, int named ATTRIBUTE_UNUSED)
+static rtx
+microblaze_function_arg (CUMULATIVE_ARGS * cum, enum machine_mode mode, 
+			 const_tree type ATTRIBUTE_UNUSED,
+			 bool named ATTRIBUTE_UNUSED)
 {
   rtx ret;
   int regbase = -1;
@@ -2268,7 +2269,8 @@  microblaze_expand_prologue (void)
 	  passed_mode = Pmode;
 	}
 
-      entry_parm = FUNCTION_ARG (args_so_far, passed_mode, passed_type, 1);
+      entry_parm = targetm.calls.function_arg (&args_so_far, passed_mode,
+					       passed_type, true);
 
       if (entry_parm)
 	{
@@ -2288,7 +2290,8 @@  microblaze_expand_prologue (void)
 	  break;
 	}
 
-      FUNCTION_ARG_ADVANCE (args_so_far, passed_mode, passed_type, 1);
+      targetm.calls.function_arg_advance (&args_so_far, passed_mode,
+					  passed_type, true);
 
       next_arg = TREE_CHAIN (cur_arg);
       if (next_arg == 0)
@@ -2302,7 +2305,8 @@  microblaze_expand_prologue (void)
 
   /* Split parallel insn into a sequence of insns.  */
 
-  next_arg_reg = FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1);
+  next_arg_reg = targetm.calls.function_arg (&args_so_far, VOIDmode,
+					     void_type_node, true);
   if (next_arg_reg != 0 && GET_CODE (next_arg_reg) == PARALLEL)
     {
       rtvec adjust = XVEC (next_arg_reg, 0);
@@ -2999,6 +3003,12 @@  microblaze_adjust_cost (rtx insn ATTRIBU
 #undef TARGET_ARG_PARTIAL_BYTES
 #define TARGET_ARG_PARTIAL_BYTES	function_arg_partial_bytes
 
+#undef TARGET_FUNCTION_ARG
+#define TARGET_FUNCTION_ARG		microblaze_function_arg
+
+#undef TARGET_FUNCTION_ARG_ADVANCE
+#define TARGET_FUNCTION_ARG_ADVANCE	microblaze_function_arg_advance
+
 #undef TARGET_CAN_ELIMINATE
 #define TARGET_CAN_ELIMINATE 		microblaze_can_eliminate
 
Index: config/microblaze/microblaze.h
===================================================================
--- config/microblaze/microblaze.h	(revision 166032)
+++ config/microblaze/microblaze.h	(working copy)
@@ -500,12 +500,6 @@  typedef struct microblaze_args
 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,FNDECL,N_NAMED_ARGS)	\
   init_cumulative_args (&CUM, FNTYPE, LIBNAME)
 
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED)			\
-  function_arg_advance (&CUM, MODE, TYPE, NAMED)
-
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
-  function_arg( &CUM, MODE, TYPE, NAMED)
-
 #define NO_PROFILE_COUNTERS			1
 
 #define FUNCTION_PROFILER(FILE, LABELNO) { \