summaryrefslogtreecommitdiff
path: root/gcc/tree-stdarg.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-stdarg.c')
-rw-r--r--gcc/tree-stdarg.c37
1 files changed, 12 insertions, 25 deletions
diff --git a/gcc/tree-stdarg.c b/gcc/tree-stdarg.c
index 13b92f05e0..923b315e79 100644
--- a/gcc/tree-stdarg.c
+++ b/gcc/tree-stdarg.c
@@ -1,5 +1,5 @@
/* Pass computing data for optimizing stdarg functions.
- Copyright (C) 2004-2016 Free Software Foundation, Inc.
+ Copyright (C) 2004-2017 Free Software Foundation, Inc.
Contributed by Jakub Jelinek <jakub@redhat.com>
This file is part of GCC.
@@ -53,10 +53,9 @@ along with GCC; see the file COPYING3. If not see
static bool
reachable_at_most_once (basic_block va_arg_bb, basic_block va_start_bb)
{
- vec<edge> stack = vNULL;
+ auto_vec<edge, 10> stack;
edge e;
edge_iterator ei;
- sbitmap visited;
bool ret;
if (va_arg_bb == va_start_bb)
@@ -65,7 +64,7 @@ reachable_at_most_once (basic_block va_arg_bb, basic_block va_start_bb)
if (! dominated_by_p (CDI_DOMINATORS, va_arg_bb, va_start_bb))
return false;
- visited = sbitmap_alloc (last_basic_block_for_fn (cfun));
+ auto_sbitmap visited (last_basic_block_for_fn (cfun));
bitmap_clear (visited);
ret = true;
@@ -105,8 +104,6 @@ reachable_at_most_once (basic_block va_arg_bb, basic_block va_start_bb)
}
}
- stack.release ();
- sbitmap_free (visited);
return ret;
}
@@ -276,7 +273,7 @@ find_va_list_reference (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
if (bitmap_bit_p (va_list_vars, SSA_NAME_VERSION (var)))
return var;
}
- else if (TREE_CODE (var) == VAR_DECL)
+ else if (VAR_P (var))
{
if (bitmap_bit_p (va_list_vars, DECL_UID (var) + num_ssa_names))
return var;
@@ -361,7 +358,7 @@ va_list_counter_struct_op (struct stdarg_info *si, tree ap, tree var,
return false;
base = get_base_address (ap);
- if (TREE_CODE (base) != VAR_DECL
+ if (!VAR_P (base)
|| !bitmap_bit_p (si->va_list_vars, DECL_UID (base) + num_ssa_names))
return false;
@@ -380,7 +377,7 @@ va_list_counter_struct_op (struct stdarg_info *si, tree ap, tree var,
static bool
va_list_ptr_read (struct stdarg_info *si, tree ap, tree tem)
{
- if (TREE_CODE (ap) != VAR_DECL
+ if (!VAR_P (ap)
|| !bitmap_bit_p (si->va_list_vars, DECL_UID (ap) + num_ssa_names))
return false;
@@ -430,7 +427,7 @@ va_list_ptr_write (struct stdarg_info *si, tree ap, tree tem2)
{
unsigned HOST_WIDE_INT increment;
- if (TREE_CODE (ap) != VAR_DECL
+ if (!VAR_P (ap)
|| !bitmap_bit_p (si->va_list_vars, DECL_UID (ap) + num_ssa_names))
return false;
@@ -625,7 +622,7 @@ check_all_va_list_escapes (struct stdarg_info *si)
SSA_NAME_VERSION (lhs)))
continue;
- if (TREE_CODE (lhs) == VAR_DECL
+ if (VAR_P (lhs)
&& bitmap_bit_p (si->va_list_vars,
DECL_UID (lhs) + num_ssa_names))
continue;
@@ -734,7 +731,7 @@ optimize_va_list_gpr_fpr_size (function *fun)
}
if (TYPE_MAIN_VARIANT (TREE_TYPE (ap))
!= TYPE_MAIN_VARIANT (targetm.fn_abi_va_list (fun->decl))
- || TREE_CODE (ap) != VAR_DECL)
+ || !VAR_P (ap))
{
va_list_escapes = true;
break;
@@ -994,16 +991,6 @@ finish:
}
}
-/* Return true if STMT is IFN_VA_ARG. */
-
-static bool
-gimple_call_ifn_va_arg_p (gimple *stmt)
-{
- return (is_gimple_call (stmt)
- && gimple_call_internal_p (stmt)
- && gimple_call_internal_fn (stmt) == IFN_VA_ARG);
-}
-
/* Expand IFN_VA_ARGs in FUN. */
static void
@@ -1021,7 +1008,7 @@ expand_ifn_va_arg_1 (function *fun)
tree ap, aptype, expr, lhs, type;
gimple_seq pre = NULL, post = NULL;
- if (!gimple_call_ifn_va_arg_p (stmt))
+ if (!gimple_call_internal_p (stmt, IFN_VA_ARG))
continue;
modified = true;
@@ -1071,7 +1058,7 @@ expand_ifn_va_arg_1 (function *fun)
gimplify_assign (lhs, expr, &pre);
}
else
- gimplify_expr (&expr, &pre, &post, is_gimple_lvalue, fb_lvalue);
+ gimplify_and_add (expr, &pre);
input_location = saved_location;
pop_gimplify_context (NULL);
@@ -1119,7 +1106,7 @@ expand_ifn_va_arg (function *fun)
gimple_stmt_iterator i;
FOR_EACH_BB_FN (bb, fun)
for (i = gsi_start_bb (bb); !gsi_end_p (i); gsi_next (&i))
- gcc_assert (!gimple_call_ifn_va_arg_p (gsi_stmt (i)));
+ gcc_assert (!gimple_call_internal_p (gsi_stmt (i), IFN_VA_ARG));
}
}