/* Generic routines for manipulating SSA_NAME expressions
- Copyright (C) 2003-2019 Free Software Foundation, Inc.
+ Copyright (C) 2003-2020 Free Software Foundation, Inc.
This file is part of GCC.
void
ssanames_print_statistics (void)
{
- fprintf (stderr, "SSA_NAME nodes allocated: " PRsa (11) "\n",
+ fprintf (stderr, "%-32s" PRsa (11) "\n", "SSA_NAME nodes allocated:",
SIZE_AMOUNT (ssa_name_nodes_created));
- fprintf (stderr, "SSA_NAME nodes reused: " PRsa (11) "\n",
+ fprintf (stderr, "%-32s" PRsa (11) "\n", "SSA_NAME nodes reused:",
SIZE_AMOUNT (ssa_name_nodes_reused));
}
vec_safe_truncate (FREE_SSANAMES_QUEUE (cfun), 0);
}
+/* Initialize SSA_NAME_IMM_USE_NODE of a SSA NAME. */
+
+void
+init_ssa_name_imm_use (tree name)
+{
+ use_operand_p imm;
+ imm = &(SSA_NAME_IMM_USE_NODE (name));
+ imm->use = NULL;
+ imm->prev = imm;
+ imm->next = imm;
+ imm->loc.ssa_name = name;
+}
+
/* Return an SSA_NAME node for variable VAR defined in statement STMT
in function FN. STMT may be an empty statement for artificial
references (e.g., default definitions created when a variable is
unsigned int version)
{
tree t;
- use_operand_p imm;
-
gcc_assert (VAR_P (var)
|| TREE_CODE (var) == PARM_DECL
|| TREE_CODE (var) == RESULT_DECL
SSA_NAME_IN_FREE_LIST (t) = 0;
SSA_NAME_IS_DEFAULT_DEF (t) = 0;
- imm = &(SSA_NAME_IMM_USE_NODE (t));
- imm->use = NULL;
- imm->prev = imm;
- imm->next = imm;
- imm->loc.ssa_name = t;
+ init_ssa_name_imm_use (t);
return t;
}
/* Store range information for NAME from a value_range. */
void
-set_range_info (tree name, const value_range_base &vr)
+set_range_info (tree name, const value_range &vr)
{
wide_int min = wi::to_wide (vr.min ());
wide_int max = wi::to_wide (vr.max ());
in a value_range VR. Returns the value_range_kind. */
enum value_range_kind
-get_range_info (const_tree name, value_range_base &vr)
+get_range_info (const_tree name, value_range &vr)
{
tree min, max;
wide_int wmin, wmax;
enum value_range_kind kind = get_range_info (name, &wmin, &wmax);
- if (kind == VR_VARYING || kind == VR_UNDEFINED)
- min = max = NULL;
+ if (kind == VR_VARYING)
+ vr.set_varying (TREE_TYPE (name));
+ else if (kind == VR_UNDEFINED)
+ vr.set_undefined ();
else
{
min = wide_int_to_tree (TREE_TYPE (name), wmin);
max = wide_int_to_tree (TREE_TYPE (name), wmax);
+ vr.set (min, max, kind);
}
- vr.set (kind, min, max);
return kind;
}
defining statement. */
if (! SSA_NAME_IN_FREE_LIST (var))
{
- tree saved_ssa_name_var = SSA_NAME_VAR (var);
int saved_ssa_name_version = SSA_NAME_VERSION (var);
use_operand_p imm = &(SSA_NAME_IMM_USE_NODE (var));
/* Restore the version number. */
SSA_NAME_VERSION (var) = saved_ssa_name_version;
- /* Hopefully this can go away once we have the new incremental
- SSA updating code installed. */
- SET_SSA_NAME_VAR_OR_IDENTIFIER (var, saved_ssa_name_var);
-
/* Note this SSA_NAME is now in the first list. */
SSA_NAME_IN_FREE_LIST (var) = 1;
+ /* Put in a non-NULL TREE_TYPE so dumping code will not ICE
+ if it happens to come along a released SSA name and tries
+ to inspect its type. */
+ TREE_TYPE (var) = error_mark_node;
+
/* And finally queue it so that it will be put on the free list. */
vec_safe_push (FREE_SSANAMES_QUEUE (fn), var);
}
{
/* points-to info is not flow-sensitive. */
if (SSA_NAME_PTR_INFO (name))
- mark_ptr_info_alignment_unknown (SSA_NAME_PTR_INFO (name));
+ {
+ /* [E]VRP can derive context sensitive alignment info and
+ non-nullness properties. We must reset both. */
+ mark_ptr_info_alignment_unknown (SSA_NAME_PTR_INFO (name));
+ SSA_NAME_PTR_INFO (name)->pt.null = 1;
+ }
}
else
SSA_NAME_RANGE_INFO (name) = NULL;