+2018-08-31 David Malcolm <dmalcolm@redhat.com>
+
+ * tree-vrp.c (copy_value_range): Convert param "from" from
+ "value_range *" to "const value_range *".
+ (range_is_null): Likewise for param "vr".
+ (range_int_cst_p): Likewise.
+ (range_int_cst_singleton_p): Likewise.
+ (symbolic_range_p): Likewise.
+ (value_ranges_intersect_p): Likewise for both params.
+ (value_range_nonnegative_p): Likewise for param "vr".
+ (value_range_constant_singleton): Likewise.
+ (vrp_set_zero_nonzero_bits): Likewise for param "ar".
+ (extract_range_into_wide_ints): Likewise for param "vr".
+ (extract_range_from_multiplicative_op): Likewise for params "vr0"
+ and "vr1".
+ (vrp_can_optimize_bit_op): Likewise.
+ (extract_range_from_binary_expr_1): Likewise for params "vr0_" and
+ "vr1_".
+ (extract_range_from_unary_expr): Likewise.
+ (debug_value_range): Likewise for param "vr".
+ (value_range::dump): Add "const" qualifier.
+ (vrp_prop::check_array_ref): Convert local "vr" from
+ "value_range *" to "const value_range *".
+ (vrp_prop::check_mem_ref): Likewise.
+ (vrp_prop::visit_stmt): Likewise for local "old_vr".
+ (vrp_intersect_ranges_1): Likewise for param "vr_1".
+ (vrp_intersect_ranges): Likewise.
+ (simplify_stmt_for_jump_threading): Likewise for local "vr".
+ (vrp_prop::vrp_finalize): Likewise.
+ * tree-vrp.h (value_range::dump): Add "const" qualifier.
+ (vrp_intersect_ranges): Add "const" qualifier to params as above.
+ (extract_range_from_unary_expr): Likewise.
+ (value_range_constant_singleton): Likewise.
+ (symbolic_range_p): Likewise.
+ (copy_value_range): Likewise.
+ (extract_range_from_binary_expr_1): Likewise.
+ (range_int_cst_p): Likewise.
+ (vrp_set_zero_nonzero_bits): Likewise.
+ (range_int_cst_singleton_p): Likewise.
+
2018-08-31 Vlad Lazar <vlad.lazar@arm.com>
* config/aarch64/arm_neon.h (vabsd_s64): New.
/* Copy value range FROM into value range TO. */
void
-copy_value_range (value_range *to, value_range *from)
+copy_value_range (value_range *to, const value_range *from)
{
set_value_range (to, from->type, from->min, from->max, from->equiv);
}
/* Return true if VR is [0, 0]. */
static inline bool
-range_is_null (value_range *vr)
+range_is_null (const value_range *vr)
{
return vr->type == VR_RANGE
&& integer_zerop (vr->min)
a singleton. */
bool
-range_int_cst_p (value_range *vr)
+range_int_cst_p (const value_range *vr)
{
return (vr->type == VR_RANGE
&& TREE_CODE (vr->max) == INTEGER_CST
/* Return true if VR is a INTEGER_CST singleton. */
bool
-range_int_cst_singleton_p (value_range *vr)
+range_int_cst_singleton_p (const value_range *vr)
{
return (range_int_cst_p (vr)
&& tree_int_cst_equal (vr->min, vr->max));
/* Return true if value range VR involves at least one symbol. */
bool
-symbolic_range_p (value_range *vr)
+symbolic_range_p (const value_range *vr)
{
return (!is_gimple_min_invariant (vr->min)
|| !is_gimple_min_invariant (vr->max));
*/
static inline bool
-value_ranges_intersect_p (value_range *vr0, value_range *vr1)
+value_ranges_intersect_p (const value_range *vr0, const value_range *vr1)
{
/* The value ranges do not intersect if the maximum of the first range is
less than the minimum of the second range or vice versa.
/* Return true if *VR is know to only contain nonnegative values. */
static inline bool
-value_range_nonnegative_p (value_range *vr)
+value_range_nonnegative_p (const value_range *vr)
{
/* Testing for VR_ANTI_RANGE is not useful here as any anti-range
which would return a useful value should be encoded as a
otherwise return NULL_TREE. */
tree
-value_range_constant_singleton (value_range *vr)
+value_range_constant_singleton (const value_range *vr)
{
if (vr->type == VR_RANGE
&& vrp_operand_equal_p (vr->min, vr->max)
bool
vrp_set_zero_nonzero_bits (const tree expr_type,
- value_range *vr,
+ const value_range *vr,
wide_int *may_be_nonzero,
wide_int *must_be_nonzero)
{
*VR1 will be VR_UNDEFINED. */
static bool
-ranges_from_anti_range (value_range *ar,
+ranges_from_anti_range (const value_range *ar,
value_range *vr0, value_range *vr1)
{
tree type = TREE_TYPE (ar->min);
resulting wide ints are set to [-MIN, +MAX] for the type. */
static void inline
-extract_range_into_wide_ints (value_range *vr,
+extract_range_into_wide_ints (const value_range *vr,
signop sign, unsigned prec,
wide_int &wmin, wide_int &wmax)
{
static void
extract_range_from_multiplicative_op (value_range *vr,
enum tree_code code,
- value_range *vr0, value_range *vr1)
+ const value_range *vr0,
+ const value_range *vr1)
{
gcc_assert (code == MULT_EXPR
|| code == TRUNC_DIV_EXPR
static bool
vrp_can_optimize_bit_op (value_range *vr, enum tree_code code,
- value_range *vr0, value_range *vr1)
+ const value_range *vr0, const value_range *vr1)
{
tree lower_bound, upper_bound, mask;
if (code != BIT_AND_EXPR && code != BIT_IOR_EXPR)
void
extract_range_from_binary_expr_1 (value_range *vr,
enum tree_code code, tree expr_type,
- value_range *vr0_, value_range *vr1_)
+ const value_range *vr0_,
+ const value_range *vr1_)
{
signop sign = TYPE_SIGN (expr_type);
unsigned int prec = TYPE_PRECISION (expr_type);
void
extract_range_from_unary_expr (value_range *vr,
enum tree_code code, tree type,
- value_range *vr0_, tree op0_type)
+ const value_range *vr0_, tree op0_type)
{
signop sign = TYPE_SIGN (type);
unsigned int prec = TYPE_PRECISION (type);
/* Debugging dumps. */
void dump_value_range (FILE *, const value_range *);
-void debug_value_range (value_range *);
+void debug_value_range (const value_range *);
void dump_all_value_ranges (FILE *);
void dump_vr_equiv (FILE *, bitmap);
void debug_vr_equiv (bitmap);
/* Dump value range VR to stderr. */
DEBUG_FUNCTION void
-debug_value_range (value_range *vr)
+debug_value_range (const value_range *vr)
{
dump_value_range (stderr, vr);
fprintf (stderr, "\n");
}
void
-value_range::dump ()
+value_range::dump () const
{
debug_value_range (this);
}
vrp_prop::check_array_ref (location_t location, tree ref,
bool ignore_off_by_one)
{
- value_range *vr = NULL;
+ const value_range *vr = NULL;
tree low_sub, up_sub;
tree low_bound, up_bound, up_bound_p1;
/* The range of the byte offset into the reference. */
offset_int offrange[2] = { 0, 0 };
- value_range *vr = NULL;
+ const value_range *vr = NULL;
/* Determine the offsets and increment OFFRANGE for the bounds of each.
The loop computes the the range of the final offset for expressions
return SSA_PROP_VARYING. */
value_range new_vr = VR_INITIALIZER;
extract_range_basic (&new_vr, use_stmt);
- value_range *old_vr = get_value_range (use_lhs);
+ const value_range *old_vr = get_value_range (use_lhs);
if (old_vr->type != new_vr.type
|| !vrp_operand_equal_p (old_vr->min, new_vr.min)
|| !vrp_operand_equal_p (old_vr->max, new_vr.max)
in *VR0. This may not be the smallest possible such range. */
static void
-vrp_intersect_ranges_1 (value_range *vr0, value_range *vr1)
+vrp_intersect_ranges_1 (value_range *vr0, const value_range *vr1)
{
value_range saved;
}
void
-vrp_intersect_ranges (value_range *vr0, value_range *vr1)
+vrp_intersect_ranges (value_range *vr0, const value_range *vr1)
{
if (dump_file && (dump_flags & TDF_DETAILS))
{
op = lhs_of_dominating_assert (op, bb, stmt);
- value_range *vr = vr_values->get_value_range (op);
+ const value_range *vr = vr_values->get_value_range (op);
if ((vr->type != VR_RANGE && vr->type != VR_ANTI_RANGE)
|| symbolic_range_p (vr))
return NULL_TREE;
if (!name)
continue;
- value_range *vr = get_value_range (name);
+ const value_range *vr = get_value_range (name);
if (!name
|| (vr->type == VR_VARYING)
|| (vr->type == VR_UNDEFINED)
bitmap equiv;
/* Dump value range to stderr. */
- void dump ();
+ void dump () const;
};
-extern void vrp_intersect_ranges (value_range *vr0, value_range *vr1);
+extern void vrp_intersect_ranges (value_range *vr0, const value_range *vr1);
extern void vrp_meet (value_range *vr0, const value_range *vr1);
extern void dump_value_range (FILE *, const value_range *);
extern void extract_range_from_unary_expr (value_range *vr,
enum tree_code code,
tree type,
- value_range *vr0_,
+ const value_range *vr0_,
tree op0_type);
extern bool vrp_operand_equal_p (const_tree, const_tree);
enum value_range_type,
tree, tree, bitmap);
extern bool vrp_bitmap_equal_p (const_bitmap, const_bitmap);
-extern tree value_range_constant_singleton (value_range *);
-extern bool symbolic_range_p (value_range *);
+extern tree value_range_constant_singleton (const value_range *);
+extern bool symbolic_range_p (const value_range *);
extern int compare_values (tree, tree);
extern int compare_values_warnv (tree, tree, bool *);
extern bool vrp_val_is_min (const_tree);
extern bool vrp_val_is_max (const_tree);
-extern void copy_value_range (value_range *, value_range *);
+extern void copy_value_range (value_range *, const value_range *);
extern void set_value_range_to_value (value_range *, tree, bitmap);
extern void extract_range_from_binary_expr_1 (value_range *, enum tree_code,
- tree, value_range *,
- value_range *);
+ tree, const value_range *,
+ const value_range *);
extern tree vrp_val_min (const_tree);
extern tree vrp_val_max (const_tree);
extern void set_value_range_to_null (value_range *, tree);
-extern bool range_int_cst_p (value_range *);
+extern bool range_int_cst_p (const value_range *);
extern int operand_less_p (tree, tree);
extern bool find_case_label_range (gswitch *, tree, tree, size_t *, size_t *);
extern bool find_case_label_index (gswitch *, size_t, tree, size_t *);
-extern bool vrp_set_zero_nonzero_bits (const tree, value_range *,
+extern bool vrp_set_zero_nonzero_bits (const tree, const value_range *,
wide_int *, wide_int *);
extern bool overflow_comparison_p (tree_code, tree, tree, bool, tree *);
-extern bool range_int_cst_singleton_p (value_range *);
+extern bool range_int_cst_singleton_p (const value_range *);
extern int value_inside_range (tree, tree, tree);
extern tree get_single_symbol (tree, bool *, tree *);
extern void maybe_set_nonzero_bits (edge, tree);