void set_range_info (tree name, double_int min, double_int max) { gcc_assert (!POINTER_TYPE_P (TREE_TYPE (name))); range_info_def *ri = SSA_NAME_RANGE_INFO (name); /* Allocate if not available. */ if (ri == NULL) { ri = ggc_alloc_cleared_range_info_def (); SSA_NAME_RANGE_INFO (name) = ri; } /* Set the values. */ ri->min = min; ri->max = max; }
void set_range_info (tree name, enum value_range_type range_type, double_int min, double_int max) { gcc_assert (!POINTER_TYPE_P (TREE_TYPE (name))); gcc_assert (range_type == VR_RANGE || range_type == VR_ANTI_RANGE); range_info_def *ri = SSA_NAME_RANGE_INFO (name); /* Allocate if not available. */ if (ri == NULL) { ri = ggc_alloc_cleared_range_info_def (); SSA_NAME_RANGE_INFO (name) = ri; ri->nonzero_bits = double_int::mask (TYPE_PRECISION (TREE_TYPE (name))); } /* Record the range type. */ if (SSA_NAME_RANGE_TYPE (name) != range_type) SSA_NAME_ANTI_RANGE_P (name) = (range_type == VR_ANTI_RANGE); /* Set the values. */ ri->min = min; ri->max = max; /* If it is a range, try to improve nonzero_bits from the min/max. */ if (range_type == VR_RANGE) { int prec = TYPE_PRECISION (TREE_TYPE (name)); double_int xorv; min = min.zext (prec); max = max.zext (prec); xorv = min ^ max; if (xorv.high) xorv = double_int::mask (2 * HOST_BITS_PER_WIDE_INT - clz_hwi (xorv.high)); else if (xorv.low) xorv = double_int::mask (HOST_BITS_PER_WIDE_INT - clz_hwi (xorv.low)); ri->nonzero_bits = ri->nonzero_bits & (min | xorv); } }