{
m_cache = new ssa_global_cache;
m_has_cache_entry = BITMAP_ALLOC (NULL);
- m_path = NULL;
m_resolve = resolve;
m_oracle = new path_oracle (ranger.oracle ());
}
{
push_dump_file save (dump_file, dump_flags & ~TDF_DETAILS);
- if (m_path->is_empty ())
+ if (m_path.is_empty ())
return;
unsigned i;
bitmap_iterator bi;
- dump_ranger (dump_file, *m_path);
+ dump_ranger (dump_file, m_path);
fprintf (dump_file, "Imports:\n");
EXECUTE_IF_SET_IN_BITMAP (m_imports, 0, i, bi)
gimple *def = SSA_NAME_DEF_STMT (name);
basic_block bb = gimple_bb (def);
- return !bb || !m_path->contains (bb);
+ return !bb || !m_path.contains (bb);
}
// Return the range of NAME on entry to the path.
path_range_query::set_path (const vec<basic_block> &path)
{
gcc_checking_assert (path.length () > 1);
- m_path = &path;
- m_pos = m_path->length () - 1;
+ m_path = path.copy ();
+ m_pos = m_path.length () - 1;
bitmap_clear (m_has_cache_entry);
}
tree arg = gimple_phi_arg (phi, i)->def;
if (TREE_CODE (arg) == SSA_NAME
- && m_path->contains (e->src)
+ && m_path.contains (e->src)
&& bitmap_set_bit (m_imports, SSA_NAME_VERSION (arg)))
worklist.safe_push (arg);
}
// Compute the ranges for IMPORTS along PATH.
//
// IMPORTS are the set of SSA names, any of which could potentially
-// change the value of the final conditional in PATH.
+// change the value of the final conditional in PATH. Default to the
+// imports of the last block in the path if none is given.
void
path_range_query::compute_ranges (const vec<basic_block> &path,
fprintf (dump_file, "\n==============================================\n");
set_path (path);
- bitmap_copy (m_imports, imports);
m_undefined_path = false;
+ if (imports)
+ bitmap_copy (m_imports, imports);
+ else
+ {
+ bitmap imports = m_ranger.gori ().imports (exit_bb ());
+ bitmap_copy (m_imports, imports);
+ }
+
if (m_resolve)
{
add_copies_to_imports ();
}
}
+// Convenience function to compute ranges along a path consisting of
+// E->SRC and E->DEST.
+
+void
+path_range_query::compute_ranges (edge e)
+{
+ auto_vec<basic_block> bbs (2);
+ bbs.quick_push (e->dest);
+ bbs.quick_push (e->src);
+ compute_ranges (bbs);
+}
+
// A folding aid used to register and query relations along a path.
// When queried, it returns relations as they would appear on exit to
// the path.
if (m_resolve)
{
fold_using_range f;
- jt_fur_source src (stmt, this, &m_ranger.gori (), *m_path);
+ jt_fur_source src (stmt, this, &m_ranger.gori (), m_path);
if (!f.fold_stmt (r, stmt, src))
r.set_varying (type);
}
else
gcc_unreachable ();
- jt_fur_source src (NULL, this, &m_ranger.gori (), *m_path);
+ jt_fur_source src (NULL, this, &m_ranger.gori (), m_path);
src.register_outgoing_edges (cond, r, e0, e1);
}
}
public:
path_range_query (class gimple_ranger &ranger, bool resolve);
virtual ~path_range_query ();
- void compute_ranges (const vec<basic_block> &, const bitmap_head *imports);
+ void compute_ranges (const vec<basic_block> &, const bitmap_head *imports = NULL);
+ void compute_ranges (edge e);
bool range_of_expr (irange &r, tree name, gimple * = NULL) override;
bool range_of_stmt (irange &r, gimple *, tree name = NULL) override;
bool unreachable_path_p ();
// Path navigation.
void set_path (const vec<basic_block> &);
- basic_block entry_bb () { return (*m_path)[m_path->length () - 1]; }
- basic_block exit_bb () { return (*m_path)[0]; }
- basic_block curr_bb () { return (*m_path)[m_pos]; }
- basic_block prev_bb () { return (*m_path)[m_pos + 1]; }
- basic_block next_bb () { return (*m_path)[m_pos - 1]; }
- bool at_entry () { return m_pos == m_path->length () - 1; }
+ basic_block entry_bb () { return m_path[m_path.length () - 1]; }
+ basic_block exit_bb () { return m_path[0]; }
+ basic_block curr_bb () { return m_path[m_pos]; }
+ basic_block prev_bb () { return m_path[m_pos + 1]; }
+ basic_block next_bb () { return m_path[m_pos - 1]; }
+ bool at_entry () { return m_pos == m_path.length () - 1; }
bool at_exit () { return m_pos == 0; }
void move_next () { --m_pos; }
bitmap m_has_cache_entry;
// Path being analyzed.
- const vec<basic_block> *m_path;
+ auto_vec<basic_block> m_path;
auto_bitmap m_imports;
gimple_ranger &m_ranger;