This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[ia64] hookize FUNCTION_ARG &co.
- From: Nathan Froyd <froydnj at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: sje at cup dot hp dot com
- Date: Fri, 8 Oct 2010 09:58:09 -0400
- Subject: [ia64] hookize FUNCTION_ARG &co.
The patch below hookizes FUNCTION_ARG and related macros for the ia64
backend. Nothing special here.
Tested by inspection with cross to ia64-elf. I plan to commit this
under the obvious rule after waiting a week for comments/approval.
* config/ia64/ia64-protos.h (ia64_function_arg): Delete.
(ia64_function_arg_advance): Delete.
* config/ia64/ia64.h (FUNCTION_ARG, FUNCTION_INCOMING_ARG): Delete.
(FUNCTION_ARG_ADVANCE): Delete.
* config/ia64/ia64.c (ia64_function_arg): Rename to...
(ia64_function_arg_1): ...this. Make static. Take const_tree and
bool arguments.
(ia64_function_arg, ia64_function_incoming_arg): New functions.
(ia64_function_arg_advance): Make static. Take a const_tree and
a bool.
(TARGET_FUNCTION_ARG, TARGET_FUNCTION_INCOMING_ARG): Define.
(TARGET_FUNCTION_ARG_ADVANCE): Define.
---
gcc/config/ia64/ia64-protos.h | 4 ---
gcc/config/ia64/ia64.c | 48 +++++++++++++++++++++++++++++++++++------
gcc/config/ia64/ia64.h | 21 ------------------
3 files changed, 41 insertions(+), 32 deletions(-)
diff --git a/gcc/config/ia64/ia64-protos.h b/gcc/config/ia64/ia64-protos.h
index 8a3ff4b..2a6f1ab 100644
--- a/gcc/config/ia64/ia64-protos.h
+++ b/gcc/config/ia64/ia64-protos.h
@@ -64,14 +64,10 @@ extern const char *get_bundle_name (int);
#ifdef TREE_CODE
#ifdef RTX_CODE
-extern rtx ia64_function_arg (CUMULATIVE_ARGS *, enum machine_mode,
- tree, int, int);
extern rtx ia64_expand_builtin (tree, rtx, rtx, enum machine_mode, int);
extern rtx ia64_va_arg (tree, tree);
#endif /* RTX_CODE */
-extern void ia64_function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode,
- tree, int);
extern int ia64_function_arg_boundary (enum machine_mode, tree);
extern void ia64_asm_output_external (FILE *, tree, const char *);
extern void ia64_vms_output_aligned_decl_common (FILE *, tree, const char *,
diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c
index d272860..726ce42 100644
--- a/gcc/config/ia64/ia64.c
+++ b/gcc/config/ia64/ia64.c
@@ -209,6 +209,14 @@ static void ia64_setup_incoming_varargs (CUMULATIVE_ARGS *, enum machine_mode,
tree, int *, int);
static int ia64_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
tree, bool);
+static rtx ia64_function_arg_1 (const CUMULATIVE_ARGS *, enum machine_mode,
+ const_tree, bool, bool);
+static rtx ia64_function_arg (CUMULATIVE_ARGS *, enum machine_mode,
+ const_tree, bool);
+static rtx ia64_function_incoming_arg (CUMULATIVE_ARGS *,
+ enum machine_mode, const_tree, bool);
+static void ia64_function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode,
+ const_tree, bool);
static bool ia64_function_ok_for_sibcall (tree, tree);
static bool ia64_return_in_memory (const_tree, const_tree);
static rtx ia64_function_value (const_tree, const_tree, bool);
@@ -467,6 +475,12 @@ static const struct attribute_spec ia64_attribute_table[] =
#define TARGET_FUNCTION_OK_FOR_SIBCALL ia64_function_ok_for_sibcall
#undef TARGET_ARG_PARTIAL_BYTES
#define TARGET_ARG_PARTIAL_BYTES ia64_arg_partial_bytes
+#undef TARGET_FUNCTION_ARG
+#define TARGET_FUNCTION_ARG ia64_function_arg
+#undef TARGET_FUNCTION_INCOMING_ARG
+#define TARGET_FUNCTION_INCOMING_ARG ia64_function_incoming_arg
+#undef TARGET_FUNCTION_ARG_ADVANCE
+#define TARGET_FUNCTION_ARG_ADVANCE ia64_function_arg_advance
#undef TARGET_ASM_OUTPUT_MI_THUNK
#define TARGET_ASM_OUTPUT_MI_THUNK ia64_output_mi_thunk
@@ -4233,7 +4247,7 @@ hfa_element_mode (const_tree type, bool nested)
/* Return the number of words required to hold a quantity of TYPE and MODE
when passed as an argument. */
static int
-ia64_function_arg_words (tree type, enum machine_mode mode)
+ia64_function_arg_words (const_tree type, enum machine_mode mode)
{
int words;
@@ -4259,7 +4273,8 @@ ia64_function_arg_words (tree type, enum machine_mode mode)
all as if they had 16 byte alignment. Such aggregates can occur
only if gcc extensions are used. */
static int
-ia64_function_arg_offset (CUMULATIVE_ARGS *cum, tree type, int words)
+ia64_function_arg_offset (const CUMULATIVE_ARGS *cum,
+ const_tree type, int words)
{
/* No registers are skipped on VMS. */
if (TARGET_ABI_OPEN_VMS || (cum->words & 1) == 0)
@@ -4278,9 +4293,9 @@ ia64_function_arg_offset (CUMULATIVE_ARGS *cum, tree type, int words)
/* ??? 128-bit quad-precision floats are always passed in general
registers. */
-rtx
-ia64_function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type,
- int named, int incoming)
+static rtx
+ia64_function_arg_1 (const CUMULATIVE_ARGS *cum, enum machine_mode mode,
+ const_tree type, bool named, bool incoming)
{
int basereg = (incoming ? GR_ARG_FIRST : AR_ARG_FIRST);
int words = ia64_function_arg_words (type, mode);
@@ -4469,6 +4484,25 @@ ia64_function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type,
}
}
+/* Implement TARGET_FUNCION_ARG target hook. */
+
+static rtx
+ia64_function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode,
+ const_tree type, bool named)
+{
+ return ia64_function_arg_1 (cum, mode, type, named, false);
+}
+
+/* Implement TARGET_FUNCION_INCOMING_ARG target hook. */
+
+static rtx
+ia64_function_incoming_arg (CUMULATIVE_ARGS *cum,
+ enum machine_mode mode,
+ const_tree type, bool named)
+{
+ return ia64_function_arg_1 (cum, mode, type, named, true);
+}
+
/* Return number of bytes, at the beginning of the argument, that must be
put in registers. 0 is the argument is entirely in registers or entirely
in memory. */
@@ -4514,9 +4548,9 @@ ia64_arg_type (enum machine_mode mode)
/* Update CUM to point after this argument. This is patterned after
ia64_function_arg. */
-void
+static void
ia64_function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode,
- tree type, int named)
+ const_tree type, bool named)
{
int words = ia64_function_arg_words (type, mode);
int offset = ia64_function_arg_offset (cum, type, words);
diff --git a/gcc/config/ia64/ia64.h b/gcc/config/ia64/ia64.h
index 98e9b64..49745bc 100644
--- a/gcc/config/ia64/ia64.h
+++ b/gcc/config/ia64/ia64.h
@@ -1043,19 +1043,6 @@ enum reg_class
#define FR_RET_LAST FR_REG (15)
#define AR_ARG_FIRST OUT_REG (0)
-/* A C expression that controls whether a function argument is passed in a
- register, and which register. */
-
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
- ia64_function_arg (&CUM, MODE, TYPE, NAMED, 0)
-
-/* Define this macro if the target machine has "register windows", so that the
- register in which a function sees an arguments is not necessarily the same
- as the one in which the caller passed the argument. */
-
-#define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED) \
- ia64_function_arg (&CUM, MODE, TYPE, NAMED, 1)
-
/* A C type for declaring a variable that is used as the first argument of
`FUNCTION_ARG' and other related values. For some target machines, the type
`int' suffices and can hold the number of bytes of argument so far. */
@@ -1103,14 +1090,6 @@ do { \
(CUM).atypes[6] = (CUM).atypes[7] = I64; \
} while (0)
-/* A C statement (sans semicolon) to update the summarizer variable CUM to
- advance past an argument in the argument list. The values MODE, TYPE and
- NAMED describe that argument. Once this is done, the variable CUM is
- suitable for analyzing the *following* argument with `FUNCTION_ARG'. */
-
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
- ia64_function_arg_advance (&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. */
--
1.7.0.4