summaryrefslogtreecommitdiff
path: root/gcc/config/alpha
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2007-12-06 13:25:37 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2007-12-06 13:25:37 +0000
commit8a58ed0af38bbe49d77d45122f8fc503d14ea055 (patch)
treecef18ea9cceaa7495e72439b79c224d9d6d77889 /gcc/config/alpha
parent326f0dc4ce53c5bbf7bbbb2b946629a58530096c (diff)
downloadgcc-8a58ed0af38bbe49d77d45122f8fc503d14ea055.tar.gz
PR middle-end/20983
* tree-ssa-ccp.c (optimize_stdarg_builtin): New function. (execute_fold_all_builtins): Call it for BUILT_IN_VA_START, BUILT_IN_VA_COPY and BUILT_IN_VA_END. * target.h (struct ggc_target): Add expand_builtin_va_start hook. * target-def.h (TARGET_EXPAND_BUILTIN_VA_START): Define. (TARGET_INITIALIZER): Add it. * builtins.c (expand_builtin_va_start): Use targetm.expand_builtin_va_start hook instead of EXPAND_BUILTIN_VA_START macro. * alpha/alpha.c (alpha_va_start): Made static. (override_options): Clear targetm.expand_builtin_va_start if TARGET_UNICOSMK. (TARGET_EXPAND_BUILTIN_VA_START): Define. * alpha/unicosmk.h (EXPAND_BUILTIN_VA_START): Remove. * alpha/alpha.h (EXPAND_BUILTIN_VA_START): Remove. * alpha/alpha-protos.h (alpha_va_start): Remove prototype. * xtensa/xtensa.h (EXPAND_BUILTIN_VA_START): Remove. * xtensa/xtensa.c (TARGET_EXPAND_BUILTIN_VA_START): Define. (xtensa_va_start): Made static. * xtensa/xtensa-protos.h (xtensa_va_start): Remove prototype. * pa/pa-protos.h (hppa_va_start): Remove prototype. * pa/pa.h (EXPAND_BUILTIN_VA_START): Remove. * pa/pa.c (hppa_va_start): Made static, add prototype. (TARGET_EXPAND_BUILTIN_VA_START): Define. * frv/frv.c (frv_expand_builtin_va_start): Made static, add prototype. (TARGET_EXPAND_BUILTIN_VA_START): Define. * frv/frv-protos.h (frv_expand_builtin_va_start): Remove prototype. * frv/frv.h (EXPAND_BUILTIN_VA_START): Remove. * i386/i386.c (override_options): Clear targetm.expand_builtin_va_start if -m32 or 64-bit MS ABI. (ix86_va_start): Made static. (TARGET_EXPAND_BUILTIN_VA_START): Define. * i386/i386.h (EXPAND_BUILTIN_VA_START): Remove. * i386/i386-protos.h (ix86_va_start, ix86_va_arg): Remove prototypes. * iq2000/iq2000-protos.h (iq2000_va_start): Remove prototype. * iq2000/iq2000.h (EXPAND_BUILTIN_VA_START): Remove. * iq2000/iq2000.c (iq2000_va_start): Made static, add prototype. (TARGET_EXPAND_BUILTIN_VA_START): Define. * rs6000/rs6000-protos.h (rs6000_va_start): Remove prototype. * rs6000/rs6000.c (rs6000_va_start): Made static, add prototype. (TARGET_EXPAND_BUILTIN_VA_START): Define. (rs6000_override_options): Clear targetm.expand_builtin_va_start if DEFAULT_ABI != ABI_V4. * rs6000/rs6000.h (EXPAND_BUILTIN_VA_START): Remove. * spu/spu.c (spu_va_start): Made static, add prototype. (TARGET_EXPAND_BUILTIN_VA_START): Define. * spu/spu.h (EXPAND_BUILTIN_VA_START): Remove. * spu/spu-protos.h spu_va_start): Remove prototype. * stormy16/stormy16.h (EXPAND_BUILTIN_VA_START): Remove. * stormy16/stormy16-protos.h (xstormy16_expand_builtin_va_start): Remove prototype. * stormy16/stormy16.c (xstormy16_expand_builtin_va_start): Made static. (TARGET_EXPAND_BUILTIN_VA_START): Define. * s390/s390-protos.h (s390_va_start): Remove prototype. * s390/s390.c (s390_va_start): Made static. (TARGET_EXPAND_BUILTIN_VA_START): Define. * s390/s390.h (EXPAND_BUILTIN_VA_START): Remove. * mn10300/mn10300.h (EXPAND_BUILTIN_VA_START): Remove. * mn10300/mn10300-protos.h (mn10300_va_start): Remove prototype. * mn10300/mn10300.c (mn10300_va_start): Made static, add prototype. (TARGET_EXPAND_BUILTIN_VA_START): Define. * arc/arc.c (arc_va_start): Made static, add prototype. (TARGET_EXPAND_BUILTIN_VA_START): Define. * arc/arc.h (EXPAND_BUILTIN_VA_START): Remove. * arc/arc-protos.h (arc_va_start): Remove prototype. * mt/mt-protos.h (mt_va_start): Remove prototype. * sparc/sparc.c (sparc_va_start): Made static, add prototype. (TARGET_EXPAND_BUILTIN_VA_START): Define. * sparc/sparc-protos.h (sparc_va_start): Remove prototype. * sparc/sparc.h (EXPAND_BUILTIN_VA_START): Remove. * sh/sh.c (sh_va_start): Made static, add prototype. (TARGET_EXPAND_BUILTIN_VA_START): Define. * sh/sh-protos.h (sh_va_start): Remove prototype. * sh/sh.h (EXPAND_BUILTIN_VA_START): Remove. * mips/mips-protos.h (mips_va_start): Remove prototype. * mips/mips.h (EXPAND_BUILTIN_VA_START): Remove. * mips/mips.c (mips_va_start): Made static. (TARGET_EXPAND_BUILTIN_VA_START): Define. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130650 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/alpha')
-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
4 files changed, 9 insertions, 8 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