+2012-08-09 Richard Guenther <rguenther@suse.de>
+
+ * tree.h (SSA_VAR_P): Simplify.
+ * tree-ssanames.c (make_ssa_name_fn): Strengthen assert.
+ * fold-const.c (fold_comparison): Check for default def first
+ before checking for PARM_DECL.
+ * tree-complex.c (get_component_ssa_name): Likewise.
+ * tree-inline.c (remap_ssa_name): Likewise.
+ * tree-ssa-loop-ivopts.c (parm_decl_cost): Likewise.
+ * tree-ssa-structalias.c (get_fi_for_callee): Likewise.
+ (find_what_p_points_to): Likewise.
+ * tree-ssa-operands.c (add_stmt_operand): Simplify.
+
2012-08-08 Joseph Myers <joseph@codesourcery.com>
* simplify-rtx.c (simplify_binary_operation_1): Do not simplify
&& auto_var_in_fn_p (base0, current_function_decl)
&& !indirect_base1
&& TREE_CODE (base1) == SSA_NAME
- && TREE_CODE (SSA_NAME_VAR (base1)) == PARM_DECL
- && SSA_NAME_IS_DEFAULT_DEF (base1))
+ && SSA_NAME_IS_DEFAULT_DEF (base1)
+ && TREE_CODE (SSA_NAME_VAR (base1)) == PARM_DECL)
|| (TREE_CODE (arg1) == ADDR_EXPR
&& indirect_base1
&& TREE_CODE (base1) == VAR_DECL
&& auto_var_in_fn_p (base1, current_function_decl)
&& !indirect_base0
&& TREE_CODE (base0) == SSA_NAME
- && TREE_CODE (SSA_NAME_VAR (base0)) == PARM_DECL
- && SSA_NAME_IS_DEFAULT_DEF (base0)))
+ && SSA_NAME_IS_DEFAULT_DEF (base0)
+ && TREE_CODE (SSA_NAME_VAR (base0)) == PARM_DECL))
{
if (code == NE_EXPR)
return constant_boolean_node (1, type);
is used in an abnormal phi, and whether it's uninitialized. */
SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ret)
= SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ssa_name);
- if (TREE_CODE (SSA_NAME_VAR (ssa_name)) == VAR_DECL
- && SSA_NAME_IS_DEFAULT_DEF (ssa_name))
+ if (SSA_NAME_IS_DEFAULT_DEF (ssa_name)
+ && TREE_CODE (SSA_NAME_VAR (ssa_name)) == VAR_DECL)
{
SSA_NAME_DEF_STMT (ret) = SSA_NAME_DEF_STMT (ssa_name);
set_ssa_default_def (cfun, SSA_NAME_VAR (ret), ret);
if (processing_debug_stmt)
{
- if (TREE_CODE (SSA_NAME_VAR (name)) == PARM_DECL
- && SSA_NAME_IS_DEFAULT_DEF (name)
+ if (SSA_NAME_IS_DEFAULT_DEF (name)
+ && TREE_CODE (SSA_NAME_VAR (name)) == PARM_DECL
&& id->entry_bb == NULL
&& single_succ_p (ENTRY_BLOCK_PTR))
{
STRIP_NOPS (sbound);
if (TREE_CODE (sbound) == SSA_NAME
+ && SSA_NAME_IS_DEFAULT_DEF (sbound)
&& TREE_CODE (SSA_NAME_VAR (sbound)) == PARM_DECL
- && gimple_nop_p (SSA_NAME_DEF_STMT (sbound))
&& data->body_includes_call)
return COSTS_N_INSNS (1);
static void
add_stmt_operand (tree *var_p, gimple stmt, int flags)
{
- tree var, sym;
+ tree var = *var_p;
gcc_assert (SSA_VAR_P (*var_p));
- var = *var_p;
- sym = (TREE_CODE (var) == SSA_NAME ? SSA_NAME_VAR (var) : var);
-
- /* Mark statements with volatile operands. */
- if (!(flags & opf_no_vops)
- && TREE_THIS_VOLATILE (sym))
- gimple_set_has_volatile_ops (stmt, true);
-
- if (is_gimple_reg (sym))
+ if (is_gimple_reg (var))
{
/* The variable is a GIMPLE register. Add it to real operands. */
if (flags & opf_def)
append_use (var_p);
}
else
- add_virtual_operand (stmt, flags);
+ {
+ /* Mark statements with volatile operands. */
+ if (!(flags & opf_no_vops)
+ && TREE_THIS_VOLATILE (var))
+ gimple_set_has_volatile_ops (stmt, true);
+
+ /* The variable is a memory access. Add virtual operands. */
+ add_virtual_operand (stmt, flags);
+ }
}
/* Mark the base address of REF as having its address taken.
if (!fn || TREE_CODE (fn) != SSA_NAME)
return get_varinfo (anything_id);
- if ((TREE_CODE (SSA_NAME_VAR (fn)) == PARM_DECL
- || TREE_CODE (SSA_NAME_VAR (fn)) == RESULT_DECL)
- && SSA_NAME_IS_DEFAULT_DEF (fn))
+ if (SSA_NAME_IS_DEFAULT_DEF (fn)
+ && (TREE_CODE (SSA_NAME_VAR (fn)) == PARM_DECL
+ || TREE_CODE (SSA_NAME_VAR (fn)) == RESULT_DECL))
fn = SSA_NAME_VAR (fn);
return get_vi_for_tree (fn);
/* For parameters, get at the points-to set for the actual parm
decl. */
if (TREE_CODE (p) == SSA_NAME
+ && SSA_NAME_IS_DEFAULT_DEF (p)
&& (TREE_CODE (SSA_NAME_VAR (p)) == PARM_DECL
- || TREE_CODE (SSA_NAME_VAR (p)) == RESULT_DECL)
- && SSA_NAME_IS_DEFAULT_DEF (p))
+ || TREE_CODE (SSA_NAME_VAR (p)) == RESULT_DECL))
lookup_p = SSA_NAME_VAR (p);
vi = lookup_vi_for_tree (lookup_p);
tree t;
use_operand_p imm;
- gcc_assert (DECL_P (var));
+ gcc_assert (TREE_CODE (var) == VAR_DECL
+ || TREE_CODE (var) == PARM_DECL
+ || TREE_CODE (var) == RESULT_DECL);
/* If our free list has an element, then use it. */
if (!VEC_empty (tree, FREE_SSANAMES (fn)))
\f
/* Define fields and accessors for nodes representing declared names. */
-/* Nonzero if DECL represents a variable for the SSA passes. */
+/* Nonzero if DECL represents an SSA name or a variable that can possibly
+ have an associated SSA name. */
#define SSA_VAR_P(DECL) \
(TREE_CODE (DECL) == VAR_DECL \
|| TREE_CODE (DECL) == PARM_DECL \
|| TREE_CODE (DECL) == RESULT_DECL \
- || (TREE_CODE (DECL) == SSA_NAME \
- && (TREE_CODE (SSA_NAME_VAR (DECL)) == VAR_DECL \
- || TREE_CODE (SSA_NAME_VAR (DECL)) == PARM_DECL \
- || TREE_CODE (SSA_NAME_VAR (DECL)) == RESULT_DECL)))
-
+ || TREE_CODE (DECL) == SSA_NAME)