}
-outgoing_range::outgoing_range ()
+// Return a TRUE or FALSE range representing the edge value of a GCOND.
+
+void
+gcond_edge_range (irange &r, edge e)
+{
+ gcc_checking_assert (e->flags & (EDGE_TRUE_VALUE | EDGE_FALSE_VALUE));
+ if (e->flags & EDGE_TRUE_VALUE)
+ r = int_range<2> (boolean_true_node, boolean_true_node);
+ else
+ r = int_range<2> (boolean_false_node, boolean_false_node);
+}
+
+
+gimple_outgoing_range::gimple_outgoing_range ()
{
m_edge_table = NULL;
}
-outgoing_range::~outgoing_range ()
+
+gimple_outgoing_range::~gimple_outgoing_range ()
{
if (m_edge_table)
delete m_edge_table;
// Use a cached value if it exists, or calculate it if not.
bool
-outgoing_range::get_edge_range (irange &r, gimple *s, edge e)
+gimple_outgoing_range::get_edge_range (irange &r, gimple *s, edge e)
{
gcc_checking_assert (is_a<gswitch *> (s));
gswitch *sw = as_a<gswitch *> (s);
// Calculate all switch edges from SW and cache them in the hash table.
void
-outgoing_range::calc_switch_ranges (gswitch *sw)
+gimple_outgoing_range::calc_switch_ranges (gswitch *sw)
{
bool existed;
unsigned x, lim;
// return NULL
gimple *
-outgoing_range::edge_range_p (irange &r, edge e)
+gimple_outgoing_range::edge_range_p (irange &r, edge e)
{
// Determine if there is an outgoing edge.
gimple *s = gimple_outgoing_range_stmt_p (e->src);
if (is_a<gcond *> (s))
{
- if (e->flags & EDGE_TRUE_VALUE)
- r = int_range<2> (boolean_true_node, boolean_true_node);
- else if (e->flags & EDGE_FALSE_VALUE)
- r = int_range<2> (boolean_false_node, boolean_false_node);
- else
- gcc_unreachable ();
+ gcond_edge_range (r, e);
return s;
}
// The return value is NULL for no range, or the branch statement which the
// edge gets the range from, along with the range.
-class outgoing_range
+class gimple_outgoing_range
{
public:
- outgoing_range ();
- ~outgoing_range ();
+ gimple_outgoing_range ();
+ ~gimple_outgoing_range ();
gimple *edge_range_p (irange &r, edge e);
private:
void calc_switch_ranges (gswitch *sw);
hash_map<edge, irange *> *m_edge_table;
irange_allocator m_range_allocator;
-};
+};
-// If there is a range control statment at the end of block BB, return it.
+// If there is a range control statement at the end of block BB, return it.
gimple *gimple_outgoing_range_stmt_p (basic_block bb);
+// Return the range on edge E if it is from a GCOND. Either TRUE or FALSE.
+void gcond_edge_range (irange &r, edge e);
#endif // GIMPLE_RANGE_EDGE_H