summaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/alpha/alpha-protos.h1
-rw-r--r--gcc/config/alpha/alpha.c10
-rw-r--r--gcc/config/alpha/alpha.h4
-rw-r--r--gcc/config/alpha/unicosmk.h2
-rw-r--r--gcc/config/arc/arc-protos.h2
-rw-r--r--gcc/config/arc/arc.c6
-rw-r--r--gcc/config/arc/arc.h5
-rw-r--r--gcc/config/frv/frv-protos.h2
-rw-r--r--gcc/config/frv/frv.c6
-rw-r--r--gcc/config/frv/frv.h13
-rw-r--r--gcc/config/i386/i386-protos.h2
-rw-r--r--gcc/config/i386/i386.c10
-rw-r--r--gcc/config/i386/i386.h4
-rw-r--r--gcc/config/iq2000/iq2000-protos.h1
-rw-r--r--gcc/config/iq2000/iq2000.c6
-rw-r--r--gcc/config/iq2000/iq2000.h6
-rw-r--r--gcc/config/mips/mips-protos.h1
-rw-r--r--gcc/config/mips/mips.c6
-rw-r--r--gcc/config/mips/mips.h3
-rw-r--r--gcc/config/mn10300/mn10300-protos.h4
-rw-r--r--gcc/config/mn10300/mn10300.c5
-rw-r--r--gcc/config/mn10300/mn10300.h4
-rw-r--r--gcc/config/mt/mt-protos.h1
-rw-r--r--gcc/config/pa/pa-protos.h3
-rw-r--r--gcc/config/pa/pa.c5
-rw-r--r--gcc/config/pa/pa.h5
-rw-r--r--gcc/config/rs6000/rs6000-protos.h1
-rw-r--r--gcc/config/rs6000/rs6000.c11
-rw-r--r--gcc/config/rs6000/rs6000.h4
-rw-r--r--gcc/config/s390/s390-protos.h1
-rw-r--r--gcc/config/s390/s390.c4
-rw-r--r--gcc/config/s390/s390.h5
-rw-r--r--gcc/config/sh/sh-protos.h3
-rw-r--r--gcc/config/sh/sh.c5
-rw-r--r--gcc/config/sh/sh.h4
-rw-r--r--gcc/config/sparc/sparc-protos.h1
-rw-r--r--gcc/config/sparc/sparc.c5
-rw-r--r--gcc/config/sparc/sparc.h4
-rw-r--r--gcc/config/spu/spu-protos.h1
-rw-r--r--gcc/config/spu/spu.c6
-rw-r--r--gcc/config/spu/spu.h5
-rw-r--r--gcc/config/stormy16/stormy16-protos.h1
-rw-r--r--gcc/config/stormy16/stormy16.c4
-rw-r--r--gcc/config/stormy16/stormy16.h10
-rw-r--r--gcc/config/xtensa/xtensa-protos.h1
-rw-r--r--gcc/config/xtensa/xtensa.c5
-rw-r--r--gcc/config/xtensa/xtensa.h4
47 files changed, 78 insertions, 124 deletions
diff --git a/gcc/config/alpha/alpha-protos.h b/gcc/config/alpha/alpha-protos.h
index df2ae6814d2..bbbcd8f4f1a 100644
--- a/gcc/config/alpha/alpha-protos.h
+++ b/gcc/config/alpha/alpha-protos.h
@@ -75,7 +75,6 @@ extern void print_operand (FILE *, rtx, int);
extern void print_operand_address (FILE *, rtx);
extern void alpha_initialize_trampoline (rtx, rtx, rtx, int, int, int);
-extern void alpha_va_start (tree, rtx);
extern rtx alpha_va_arg (tree, tree);
extern rtx function_arg (CUMULATIVE_ARGS, enum machine_mode, tree, int);
extern rtx function_value (const_tree, const_tree, enum machine_mode);
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index fee5cd11115..800b354a71d 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -522,6 +522,11 @@ override_options (void)
if (!(target_flags_explicit & MASK_LONG_DOUBLE_128))
target_flags |= MASK_LONG_DOUBLE_128;
#endif
+
+ /* If using typedef char *va_list, signal that __builtin_va_start (&ap, 0)
+ can be optimized to ap = __builtin_next_arg (0). */
+ if (TARGET_ABI_UNICOSMK)
+ targetm.expand_builtin_va_start = NULL;
}
/* Returns 1 if VALUE is a mask that contains full bytes of zero or ones. */
@@ -6069,7 +6074,7 @@ alpha_setup_incoming_varargs (CUMULATIVE_ARGS *pcum, enum machine_mode mode,
#endif
}
-void
+static void
alpha_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED)
{
HOST_WIDE_INT offset;
@@ -10704,6 +10709,9 @@ alpha_init_libfuncs (void)
#undef TARGET_BUILD_BUILTIN_VA_LIST
#define TARGET_BUILD_BUILTIN_VA_LIST alpha_build_builtin_va_list
+#undef TARGET_EXPAND_BUILTIN_VA_START
+#define TARGET_EXPAND_BUILTIN_VA_START alpha_va_start
+
/* The Alpha architecture does not require sequential consistency. See
http://www.cs.umd.edu/~pugh/java/memoryModel/AlphaReordering.html
for an example of how it can be violated in practice. */
diff --git a/gcc/config/alpha/alpha.h b/gcc/config/alpha/alpha.h
index 2b048841063..b0019bf22cf 100644
--- a/gcc/config/alpha/alpha.h
+++ b/gcc/config/alpha/alpha.h
@@ -1335,10 +1335,6 @@ do { \
#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
print_operand_address((FILE), (ADDR))
-/* Implement `va_start' for varargs and stdarg. */
-#define EXPAND_BUILTIN_VA_START(valist, nextarg) \
- alpha_va_start (valist, nextarg)
-
/* Tell collect that the object format is ECOFF. */
#define OBJECT_FORMAT_COFF
#define EXTENDED_COFF
diff --git a/gcc/config/alpha/unicosmk.h b/gcc/config/alpha/unicosmk.h
index 0721c19cdb6..d08fa73bc28 100644
--- a/gcc/config/alpha/unicosmk.h
+++ b/gcc/config/alpha/unicosmk.h
@@ -435,6 +435,4 @@ do { fprintf (FILE, "\tbr $1,0\n"); \
#undef LIB_SPEC
#define LIB_SPEC "-L/opt/ctl/craylibs/craylibs -lu -lm -lc -lsma"
-#undef EXPAND_BUILTIN_VA_START
-
#define EH_FRAME_IN_DATA_SECTION 1
diff --git a/gcc/config/arc/arc-protos.h b/gcc/config/arc/arc-protos.h
index 9eadf354b21..c9fc51ad2ac 100644
--- a/gcc/config/arc/arc-protos.h
+++ b/gcc/config/arc/arc-protos.h
@@ -17,8 +17,6 @@ You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
-extern void arc_va_start (tree, rtx);
-
#ifdef RTX_CODE
extern enum machine_mode arc_select_cc_mode (enum rtx_code, rtx, rtx);
diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
index a1e04af8c8f..5b2e7b804f4 100644
--- a/gcc/config/arc/arc.c
+++ b/gcc/config/arc/arc.c
@@ -89,6 +89,7 @@ static void arc_output_function_prologue (FILE *, HOST_WIDE_INT);
static void arc_output_function_epilogue (FILE *, HOST_WIDE_INT);
static void arc_file_start (void);
static void arc_internal_label (FILE *, const char *, unsigned long);
+static void arc_va_start (tree, rtx);
static void arc_setup_incoming_varargs (CUMULATIVE_ARGS *, enum machine_mode,
tree, int *, int);
static bool arc_rtx_costs (rtx, int, int, int *);
@@ -144,6 +145,9 @@ static bool arc_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode,
#undef TARGET_SETUP_INCOMING_VARARGS
#define TARGET_SETUP_INCOMING_VARARGS arc_setup_incoming_varargs
+#undef TARGET_EXPAND_BUILTIN_VA_START
+#define TARGET_EXPAND_BUILTIN_VA_START arc_va_start
+
struct gcc_target targetm = TARGET_INITIALIZER;
/* Implement TARGET_HANDLE_OPTION. */
@@ -2274,7 +2278,7 @@ arc_ccfsm_record_branch_deleted (void)
current_insn_set_cc_p = last_insn_set_cc_p;
}
-void
+static void
arc_va_start (tree valist, rtx nextarg)
{
/* See arc_setup_incoming_varargs for reasons for this oddity. */
diff --git a/gcc/config/arc/arc.h b/gcc/config/arc/arc.h
index 05f4aad9dba..17412fc18d8 100644
--- a/gcc/config/arc/arc.h
+++ b/gcc/config/arc/arc.h
@@ -1086,8 +1086,3 @@ enum arc_function_type {
#define ARC_INTERRUPT_P(TYPE) \
((TYPE) == ARC_FUNCTION_ILINK1 || (TYPE) == ARC_FUNCTION_ILINK2)
/* Compute the type of a function from its DECL. */
-
-
-/* Implement `va_start' for varargs and stdarg. */
-#define EXPAND_BUILTIN_VA_START(valist, nextarg) \
- arc_va_start (valist, nextarg)
diff --git a/gcc/config/frv/frv-protos.h b/gcc/config/frv/frv-protos.h
index 89f2f1e3353..dd41fc27767 100644
--- a/gcc/config/frv/frv-protos.h
+++ b/gcc/config/frv/frv-protos.h
@@ -64,8 +64,6 @@ extern rtx frv_function_arg (CUMULATIVE_ARGS *,
extern void frv_function_arg_advance (CUMULATIVE_ARGS *,
enum machine_mode,
tree, int);
-
-extern void frv_expand_builtin_va_start (tree, rtx);
#endif /* TREE_CODE */
extern int frv_expand_block_move (rtx *);
diff --git a/gcc/config/frv/frv.c b/gcc/config/frv/frv.c
index 9c31b8bb500..150e25d568b 100644
--- a/gcc/config/frv/frv.c
+++ b/gcc/config/frv/frv.c
@@ -365,6 +365,7 @@ static void frv_setup_incoming_varargs (CUMULATIVE_ARGS *,
enum machine_mode,
tree, int *, int);
static rtx frv_expand_builtin_saveregs (void);
+static void frv_expand_builtin_va_start (tree, rtx);
static bool frv_rtx_costs (rtx, int, int, int*);
static void frv_asm_out_constructor (rtx, int);
static void frv_asm_out_destructor (rtx, int);
@@ -453,6 +454,9 @@ static void frv_output_dwarf_dtprel (FILE *, int, rtx)
#undef TARGET_MACHINE_DEPENDENT_REORG
#define TARGET_MACHINE_DEPENDENT_REORG frv_reorg
+#undef TARGET_EXPAND_BUILTIN_VA_START
+#define TARGET_EXPAND_BUILTIN_VA_START frv_expand_builtin_va_start
+
#if HAVE_AS_TLS
#undef TARGET_ASM_OUTPUT_DWARF_DTPREL
#define TARGET_ASM_OUTPUT_DWARF_DTPREL frv_output_dwarf_dtprel
@@ -2186,7 +2190,7 @@ frv_expand_builtin_saveregs (void)
/* Expand __builtin_va_start to do the va_start macro. */
-void
+static void
frv_expand_builtin_va_start (tree valist, rtx nextarg)
{
tree t;
diff --git a/gcc/config/frv/frv.h b/gcc/config/frv/frv.h
index ba00ee44b23..feb88d56946 100644
--- a/gcc/config/frv/frv.h
+++ b/gcc/config/frv/frv.h
@@ -1847,19 +1847,6 @@ typedef struct frv_stack {
#define FUNCTION_PROFILER(FILE, LABELNO)
-
-/* Implementing the Varargs Macros. */
-
-/* Implement the stdarg/varargs va_start macro. STDARG_P is nonzero if this
- is stdarg.h instead of varargs.h. VALIST is the tree of the va_list
- variable to initialize. NEXTARG is the machine independent notion of the
- 'next' argument after the variable arguments. If not defined, a standard
- implementation will be defined that works for arguments passed on the stack. */
-
-#define EXPAND_BUILTIN_VA_START(VALIST, NEXTARG) \
- (frv_expand_builtin_va_start(VALIST, NEXTARG))
-
-
/* Trampolines for Nested Functions. */
/* A C expression for the size in bytes of the trampoline, as an integer. */
diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h
index bb40af936e4..8dd203ebee6 100644
--- a/gcc/config/i386/i386-protos.h
+++ b/gcc/config/i386/i386-protos.h
@@ -137,8 +137,6 @@ extern bool ix86_function_arg_regno_p (int);
extern int ix86_function_arg_boundary (enum machine_mode, tree);
extern int ix86_return_in_memory (const_tree);
extern int ix86_sol10_return_in_memory (const_tree);
-extern void ix86_va_start (tree, rtx);
-extern rtx ix86_va_arg (tree, tree);
extern rtx ix86_force_to_memory (enum machine_mode, rtx);
extern void ix86_free_from_memory (enum machine_mode);
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index cac5dbeb1b0..095ba1727d7 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -2689,6 +2689,11 @@ override_options (void)
set_param_value ("l1-cache-size", ix86_cost->l1_cache_size);
if (!PARAM_SET_P (PARAM_L2_CACHE_SIZE))
set_param_value ("l2-cache-size", ix86_cost->l2_cache_size);
+
+ /* If using typedef char *va_list, signal that __builtin_va_start (&ap, 0)
+ can be optimized to ap = __builtin_next_arg (0). */
+ if (!TARGET_64BIT || TARGET_64BIT_MS_ABI)
+ targetm.expand_builtin_va_start = NULL;
}
/* Return true if this goes in large data/bss. */
@@ -5041,7 +5046,7 @@ ix86_setup_incoming_varargs (CUMULATIVE_ARGS *cum, enum machine_mode mode,
/* Implement va_start. */
-void
+static void
ix86_va_start (tree valist, rtx nextarg)
{
HOST_WIDE_INT words, n_gpr, n_fpr;
@@ -25253,6 +25258,9 @@ x86_builtin_vectorization_cost (bool runtime_test)
#undef TARGET_BUILD_BUILTIN_VA_LIST
#define TARGET_BUILD_BUILTIN_VA_LIST ix86_build_builtin_va_list
+#undef TARGET_EXPAND_BUILTIN_VA_START
+#define TARGET_EXPAND_BUILTIN_VA_START ix86_va_start
+
#undef TARGET_MD_ASM_CLOBBERS
#define TARGET_MD_ASM_CLOBBERS ix86_md_asm_clobbers
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index 3a36149a471..6e0b96a0b65 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -1710,10 +1710,6 @@ typedef struct ix86_args {
#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
function_arg (&(CUM), (MODE), (TYPE), (NAMED))
-/* Implement `va_start' for varargs and stdarg. */
-#define EXPAND_BUILTIN_VA_START(VALIST, NEXTARG) \
- ix86_va_start (VALIST, NEXTARG)
-
#define TARGET_ASM_FILE_END ix86_file_end
#define NEED_INDICATE_EXEC_STACK 0
diff --git a/gcc/config/iq2000/iq2000-protos.h b/gcc/config/iq2000/iq2000-protos.h
index 9b6837ef975..094bcbf2f12 100644
--- a/gcc/config/iq2000/iq2000-protos.h
+++ b/gcc/config/iq2000/iq2000-protos.h
@@ -48,7 +48,6 @@ extern void gen_conditional_branch (rtx *, enum rtx_code);
extern void init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx);
extern void function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode, tree, int);
extern struct rtx_def * function_arg (CUMULATIVE_ARGS *, enum machine_mode, const_tree, int);
-extern void iq2000_va_start (tree, rtx);
extern rtx iq2000_function_value (const_tree, const_tree);
#endif
diff --git a/gcc/config/iq2000/iq2000.c b/gcc/config/iq2000/iq2000.c
index 782aa72cbb1..7a31b4782bb 100644
--- a/gcc/config/iq2000/iq2000.c
+++ b/gcc/config/iq2000/iq2000.c
@@ -168,6 +168,7 @@ static bool iq2000_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode,
const_tree, bool);
static int iq2000_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
tree, bool);
+static void iq2000_va_start (tree, rtx);
#undef TARGET_INIT_BUILTINS
#define TARGET_INIT_BUILTINS iq2000_init_builtins
@@ -210,6 +211,9 @@ static int iq2000_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
#undef TARGET_STRICT_ARGUMENT_NAMING
#define TARGET_STRICT_ARGUMENT_NAMING hook_bool_CUMULATIVE_ARGS_true
+#undef TARGET_EXPAND_BUILTIN_VA_START
+#define TARGET_EXPAND_BUILTIN_VA_START iq2000_va_start
+
struct gcc_target targetm = TARGET_INITIALIZER;
/* Return nonzero if we split the address into high and low parts. */
@@ -1357,7 +1361,7 @@ iq2000_arg_partial_bytes (CUMULATIVE_ARGS *cum, enum machine_mode mode,
/* Implement va_start. */
-void
+static void
iq2000_va_start (tree valist, rtx nextarg)
{
int int_arg_words;
diff --git a/gcc/config/iq2000/iq2000.h b/gcc/config/iq2000/iq2000.h
index dcf7ab62f06..f7beb540bed 100644
--- a/gcc/config/iq2000/iq2000.h
+++ b/gcc/config/iq2000/iq2000.h
@@ -476,12 +476,6 @@ typedef struct iq2000_args
}
-/* Implementing the Varargs Macros. */
-
-#define EXPAND_BUILTIN_VA_START(valist, nextarg) \
- iq2000_va_start (valist, nextarg)
-
-
/* Trampolines for Nested Functions. */
/* A C statement to output, on the stream FILE, assembler code for a
diff --git a/gcc/config/mips/mips-protos.h b/gcc/config/mips/mips-protos.h
index ed7a7890faf..064d5684908 100644
--- a/gcc/config/mips/mips-protos.h
+++ b/gcc/config/mips/mips-protos.h
@@ -223,7 +223,6 @@ extern rtx mips_function_arg (const CUMULATIVE_ARGS *,
extern int mips_function_arg_boundary (enum machine_mode, tree);
extern bool mips_pad_arg_upward (enum machine_mode, const_tree);
extern bool mips_pad_reg_upward (enum machine_mode, tree);
-extern void mips_va_start (tree, rtx);
extern bool mips_expand_ext_as_unaligned_load (rtx, rtx, HOST_WIDE_INT,
HOST_WIDE_INT);
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 918f2375812..42e15a0320c 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -4735,9 +4735,9 @@ mips_build_builtin_va_list (void)
return ptr_type_node;
}
-/* Implement EXPAND_BUILTIN_VA_START. */
+/* Implement TARGET_EXPAND_BUILTIN_VA_START. */
-void
+static void
mips_va_start (tree valist, rtx nextarg)
{
if (EABI_FLOAT_VARARGS_P)
@@ -12445,6 +12445,8 @@ mips_order_regs_for_local_alloc (void)
#undef TARGET_BUILD_BUILTIN_VA_LIST
#define TARGET_BUILD_BUILTIN_VA_LIST mips_build_builtin_va_list
+#undef TARGET_EXPAND_BUILTIN_VA_START
+#define TARGET_EXPAND_BUILTIN_VA_START mips_va_start
#undef TARGET_GIMPLIFY_VA_ARG_EXPR
#define TARGET_GIMPLIFY_VA_ARG_EXPR mips_gimplify_va_arg_expr
diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h
index b4778a8577d..c3713e018b9 100644
--- a/gcc/config/mips/mips.h
+++ b/gcc/config/mips/mips.h
@@ -2098,9 +2098,6 @@ typedef struct mips_args {
(TARGET_NEWABI ? ((LOC) + 15) & -16 : ((LOC) + 7) & -8)
-/* Implement `va_start' for varargs and stdarg. */
-#define EXPAND_BUILTIN_VA_START mips_va_start
-
/* Output assembler code to FILE to increment profiler label # LABELNO
for profiling a function entry. */
diff --git a/gcc/config/mn10300/mn10300-protos.h b/gcc/config/mn10300/mn10300-protos.h
index 633988b73d7..d8fe2bd50a1 100644
--- a/gcc/config/mn10300/mn10300-protos.h
+++ b/gcc/config/mn10300/mn10300-protos.h
@@ -20,10 +20,6 @@ along with GCC; see the file COPYING3. If not see
#ifdef RTX_CODE
-#ifdef TREE_CODE
-extern void mn10300_va_start (tree, rtx);
-#endif /* TREE_CODE */
-
extern void mn10300_override_options (void);
extern struct rtx_def *legitimize_address (rtx, rtx, enum machine_mode);
extern rtx legitimize_pic_address (rtx, rtx);
diff --git a/gcc/config/mn10300/mn10300.c b/gcc/config/mn10300/mn10300.c
index 0fb57cc1bd1..9fde69986e7 100644
--- a/gcc/config/mn10300/mn10300.c
+++ b/gcc/config/mn10300/mn10300.c
@@ -74,6 +74,7 @@ static bool mn10300_rtx_costs (rtx, int, int, int *);
static void mn10300_file_start (void);
static bool mn10300_return_in_memory (const_tree, const_tree);
static rtx mn10300_builtin_saveregs (void);
+static void mn10300_va_start (tree, rtx);
static bool mn10300_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode,
const_tree, bool);
static int mn10300_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
@@ -114,6 +115,8 @@ static int mn10300_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
#undef TARGET_EXPAND_BUILTIN_SAVEREGS
#define TARGET_EXPAND_BUILTIN_SAVEREGS mn10300_builtin_saveregs
+#undef TARGET_EXPAND_BUILTIN_VA_START
+#define TARGET_EXPAND_BUILTIN_VA_START mn10300_va_start
static void mn10300_encode_section_info (tree, rtx, int);
struct gcc_target targetm = TARGET_INITIALIZER;
@@ -1471,7 +1474,7 @@ mn10300_builtin_saveregs (void)
offset, 0, 0, OPTAB_LIB_WIDEN));
}
-void
+static void
mn10300_va_start (tree valist, rtx nextarg)
{
nextarg = expand_builtin_saveregs ();
diff --git a/gcc/config/mn10300/mn10300.h b/gcc/config/mn10300/mn10300.h
index 9cb8244c1f6..824227546f0 100644
--- a/gcc/config/mn10300/mn10300.h
+++ b/gcc/config/mn10300/mn10300.h
@@ -624,10 +624,6 @@ struct cum_arg {int nbytes; };
((COUNT == 0) \
? gen_rtx_MEM (Pmode, arg_pointer_rtx) \
: (rtx) 0)
-
-/* Implement `va_start' for varargs and stdarg. */
-#define EXPAND_BUILTIN_VA_START(valist, nextarg) \
- mn10300_va_start (valist, nextarg)
/* 1 if X is an rtx for a constant that is a valid address. */
diff --git a/gcc/config/mt/mt-protos.h b/gcc/config/mt/mt-protos.h
index 5c959edd9ad..99717dc5eff 100644
--- a/gcc/config/mt/mt-protos.h
+++ b/gcc/config/mt/mt-protos.h
@@ -58,7 +58,6 @@ extern void mt_final_prescan_insn (rtx, rtx *, int);
#ifdef RTX_CODE
extern void mt_init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, tree, int);
extern rtx mt_function_arg (const CUMULATIVE_ARGS *, enum machine_mode, tree, int, int);
-extern void mt_va_start (tree, rtx);
extern enum reg_class mt_secondary_reload_class (enum reg_class, enum machine_mode, rtx);
extern rtx mt_function_value (const_tree, enum machine_mode, const_tree);
#endif
diff --git a/gcc/config/pa/pa-protos.h b/gcc/config/pa/pa-protos.h
index 9d5c2b9e7f2..ff621a30733 100644
--- a/gcc/config/pa/pa-protos.h
+++ b/gcc/config/pa/pa-protos.h
@@ -29,9 +29,6 @@ extern int following_call (rtx);
extern int function_label_operand (rtx, enum machine_mode);
extern int lhs_lshift_cint_operand (rtx, enum machine_mode);
-#ifdef TREE_CODE
-extern void hppa_va_start (tree, rtx);
-#endif /* TREE_CODE */
extern rtx hppa_legitimize_address (rtx, rtx, enum machine_mode);
/* Define functions in pa.c and used in insn-output.c. */
diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c
index 47de208483a..58122f62118 100644
--- a/gcc/config/pa/pa.c
+++ b/gcc/config/pa/pa.c
@@ -124,6 +124,7 @@ static void pa_asm_out_destructor (rtx, int);
#endif
static void pa_init_builtins (void);
static rtx hppa_builtin_saveregs (void);
+static void hppa_va_start (tree, rtx);
static tree hppa_gimplify_va_arg_expr (tree, tree, tree *, tree *);
static bool pa_scalar_mode_supported_p (enum machine_mode);
static bool pa_commutative_p (const_rtx x, int outer_code);
@@ -304,6 +305,8 @@ static size_t n_deferred_plabels = 0;
#undef TARGET_EXPAND_BUILTIN_SAVEREGS
#define TARGET_EXPAND_BUILTIN_SAVEREGS hppa_builtin_saveregs
+#undef TARGET_EXPAND_BUILTIN_VA_START
+#define TARGET_EXPAND_BUILTIN_VA_START hppa_va_start
#undef TARGET_GIMPLIFY_VA_ARG_EXPR
#define TARGET_GIMPLIFY_VA_ARG_EXPR hppa_gimplify_va_arg_expr
@@ -5913,7 +5916,7 @@ hppa_builtin_saveregs (void)
offset, 0, 0, OPTAB_LIB_WIDEN));
}
-void
+static void
hppa_va_start (tree valist, rtx nextarg)
{
nextarg = expand_builtin_saveregs ();
diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h
index 56e4e131f9a..8a7fb63eaca 100644
--- a/gcc/config/pa/pa.h
+++ b/gcc/config/pa/pa.h
@@ -976,11 +976,6 @@ extern int may_call_alloca;
#define TRAMPOLINE_ADJUST_ADDRESS(ADDR) \
if (!TARGET_64BIT) (ADDR) = memory_address (Pmode, plus_constant ((ADDR), 46))
-
-/* Implement `va_start' for varargs and stdarg. */
-
-#define EXPAND_BUILTIN_VA_START(valist, nextarg) \
- hppa_va_start (valist, nextarg)
/* Addressing modes, and classification of registers for them.
diff --git a/gcc/config/rs6000/rs6000-protos.h b/gcc/config/rs6000/rs6000-protos.h
index 56bb376a77d..4c031e7de63 100644
--- a/gcc/config/rs6000/rs6000-protos.h
+++ b/gcc/config/rs6000/rs6000-protos.h
@@ -28,7 +28,6 @@
#ifdef TREE_CODE
extern void init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, int, int, int);
-extern void rs6000_va_start (tree, rtx);
#endif /* TREE_CODE */
extern bool easy_altivec_constant (rtx, enum machine_mode);
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 3367e0848da..a2baf46107f 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -899,6 +899,7 @@ static void rs6000_darwin_file_start (void);
#endif
static tree rs6000_build_builtin_va_list (void);
+static void rs6000_va_start (tree, rtx);
static tree rs6000_gimplify_va_arg (tree, tree, tree *, tree *);
static bool rs6000_must_pass_in_stack (enum machine_mode, const_tree);
static bool rs6000_scalar_mode_supported_p (enum machine_mode);
@@ -1159,6 +1160,9 @@ static const char alt_reg_names[][8] =
#undef TARGET_BUILD_BUILTIN_VA_LIST
#define TARGET_BUILD_BUILTIN_VA_LIST rs6000_build_builtin_va_list
+#undef TARGET_EXPAND_BUILTIN_VA_START
+#define TARGET_EXPAND_BUILTIN_VA_START rs6000_va_start
+
#undef TARGET_GIMPLIFY_VA_ARG_EXPR
#define TARGET_GIMPLIFY_VA_ARG_EXPR rs6000_gimplify_va_arg
@@ -1842,6 +1846,11 @@ rs6000_override_options (const char *default_cpu)
set_param_value ("l1-cache-line-size", rs6000_cost->cache_line_size);
if (!PARAM_SET_P (PARAM_L2_CACHE_SIZE))
set_param_value ("l2-cache-size", rs6000_cost->l2_cache_size);
+
+ /* If using typedef char *va_list, signal that __builtin_va_start (&ap, 0)
+ can be optimized to ap = __builtin_next_arg (0). */
+ if (DEFAULT_ABI != ABI_V4)
+ targetm.expand_builtin_va_start = NULL;
}
/* Implement targetm.vectorize.builtin_mask_for_load. */
@@ -6495,7 +6504,7 @@ rs6000_build_builtin_va_list (void)
/* Implement va_start. */
-void
+static void
rs6000_va_start (tree valist, rtx nextarg)
{
HOST_WIDE_INT words, n_gpr, n_fpr;
diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h
index 7fb2002be5c..3693f53cc54 100644
--- a/gcc/config/rs6000/rs6000.h
+++ b/gcc/config/rs6000/rs6000.h
@@ -1498,10 +1498,6 @@ typedef struct rs6000_args
#define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \
function_arg_boundary (MODE, TYPE)
-/* Implement `va_start' for varargs and stdarg. */
-#define EXPAND_BUILTIN_VA_START(valist, nextarg) \
- rs6000_va_start (valist, nextarg)
-
#define PAD_VARARGS_DOWN \
(FUNCTION_ARG_PADDING (TYPE_MODE (type), type) == downward)
diff --git a/gcc/config/s390/s390-protos.h b/gcc/config/s390/s390-protos.h
index bfefb0daa33..7e329f2a565 100644
--- a/gcc/config/s390/s390-protos.h
+++ b/gcc/config/s390/s390-protos.h
@@ -122,6 +122,5 @@ extern void s390_function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode,
#ifdef RTX_CODE
extern rtx s390_function_arg (CUMULATIVE_ARGS *, enum machine_mode, tree, int);
extern rtx s390_function_value (const_tree, enum machine_mode);
-extern void s390_va_start (tree, rtx);
#endif /* RTX_CODE */
#endif /* TREE_CODE */
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index c1c46683081..f7d80dbc01c 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -7978,7 +7978,7 @@ s390_build_builtin_va_list (void)
holds the offset of the first anonymous stack argument
(relative to the virtual arg pointer). */
-void
+static void
s390_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED)
{
HOST_WIDE_INT n_gpr, n_fpr;
@@ -9331,6 +9331,8 @@ s390_reorg (void)
#undef TARGET_BUILD_BUILTIN_VA_LIST
#define TARGET_BUILD_BUILTIN_VA_LIST s390_build_builtin_va_list
+#undef TARGET_EXPAND_BUILTIN_VA_START
+#define TARGET_EXPAND_BUILTIN_VA_START s390_va_start
#undef TARGET_GIMPLIFY_VA_ARG_EXPR
#define TARGET_GIMPLIFY_VA_ARG_EXPR s390_gimplify_va_arg
diff --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h
index bd2102b4cef..35cc9477b8c 100644
--- a/gcc/config/s390/s390.h
+++ b/gcc/config/s390/s390.h
@@ -661,11 +661,6 @@ CUMULATIVE_ARGS;
#define PROFILE_BEFORE_PROLOGUE 1
-/* Implementing the varargs macros. */
-
-#define EXPAND_BUILTIN_VA_START(valist, nextarg) \
- s390_va_start (valist, nextarg)
-
/* Trampolines for nested functions. */
#define TRAMPOLINE_SIZE (TARGET_64BIT ? 32 : 16)
diff --git a/gcc/config/sh/sh-protos.h b/gcc/config/sh/sh-protos.h
index e236a0ecd1a..25d9ce43392 100644
--- a/gcc/config/sh/sh-protos.h
+++ b/gcc/config/sh/sh-protos.h
@@ -120,9 +120,6 @@ extern void sh_expand_binop_v2sf (enum rtx_code, rtx, rtx, rtx);
extern int sh_expand_t_scc (enum rtx_code code, rtx target);
extern rtx sh_gen_truncate (enum machine_mode, rtx, int);
extern bool sh_vector_mode_supported_p (enum machine_mode);
-#ifdef TREE_CODE
-extern void sh_va_start (tree, rtx);
-#endif /* TREE_CODE */
#endif /* RTX_CODE */
extern const char *output_jump_label_table (void);
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index 8d82fa2b2a2..4088ef73cdf 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -248,6 +248,7 @@ static void sh_setup_incoming_varargs (CUMULATIVE_ARGS *, enum machine_mode, tre
static bool sh_strict_argument_naming (CUMULATIVE_ARGS *);
static bool sh_pretend_outgoing_varargs_named (CUMULATIVE_ARGS *);
static tree sh_build_builtin_va_list (void);
+static void sh_va_start (tree, rtx);
static tree sh_gimplify_va_arg_expr (tree, tree, tree *, tree *);
static bool sh_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode,
const_tree, bool);
@@ -425,6 +426,8 @@ static int sh_dwarf_calling_convention (const_tree);
#undef TARGET_BUILD_BUILTIN_VA_LIST
#define TARGET_BUILD_BUILTIN_VA_LIST sh_build_builtin_va_list
+#undef TARGET_EXPAND_BUILTIN_VA_START
+#define TARGET_EXPAND_BUILTIN_VA_START sh_va_start
#undef TARGET_GIMPLIFY_VA_ARG_EXPR
#define TARGET_GIMPLIFY_VA_ARG_EXPR sh_gimplify_va_arg_expr
@@ -7035,7 +7038,7 @@ sh_build_builtin_va_list (void)
/* Implement `va_start' for varargs and stdarg. */
-void
+static void
sh_va_start (tree valist, rtx nextarg)
{
tree f_next_o, f_next_o_limit, f_next_fp, f_next_fp_limit, f_next_stack;
diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h
index d5329d9c6e1..844ea23c633 100644
--- a/gcc/config/sh/sh.h
+++ b/gcc/config/sh/sh.h
@@ -2076,10 +2076,6 @@ struct sh_args {
/* Perform any needed actions needed for a function that is receiving a
variable number of arguments. */
-/* Implement `va_start' for varargs and stdarg. */
-#define EXPAND_BUILTIN_VA_START(valist, nextarg) \
- sh_va_start (valist, nextarg)
-
/* Call the function profiler with a given profile label.
We use two .aligns, so as to make sure that both the .long is aligned
on a 4 byte boundary, and that the .long is a fixed distance (2 bytes)
diff --git a/gcc/config/sparc/sparc-protos.h b/gcc/config/sparc/sparc-protos.h
index 217948af08d..7c56925c01d 100644
--- a/gcc/config/sparc/sparc-protos.h
+++ b/gcc/config/sparc/sparc-protos.h
@@ -31,7 +31,6 @@ extern struct rtx_def *function_arg (const CUMULATIVE_ARGS *,
enum machine_mode, tree, int, int);
#ifdef RTX_CODE
extern void init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, tree);
-extern void sparc_va_start (tree, rtx);
#endif
extern unsigned long sparc_type_code (tree);
#ifdef ARGS_SIZE_RTX
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index ca3463060a3..c54dbb325ac 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -409,6 +409,7 @@ static bool sparc_promote_prototypes (const_tree);
static rtx sparc_struct_value_rtx (tree, int);
static bool sparc_return_in_memory (const_tree, const_tree);
static bool sparc_strict_argument_naming (CUMULATIVE_ARGS *);
+static void sparc_va_start (tree, rtx);
static tree sparc_gimplify_va_arg (tree, tree, tree *, tree *);
static bool sparc_vector_mode_supported_p (enum machine_mode);
static bool sparc_pass_by_reference (CUMULATIVE_ARGS *,
@@ -545,6 +546,8 @@ static bool fpu_option_set = false;
#undef TARGET_STRICT_ARGUMENT_NAMING
#define TARGET_STRICT_ARGUMENT_NAMING sparc_strict_argument_naming
+#undef TARGET_EXPAND_BUILTIN_VA_START
+#define TARGET_EXPAND_BUILTIN_VA_START sparc_va_start
#undef TARGET_GIMPLIFY_VA_ARG_EXPR
#define TARGET_GIMPLIFY_VA_ARG_EXPR sparc_gimplify_va_arg
@@ -5696,7 +5699,7 @@ sparc_builtin_saveregs (void)
/* Implement `va_start' for stdarg. */
-void
+static void
sparc_va_start (tree valist, rtx nextarg)
{
nextarg = expand_builtin_saveregs ();
diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h
index 0ff70f6395d..53983d46421 100644
--- a/gcc/config/sparc/sparc.h
+++ b/gcc/config/sparc/sparc.h
@@ -1700,10 +1700,6 @@ do { \
else \
sparc_initialize_trampoline (TRAMP, FNADDR, CXT)
-/* Implement `va_start' for varargs and stdarg. */
-#define EXPAND_BUILTIN_VA_START(valist, nextarg) \
- sparc_va_start (valist, nextarg)
-
/* Generate RTL to flush the register windows so as to make arbitrary frames
available. */
#define SETUP_FRAME_ADDRESSES() \
diff --git a/gcc/config/spu/spu-protos.h b/gcc/config/spu/spu-protos.h
index ab85d5debb3..e2c339bf1c5 100644
--- a/gcc/config/spu/spu-protos.h
+++ b/gcc/config/spu/spu-protos.h
@@ -61,7 +61,6 @@ extern int spu_initial_elimination_offset (int from, int to);
extern rtx spu_function_value (const_tree type, const_tree func);
extern rtx spu_function_arg (int cum, enum machine_mode mode, tree type,
int named);
-extern void spu_va_start (tree valist, rtx nextarg);
extern void spu_setup_incoming_varargs (int *cum, enum machine_mode mode,
tree type, int *pretend_size,
int no_rtl);
diff --git a/gcc/config/spu/spu.c b/gcc/config/spu/spu.c
index 79693b829d6..4592e667f08 100644
--- a/gcc/config/spu/spu.c
+++ b/gcc/config/spu/spu.c
@@ -117,6 +117,7 @@ static int spu_naked_function_p (tree func);
static unsigned char spu_pass_by_reference (CUMULATIVE_ARGS *cum, enum machine_mode mode,
const_tree type, unsigned char named);
static tree spu_build_builtin_va_list (void);
+static void spu_va_start (tree, rtx);
static tree spu_gimplify_va_arg_expr (tree valist, tree type, tree * pre_p,
tree * post_p);
static int regno_aligned_for_load (int regno);
@@ -247,6 +248,9 @@ const struct attribute_spec spu_attribute_table[];
#undef TARGET_BUILD_BUILTIN_VA_LIST
#define TARGET_BUILD_BUILTIN_VA_LIST spu_build_builtin_va_list
+#undef TARGET_EXPAND_BUILTIN_VA_START
+#define TARGET_EXPAND_BUILTIN_VA_START spu_va_start
+
#undef TARGET_SETUP_INCOMING_VARARGS
#define TARGET_SETUP_INCOMING_VARARGS spu_setup_incoming_varargs
@@ -3214,7 +3218,7 @@ spu_build_builtin_va_list (void)
holds the offset of the first anonymous stack argument
(relative to the virtual arg pointer). */
-void
+static void
spu_va_start (tree valist, rtx nextarg)
{
tree f_args, f_skip;
diff --git a/gcc/config/spu/spu.h b/gcc/config/spu/spu.h
index 74b06a77bfc..3d038cab46e 100644
--- a/gcc/config/spu/spu.h
+++ b/gcc/config/spu/spu.h
@@ -380,11 +380,6 @@ targetm.resolve_overloaded_builtin = spu_resolve_overloaded_builtin; \
#define PAD_VARARGS_DOWN 0
#define FUNCTION_ARG_REGNO_P(N) ((N) >= (FIRST_ARG_REGNUM) && (N) <= (LAST_ARG_REGNUM))
-
-/* Undocumented */
-#define EXPAND_BUILTIN_VA_START(valist, nextarg) \
- spu_va_start (valist, nextarg)
-
/* Scalar Return */
diff --git a/gcc/config/stormy16/stormy16-protos.h b/gcc/config/stormy16/stormy16-protos.h
index c3c1c7aeec5..1110720223e 100644
--- a/gcc/config/stormy16/stormy16-protos.h
+++ b/gcc/config/stormy16/stormy16-protos.h
@@ -42,7 +42,6 @@ extern rtx xstormy16_function_arg
#endif
#if defined (TREE_CODE) && defined (RTX_CODE)
-extern void xstormy16_expand_builtin_va_start (tree, rtx);
extern void xstormy16_initialize_trampoline (rtx, rtx, rtx);
extern rtx xstormy16_function_value (const_tree, const_tree);
#endif
diff --git a/gcc/config/stormy16/stormy16.c b/gcc/config/stormy16/stormy16.c
index b41440e6d4e..2f738e5a0bb 100644
--- a/gcc/config/stormy16/stormy16.c
+++ b/gcc/config/stormy16/stormy16.c
@@ -1352,7 +1352,7 @@ xstormy16_build_builtin_va_list (void)
is stdarg.h instead of varargs.h. VALIST is the tree of the va_list
variable to initialize. NEXTARG is the machine independent notion of the
'next' argument after the variable arguments. */
-void
+static void
xstormy16_expand_builtin_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED)
{
tree f_base, f_count;
@@ -2666,6 +2666,8 @@ xstormy16_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
#undef TARGET_BUILD_BUILTIN_VA_LIST
#define TARGET_BUILD_BUILTIN_VA_LIST xstormy16_build_builtin_va_list
+#undef TARGET_EXPAND_BUILTIN_VA_START
+#define TARGET_EXPAND_BUILTIN_VA_START xstormy16_expand_builtin_va_start
#undef TARGET_GIMPLIFY_VA_ARG_EXPR
#define TARGET_GIMPLIFY_VA_ARG_EXPR xstormy16_expand_builtin_va_arg
diff --git a/gcc/config/stormy16/stormy16.h b/gcc/config/stormy16/stormy16.h
index bd218a6ed04..a75a776192c 100644
--- a/gcc/config/stormy16/stormy16.h
+++ b/gcc/config/stormy16/stormy16.h
@@ -461,16 +461,6 @@ enum reg_class
contains a '%s' sequence, this will be replaced by the name of the function. */
/* #define TARGET_CANNOT_INLINE_P(FN_DECL) xstormy16_cannot_inline_p (FN_DECL) */
-/* Implementing the Varargs Macros. */
-
-/* Implement the stdarg/varargs va_start macro. STDARG_P is nonzero if this
- is stdarg.h instead of varargs.h. VALIST is the tree of the va_list
- variable to initialize. NEXTARG is the machine independent notion of the
- 'next' argument after the variable arguments. If not defined, a standard
- implementation will be defined that works for arguments passed on the stack. */
-#define EXPAND_BUILTIN_VA_START(VALIST, NEXTARG) \
- xstormy16_expand_builtin_va_start (VALIST, NEXTARG)
-
/* Trampolines for Nested Functions. */
#define TRAMPOLINE_SIZE 8
diff --git a/gcc/config/xtensa/xtensa-protos.h b/gcc/config/xtensa/xtensa-protos.h
index 2f35ca097d0..5ea777ca232 100644
--- a/gcc/config/xtensa/xtensa-protos.h
+++ b/gcc/config/xtensa/xtensa-protos.h
@@ -58,7 +58,6 @@ extern rtx xtensa_legitimize_address (rtx, rtx, enum machine_mode);
#ifdef TREE_CODE
extern void init_cumulative_args (CUMULATIVE_ARGS *, int);
-extern void xtensa_va_start (tree, rtx);
#endif /* TREE_CODE */
extern void print_operand (FILE *, rtx, int);
diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c
index 76df1d271cb..c9d9b908429 100644
--- a/gcc/config/xtensa/xtensa.c
+++ b/gcc/config/xtensa/xtensa.c
@@ -179,6 +179,9 @@ static const int reg_nonleaf_alloc_order[FIRST_PSEUDO_REGISTER] =
#undef TARGET_BUILD_BUILTIN_VA_LIST
#define TARGET_BUILD_BUILTIN_VA_LIST xtensa_build_builtin_va_list
+#undef TARGET_EXPAND_BUILTIN_VA_START
+#define TARGET_EXPAND_BUILTIN_VA_START xtensa_va_start
+
#undef TARGET_PROMOTE_FUNCTION_ARGS
#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_const_tree_true
#undef TARGET_PROMOTE_FUNCTION_RETURN
@@ -2478,7 +2481,7 @@ xtensa_builtin_saveregs (void)
/* Implement `va_start' for varargs and stdarg. We look at the
current function to fill in an initial va_list. */
-void
+static void
xtensa_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED)
{
tree f_stk, stk;
diff --git a/gcc/config/xtensa/xtensa.h b/gcc/config/xtensa/xtensa.h
index 7887345f9f5..e2b94e102b2 100644
--- a/gcc/config/xtensa/xtensa.h
+++ b/gcc/config/xtensa/xtensa.h
@@ -782,10 +782,6 @@ typedef struct xtensa_args
0, VOIDmode, 1, addr, Pmode); \
} while (0)
-/* Implement `va_start' for varargs and stdarg. */
-#define EXPAND_BUILTIN_VA_START(valist, nextarg) \
- xtensa_va_start (valist, nextarg)
-
/* If defined, a C expression that produces the machine-specific code
to setup the stack so that arbitrary frames can be accessed.