summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-ccp.c
diff options
context:
space:
mode:
authorktietz <ktietz@138bc75d-0d04-0410-961f-82ee72b054a4>2008-07-04 08:15:27 +0000
committerktietz <ktietz@138bc75d-0d04-0410-961f-82ee72b054a4>2008-07-04 08:15:27 +0000
commit92667ff7f2525ea5d9422fb2e7a472bbf0386020 (patch)
treed1af1f94095ce5db28182a39c821328c23262a9b /gcc/tree-ssa-ccp.c
parent4133acc5c5820d4ef9727c7ba0e74b91432f8fca (diff)
downloadgcc-92667ff7f2525ea5d9422fb2e7a472bbf0386020.tar.gz
2008-07-04 Kai Tietz <kai.tietz@onevision.com>
* config.gcc (extra_headers): Add cross-stdarg.h for target x86_64-*-* and i?86-*-*. * config/i386/cross-stdarg.h: New. * builtins.c (std_fn_abi_va_list): New. (std_canonical_va_list_type): New. (stabilize_va_list): Replace va_list_type_node use by mtarget.canonical_va_list_type. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_copy): Replace va_list_type_node use by mtarget.fn_abi_va_list. * tree-sra.c (is_va_list_type): New helper. (decl_can_be_decomposed_p): Replace va_list_type_node use by is_va_list_type. * tree-ssa-ccp.c (optimize_stdarg_builtin): Likewise. * tree-stdarg.c (execute_optimize_stdarg): Likewise. * c-common.c (c_common_nodes_and_builtins): Use TARGET_ENUM_VA_LIST. * config/i386/i386-protos.h (ix86_get_valist_type): New. (ix86_enum_va_list): New. * config/i386/i386.c (sysv_va_list_type_node): New. (ms_va_list_type_node): New. (ix86_function_type_abi): Remove sorry. (ix86_build_builtin_va_list_abi): New. (ix86_build_builtin_va_list): Call ix86_build_builtin_va_list_abi for 64-bit targets. (ix86_va_start): Replace va_list_type_node by sysv_va_list_type_node. (ix86_init_builtins_va_builtins_abi): New. (ix86_init_builtins): Use ix86_init_builtins_va_builtins_abi for 64-bit targets. (ix86_handle_abi_attribute): New. (attribute_spec): Add sysv_abi and ms_abi. (ix86_fn_abi_va_list): New. (ix86_canonical_va_list_type): New. (ix86_enum_va_list): New. (TARGET_FN_ABI_VA_LIST): New. (TARGET_CANONICAL_VA_LIST_TYPE): New. * config/i386/i386.h (TARGET_ENUM_VA_LIST): New. * doc/tm.texi (TARGET_FN_ABI_VA_LIST): New. (TARGET_CANONICAL_VA_LIST_TYPE): New. (TARGET_ENUM_VA_LIST): New. * expr.h (std_fn_abi_va_list): New. (std_canonical_va_list_type): New. * target-def.h (TARGET_FN_ABI_VA_LIST): New. (TARGET_CANONICAL_VA_LIST_TYPE): New. (TARGET_INITIALIZER): Add TARGET_FN_ABI_VA_LIST and TARGET_CANONICAL_VA_LIST_TYPE. * target.h (struct gcc_target): Add fn_abi_va_list hook and canonical_va_list_type hook. 2008-07-04 Kai Tietz <kai.tietz@onevision.com> * gcc.dg/callabi/callabi.h: New. * gcc.dg/callabi/vaarg-1.c: New. * gcc.dg/callabi/vaarg-2.c: New. * gcc.dg/callabi/vaarg-3.c: New. * gcc.dg/callabi/func-1.c: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@137452 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-ccp.c')
-rw-r--r--gcc/tree-ssa-ccp.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index d4dfadbced0..da6b7855a81 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -2748,17 +2748,19 @@ optimize_stack_restore (basic_block bb, tree call, block_stmt_iterator i)
static tree
optimize_stdarg_builtin (tree call)
{
- tree callee, lhs, rhs;
+ tree callee, lhs, rhs, cfun_va_list;
bool va_list_simple_ptr;
if (TREE_CODE (call) != CALL_EXPR)
return NULL_TREE;
- va_list_simple_ptr = POINTER_TYPE_P (va_list_type_node)
- && (TREE_TYPE (va_list_type_node) == void_type_node
- || TREE_TYPE (va_list_type_node) == char_type_node);
-
callee = get_callee_fndecl (call);
+
+ cfun_va_list = targetm.fn_abi_va_list (callee);
+ va_list_simple_ptr = POINTER_TYPE_P (cfun_va_list)
+ && (TREE_TYPE (cfun_va_list) == void_type_node
+ || TREE_TYPE (cfun_va_list) == char_type_node);
+
switch (DECL_FUNCTION_CODE (callee))
{
case BUILT_IN_VA_START:
@@ -2773,7 +2775,7 @@ optimize_stdarg_builtin (tree call)
lhs = CALL_EXPR_ARG (call, 0);
if (!POINTER_TYPE_P (TREE_TYPE (lhs))
|| TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (lhs)))
- != TYPE_MAIN_VARIANT (va_list_type_node))
+ != TYPE_MAIN_VARIANT (cfun_va_list))
return NULL_TREE;
lhs = build_fold_indirect_ref (lhs);
@@ -2792,13 +2794,13 @@ optimize_stdarg_builtin (tree call)
lhs = CALL_EXPR_ARG (call, 0);
if (!POINTER_TYPE_P (TREE_TYPE (lhs))
|| TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (lhs)))
- != TYPE_MAIN_VARIANT (va_list_type_node))
+ != TYPE_MAIN_VARIANT (cfun_va_list))
return NULL_TREE;
lhs = build_fold_indirect_ref (lhs);
rhs = CALL_EXPR_ARG (call, 1);
if (TYPE_MAIN_VARIANT (TREE_TYPE (rhs))
- != TYPE_MAIN_VARIANT (va_list_type_node))
+ != TYPE_MAIN_VARIANT (cfun_va_list))
return NULL_TREE;
rhs = fold_convert (TREE_TYPE (lhs), rhs);