jfunc->m_vr->get_vrange (vr);
if (!vr.undefined_p () && !vr.varying_p ())
{
- irange &r = as_a <irange> (vr);
- irange_bitmask bm = r.get_bitmask ();
+ irange_bitmask bm = vr.get_bitmask ();
widest_int mask
= widest_int::from (bm.mask (), TYPE_SIGN (parm_type));
widest_int value
{
Value_Range tmp = plats->m_value_range.m_vr;
tree type = ipa_get_type (info, i);
- irange &r = as_a<irange> (tmp);
irange_bitmask bm (wide_int::from (bits->get_value (),
TYPE_PRECISION (type),
TYPE_SIGN (type)),
wide_int::from (bits->get_mask (),
TYPE_PRECISION (type),
TYPE_SIGN (type)));
- r.update_bitmask (bm);
+ tmp.update_bitmask (bm);
ipa_vr vr (tmp);
ts->m_vr->quick_push (vr);
}
tree type = ipa_get_type (info, i);
Value_Range tmp;
tmp.set_varying (type);
- irange &r = as_a<irange> (tmp);
irange_bitmask bm (wide_int::from (bits->get_value (),
TYPE_PRECISION (type),
TYPE_SIGN (type)),
wide_int::from (bits->get_mask (),
TYPE_PRECISION (type),
TYPE_SIGN (type)));
- r.update_bitmask (bm);
+ tmp.update_bitmask (bm);
ipa_vr vr (tmp);
ts->m_vr->quick_push (vr);
}
irange_bitmask bm (value, mask);
if (!addr_nonzero)
vr.set_varying (TREE_TYPE (arg));
- irange &r = as_a <irange> (vr);
- r.update_bitmask (bm);
+ vr.update_bitmask (bm);
ipa_set_jfunc_vr (jfunc, vr);
}
else if (addr_nonzero)
vr[i].get_vrange (tmp);
if (tmp.undefined_p () || tmp.varying_p ())
return false;
- irange &r = as_a <irange> (tmp);
- irange_bitmask bm = r.get_bitmask ();
+ irange_bitmask bm;
+ bm = tmp.get_bitmask ();
*mask = widest_int::from (bm.mask (), TYPE_SIGN (TREE_TYPE (parm)));
*value = wide_int_to_tree (TREE_TYPE (parm), bm.value ());
return true;
if (POINTER_TYPE_P (TREE_TYPE (parm))
&& opt_for_fn (node->decl, flag_ipa_bit_cp))
{
- irange &r = as_a<irange> (tmp);
- irange_bitmask bm = r.get_bitmask ();
+ irange_bitmask bm = tmp.get_bitmask ();
unsigned tem = bm.mask ().to_uhwi ();
unsigned HOST_WIDE_INT bitpos = bm.value ().to_uhwi ();
unsigned align = tem & -tem;
#ifndef GCC_RANGE_OP_MIXED_H
#define GCC_RANGE_OP_MIXED_H
-void update_known_bitmask (irange &, tree_code, const irange &, const irange &);
+void update_known_bitmask (vrange &, tree_code, const vrange &, const vrange &);
bool minus_op1_op2_relation_effect (irange &lhs_range, tree type,
const irange &, const irange &,
relation_kind rel);
// LH and RH.
void
-update_known_bitmask (irange &r, tree_code code,
- const irange &lh, const irange &rh)
+update_known_bitmask (vrange &r, tree_code code,
+ const vrange &lh, const vrange &rh)
{
if (r.undefined_p () || lh.undefined_p () || rh.undefined_p ()
|| r.singleton_p ())
v.visit (*this);
}
+void
+vrange::update_bitmask (const class irange_bitmask &)
+{
+}
+
+irange_bitmask
+vrange::get_bitmask () const
+{
+ // Return all unknown bits for the given precision.
+ return irange_bitmask (TYPE_PRECISION (type ()));
+}
+
bool
unsupported_range::contains_p (tree) const
{
// normalize the range if anything changed.
void
-irange::set_nonzero_bits (const wide_int &bits)
+vrange::set_nonzero_bits (const wide_int &bits)
{
gcc_checking_assert (!undefined_p ());
irange_bitmask bm (wi::zero (TYPE_PRECISION (type ())), bits);
// Return the nonzero bits in R.
wide_int
-irange::get_nonzero_bits () const
+vrange::get_nonzero_bits () const
{
gcc_checking_assert (!undefined_p ());
irange_bitmask bm = get_bitmask ();
virtual ~vrange () { }
virtual tree lbound () const = 0;
virtual tree ubound () const = 0;
+ virtual void update_bitmask (const class irange_bitmask &);
+ virtual irange_bitmask get_bitmask () const;
+ wide_int get_nonzero_bits () const;
+ void set_nonzero_bits (const wide_int &bits);
bool varying_p () const;
bool undefined_p () const;
virtual bool fits_p (const vrange &r) const override;
virtual void accept (const vrange_visitor &v) const override;
- void update_bitmask (const irange_bitmask &);
- irange_bitmask get_bitmask () const;
- // Nonzero masks.
- wide_int get_nonzero_bits () const;
- void set_nonzero_bits (const wide_int &bits);
+ virtual void update_bitmask (const class irange_bitmask &) override;
+ virtual irange_bitmask get_bitmask () const override;
protected:
void maybe_resize (int needed);
bool zero_p () const { return m_vrange->zero_p (); }
tree lbound () const { return m_vrange->lbound (); }
tree ubound () const { return m_vrange->ubound (); }
+ irange_bitmask get_bitmask () const { return m_vrange->get_bitmask (); }
+ void update_bitmask (const class irange_bitmask &bm)
+ { return m_vrange->update_bitmask (bm); }
void accept (const vrange_visitor &v) const { m_vrange->accept (v); }
private:
void init (tree type);