Patchwork [pa] hookize FUNCTION_ARG &co.

login
register
mail settings
Submitter Nathan Froyd
Date Oct. 8, 2010, 1:58 p.m.
Message ID <1286546292-17240-1-git-send-email-froydnj@codesourcery.com>
Download mbox | patch
Permalink /patch/67197/
State New
Headers show

Comments

Nathan Froyd - Oct. 8, 2010, 1:58 p.m.
The patch below hookizes FUNCTION_ARG and related macros for the hppa
backend.  Nothing special here.

Tested by inspection with cross to hppa-linux-gnu.  I plan to commit this
under the obvious rule after waiting a week for comments/approval.

	* config/pa/pa-protos.h (function_arg): Delete.
	* config/pa/pa.h (FUNCTION_ARG, FUNCTION_ARG_ADVANCE): Delete.
	* config/pa/pa.c (function_arg): Rename to...
	(pa_function_arg): ...this.  Make static.  Take a const_tree and
	a bool.
	(pa_function_arg_advance): New function.
	(TARGET_FUNCTION_ARG, TARGET_FUNCTION_ARG_ADVANCE): Define.
---
 gcc/config/pa/pa-protos.h |    4 ----
 gcc/config/pa/pa.c        |   31 ++++++++++++++++++++++++++++---
 gcc/config/pa/pa.h        |   17 -----------------
 3 files changed, 28 insertions(+), 24 deletions(-)

Patch

diff --git a/gcc/config/pa/pa-protos.h b/gcc/config/pa/pa-protos.h
index 8097c58..085b648 100644
--- a/gcc/config/pa/pa-protos.h
+++ b/gcc/config/pa/pa-protos.h
@@ -151,10 +151,6 @@  extern int cmpib_comparison_operator (rtx, enum machine_mode);
 /* Miscellaneous functions in pa.c.  */
 #ifdef TREE_CODE
 extern int reloc_needed (tree);
-#ifdef RTX_CODE
-extern rtx function_arg (CUMULATIVE_ARGS *, enum machine_mode,
-			 tree, int);
-#endif
 extern bool pa_return_in_memory (const_tree, const_tree);
 #endif /* TREE_CODE */
 
diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c
index e114dd1..08d63e5 100644
--- a/gcc/config/pa/pa.c
+++ b/gcc/config/pa/pa.c
@@ -160,6 +160,10 @@  static bool pa_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode,
 				  const_tree, bool);
 static int pa_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
 				 tree, bool);
+static void pa_function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode,
+				     const_tree, bool);
+static rtx pa_function_arg (CUMULATIVE_ARGS *, enum machine_mode,
+			    const_tree, bool);
 static struct machine_function * pa_init_machine_status (void);
 static reg_class_t pa_secondary_reload (bool, rtx, reg_class_t,
 					enum machine_mode,
@@ -334,6 +338,10 @@  static size_t n_deferred_plabels = 0;
 #define TARGET_CALLEE_COPIES hook_bool_CUMULATIVE_ARGS_mode_tree_bool_true
 #undef TARGET_ARG_PARTIAL_BYTES
 #define TARGET_ARG_PARTIAL_BYTES pa_arg_partial_bytes
+#undef TARGET_FUNCTION_ARG
+#define TARGET_FUNCTION_ARG pa_function_arg
+#undef TARGET_FUNCTION_ARG_ADVANCE
+#define TARGET_FUNCTION_ARG_ADVANCE pa_function_arg_advance
 
 #undef TARGET_EXPAND_BUILTIN_SAVEREGS
 #define TARGET_EXPAND_BUILTIN_SAVEREGS hppa_builtin_saveregs
@@ -9365,6 +9373,23 @@  pa_function_value_regno_p (const unsigned int regno)
   return false;
 }
 
+/* Update the data in CUM to advance over an argument
+   of mode MODE and data type TYPE.
+   (TYPE is null for libcalls where that information may not be available.)  */
+
+static void
+pa_function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode,
+			 const_tree type, bool named ATTRIBUTE_UNUSED)
+{
+  int arg_size = FUNCTION_ARG_SIZE (mode, type);
+
+  cum->nargs_prototype--;
+  cum->words += (arg_size
+		 + ((cum->words & 01)
+		    && type != NULL_TREE
+		    && arg_size > 1));
+}
+
 /* Return the location of a parameter that is passed in a register or NULL
    if the parameter has any component that is passed in memory.
 
@@ -9373,9 +9398,9 @@  pa_function_value_regno_p (const unsigned int regno)
 
    ??? We might want to restructure this so that it looks more like other
    ports.  */
-rtx
-function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type,
-	      int named ATTRIBUTE_UNUSED)
+static rtx
+pa_function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode,
+		 const_tree type, bool named ATTRIBUTE_UNUSED)
 {
   int max_arg_words = (TARGET_64BIT ? 8 : 4);
   int alignment = 0;
diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h
index ae768b2..e637e68 100644
--- a/gcc/config/pa/pa.h
+++ b/gcc/config/pa/pa.h
@@ -634,17 +634,6 @@  struct hppa_args {int words, nargs_prototype, incoming, indirect; };
      ? (HOST_WIDE_INT) GET_MODE_SIZE (MODE) \
      : int_size_in_bytes (TYPE)) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
 
-/* Update the data in CUM to advance over an argument
-   of mode MODE and data type TYPE.
-   (TYPE is null for libcalls where that information may not be available.)  */
-
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED)			\
-{ (CUM).nargs_prototype--;						\
-  (CUM).words += FUNCTION_ARG_SIZE(MODE, TYPE)	 			\
-    + (((CUM).words & 01) && (TYPE) != 0				\
-	&& FUNCTION_ARG_SIZE(MODE, TYPE) > 1);				\
-}
-
 /* Determine where to put an argument to a function.
    Value is zero to push the argument on the stack,
    or a hard register in which to store the argument.
@@ -707,12 +696,6 @@  struct hppa_args {int words, nargs_prototype, incoming, indirect; };
 #define BLOCK_REG_PADDING(MODE, TYPE, FIRST) \
   function_arg_padding ((MODE), (TYPE))
 
-/* Do not expect to understand this without reading it several times.  I'm
-   tempted to try and simply it, but I worry about breaking something.  */
-
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
-  function_arg (&CUM, MODE, TYPE, NAMED)
-
 /* If defined, a C expression that gives the alignment boundary, in
    bits, of an argument with the specified mode and type.  If it is
    not defined,  `PARM_BOUNDARY' is used for all arguments.  */