This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [xtensa] hookize FUNCTION_ARG &co.


Looks fine. Thanks for the fix.

Sterling

Nathan Froyd wrote:
This patch hookizes FUNCTION_ARG and related macros for the Xtensa
backend.  Nothing much to see here.

Tested with xtensa-elf and comparing assembly before/after.  I plan to
commit this under the obvious rule after waiting a week for comments.

-Nathan

	* config/xtensa/xtensa-protos.h (function_arg_advance): Delete.
	(function_arg): Delete.
	* config/xtensa/xtensa.h (FUNCTION_ARG, FUNCTION_ARG_ADVANCE): Delete.
	(FUNCTION_INCOMING_ARG): Delete.
	* config/xtensa/xtensa.c (function_arg_advance): Rename to...
	(xtensa_function_arg_advance): ...this.  Make static.  Take a const_tree
	and a bool.
	(function_arg): Rename to...
	(xtensa_function_arg_1): ...this.  Make static.  Take a const_tree and
	a bool.
	(xtensa_function_arg, xtensa_function_incoming_arg): Nex functions.
	(TARGET_FUNCTION_ARG, TARGET_FUNCTION_ARG_ADVANCE): Define.
	(TARGET_FUNCTION_INCOMING_ARG): Define.

diff --git a/gcc/config/xtensa/xtensa-protos.h b/gcc/config/xtensa/xtensa-protos.h
index 729bc84..18c08d7 100644
--- a/gcc/config/xtensa/xtensa-protos.h
+++ b/gcc/config/xtensa/xtensa-protos.h
@@ -73,9 +73,6 @@ extern reg_class_t xtensa_secondary_reload (bool, rtx, reg_class_t,
#endif /* RTX_CODE */
#ifdef TREE_CODE
-extern void function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode, tree);
-extern struct rtx_def *function_arg (CUMULATIVE_ARGS *, enum machine_mode,
- tree, int);
extern int function_arg_boundary (enum machine_mode, tree);
#endif /* TREE_CODE */
diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c
index 610a272..f81452a 100644
--- a/gcc/config/xtensa/xtensa.c
+++ b/gcc/config/xtensa/xtensa.c
@@ -140,6 +140,12 @@ static tree xtensa_build_builtin_va_list (void);
static bool xtensa_return_in_memory (const_tree, const_tree);
static tree xtensa_gimplify_va_arg_expr (tree, tree, gimple_seq *,
gimple_seq *);
+static void xtensa_function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode,
+ const_tree, bool);
+static rtx xtensa_function_arg (CUMULATIVE_ARGS *, enum machine_mode,
+ const_tree, bool);
+static rtx xtensa_function_incoming_arg (CUMULATIVE_ARGS *,
+ enum machine_mode, const_tree, bool);
static rtx xtensa_function_value (const_tree, const_tree, bool);
static void xtensa_init_builtins (void);
static tree xtensa_fold_builtin (tree, int, tree *, bool);
@@ -201,6 +207,12 @@ static const int reg_nonleaf_alloc_order[FIRST_PSEUDO_REGISTER] =
#define TARGET_SPLIT_COMPLEX_ARG hook_bool_const_tree_true
#undef TARGET_MUST_PASS_IN_STACK
#define TARGET_MUST_PASS_IN_STACK must_pass_in_stack_var_size
+#undef TARGET_FUNCTION_ARG_ADVANCE
+#define TARGET_FUNCTION_ARG_ADVANCE xtensa_function_arg_advance
+#undef TARGET_FUNCTION_ARG
+#define TARGET_FUNCTION_ARG xtensa_function_arg
+#undef TARGET_FUNCTION_INCOMING_ARG
+#define TARGET_FUNCTION_INCOMING_ARG xtensa_function_incoming_arg
#undef TARGET_EXPAND_BUILTIN_SAVEREGS
#define TARGET_EXPAND_BUILTIN_SAVEREGS xtensa_builtin_saveregs
@@ -1983,8 +1995,9 @@ init_cumulative_args (CUMULATIVE_ARGS *cum, int incoming)
/* Advance the argument to the next argument position. */
-void
-function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type)
+static void
+xtensa_function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode,
+ const_tree type, bool named ATTRIBUTE_UNUSED)
{
int words, max;
int *arg_words;
@@ -2009,9 +2022,9 @@ function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type)
or 0 if the argument is to be passed on the stack. INCOMING_P is nonzero
if this is an incoming argument to the current function. */
-rtx
-function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type,
- int incoming_p)
+static rtx
+xtensa_function_arg_1 (const CUMULATIVE_ARGS *cum, enum machine_mode mode,
+ const_tree type, bool incoming_p)
{
int regbase, words, max;
int *arg_words;
@@ -2042,6 +2055,23 @@ function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type,
return gen_rtx_REG (mode, regno);
}
+/* Implement TARGET_FUNCTION_ARG. */
+
+static rtx
+xtensa_function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode,
+ const_tree type, bool named ATTRIBUTE_UNUSED)
+{
+ return xtensa_function_arg_1 (cum, mode, type, false);
+}
+
+/* Implement TARGET_FUNCTION_INCOMING_ARG. */
+
+static rtx
+xtensa_function_incoming_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode,
+ const_tree type, bool named ATTRIBUTE_UNUSED)
+{
+ return xtensa_function_arg_1 (cum, mode, type, true);
+}
int
function_arg_boundary (enum machine_mode mode, tree type)
diff --git a/gcc/config/xtensa/xtensa.h b/gcc/config/xtensa/xtensa.h
index 32819bc..153242a 100644
--- a/gcc/config/xtensa/xtensa.h
+++ b/gcc/config/xtensa/xtensa.h
@@ -618,18 +618,6 @@ typedef struct xtensa_args
#define INIT_CUMULATIVE_INCOMING_ARGS(CUM, FNTYPE, LIBNAME) \
init_cumulative_args (&CUM, 1)
-/* 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) \
- function_arg_advance (&CUM, MODE, TYPE)
-
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
- function_arg (&CUM, MODE, TYPE, FALSE)
-
-#define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED) \
- function_arg (&CUM, MODE, TYPE, TRUE)
-
#define FUNCTION_ARG_BOUNDARY function_arg_boundary
/* Profiling Xtensa code is typically done with the built-in profiling


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]