Minor cleanups to solver.

These are some minor cleanups and renames that surfaced after the
hybrid_threader work.

gcc/ChangeLog:

	* gimple-range-path.cc
	(path_range_query::precompute_ranges_in_block): Rename to...
	(path_range_query::compute_ranges_in_block): ...this.
	(path_range_query::precompute_ranges): Rename to...
	(path_range_query::compute_ranges): ...this.
	(path_range_query::precompute_relations): Rename to...
	(path_range_query::compute_relations): ...this.
	(path_range_query::precompute_phi_relations): Rename to...
	(path_range_query::compute_phi_relations): ...this.
	* gimple-range-path.h: Rename precompute* to compute*.
	* tree-ssa-threadbackward.c
	(back_threader::find_taken_edge_switch): Same.
	(back_threader::find_taken_edge_cond): Same.
	* tree-ssa-threadedge.c
	(hybrid_jt_simplifier::compute_ranges_from_state): Same.
	(hybrid_jt_state::register_equivs_stmt): Inline...
	* tree-ssa-threadedge.h: ...here.
This commit is contained in:
Aldy Hernandez 2021-09-25 09:28:10 +02:00
parent 4ef1e524fd
commit 8366836860
5 changed files with 27 additions and 34 deletions

View File

@ -293,11 +293,11 @@ path_range_query::range_defined_in_block (irange &r, tree name, basic_block bb)
return true;
}
// Precompute ranges defined in the current block, or ranges
// that are exported on an edge to the next block.
// Compute ranges defined in the current block, or exported to the
// next block.
void
path_range_query::precompute_ranges_in_block (basic_block bb)
path_range_query::compute_ranges_in_block (basic_block bb)
{
bitmap_iterator bi;
int_range_max r, cached_range;
@ -452,14 +452,14 @@ path_range_query::add_copies_to_imports ()
}
}
// Precompute the ranges for IMPORTS along PATH.
// 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.
void
path_range_query::precompute_ranges (const vec<basic_block> &path,
const bitmap_head *imports)
path_range_query::compute_ranges (const vec<basic_block> &path,
const bitmap_head *imports)
{
if (DEBUG_SOLVER)
fprintf (dump_file, "\n*********** path_range_query ******************\n");
@ -472,12 +472,12 @@ path_range_query::precompute_ranges (const vec<basic_block> &path,
{
add_copies_to_imports ();
m_oracle->reset_path ();
precompute_relations (path);
compute_relations (path);
}
if (DEBUG_SOLVER)
{
fprintf (dump_file, "\npath_range_query: precompute_ranges for path: ");
fprintf (dump_file, "\npath_range_query: compute_ranges for path: ");
for (unsigned i = path.length (); i > 0; --i)
{
basic_block bb = path[i - 1];
@ -504,7 +504,7 @@ path_range_query::precompute_ranges (const vec<basic_block> &path,
bitmap_set_bit (m_imports, SSA_NAME_VERSION (name));
}
precompute_ranges_in_block (bb);
compute_ranges_in_block (bb);
adjust_for_non_null_uses (bb);
if (at_exit ())
@ -611,12 +611,12 @@ path_range_query::range_of_stmt (irange &r, gimple *stmt, tree)
return true;
}
// Precompute relations on a path. This involves two parts: relations
// Compute relations on a path. This involves two parts: relations
// along the conditionals joining a path, and relations determined by
// examining PHIs.
void
path_range_query::precompute_relations (const vec<basic_block> &path)
path_range_query::compute_relations (const vec<basic_block> &path)
{
if (!dom_info_available_p (CDI_DOMINATORS))
return;
@ -628,7 +628,7 @@ path_range_query::precompute_relations (const vec<basic_block> &path)
basic_block bb = path[i - 1];
gimple *stmt = last_stmt (bb);
precompute_phi_relations (bb, prev);
compute_phi_relations (bb, prev);
// Compute relations in outgoing edges along the path. Skip the
// final conditional which we don't know yet.
@ -656,14 +656,14 @@ path_range_query::precompute_relations (const vec<basic_block> &path)
}
}
// Precompute relations for each PHI in BB. For example:
// Compute relations for each PHI in BB. For example:
//
// x_5 = PHI<y_9(5),...>
//
// If the path flows through BB5, we can register that x_5 == y_9.
void
path_range_query::precompute_phi_relations (basic_block bb, basic_block prev)
path_range_query::compute_phi_relations (basic_block bb, basic_block prev)
{
if (prev == NULL)
return;

View File

@ -26,9 +26,6 @@ along with GCC; see the file COPYING3. If not see
// will calculate the range of an SSA or STMT as if the BBs in the
// path would have been executed in order.
//
// Only SSA names passed in IMPORTS are precomputed, and can be
// queried.
//
// Note that the blocks are in reverse order, thus the exit block is
// path[0].
@ -37,8 +34,7 @@ class path_range_query : public range_query
public:
path_range_query (class gimple_ranger &ranger, bool resolve);
virtual ~path_range_query ();
void precompute_ranges (const vec<basic_block> &path,
const bitmap_head *imports);
void compute_ranges (const vec<basic_block> &, const bitmap_head *imports);
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 ();
@ -56,13 +52,13 @@ private:
bool get_cache (irange &r, tree name);
void clear_cache (tree name);
// Methods to precompute ranges for the given path.
// Methods to compute ranges for the given path.
bool range_defined_in_block (irange &, tree name, basic_block bb);
void precompute_ranges_in_block (basic_block bb);
void compute_ranges_in_block (basic_block bb);
void adjust_for_non_null_uses (basic_block bb);
void ssa_range_in_phi (irange &r, gphi *phi);
void precompute_relations (const vec<basic_block> &);
void precompute_phi_relations (basic_block bb, basic_block prev);
void compute_relations (const vec<basic_block> &);
void compute_phi_relations (basic_block bb, basic_block prev);
void add_copies_to_imports ();
bool add_to_imports (tree name, bitmap imports);

View File

@ -192,7 +192,7 @@ back_threader::find_taken_edge_switch (const vec<basic_block> &path,
tree name = gimple_switch_index (sw);
int_range_max r;
m_solver.precompute_ranges (path, m_imports);
m_solver.compute_ranges (path, m_imports);
m_solver.range_of_expr (r, name, sw);
if (r.undefined_p ())
@ -216,7 +216,7 @@ back_threader::find_taken_edge_cond (const vec<basic_block> &path,
{
int_range_max r;
m_solver.precompute_ranges (path, m_imports);
m_solver.compute_ranges (path, m_imports);
m_solver.range_of_stmt (r, cond);
if (m_solver.unreachable_path_p ())

View File

@ -1402,12 +1402,6 @@ jt_state::register_equivs_stmt (gimple *stmt, basic_block bb,
// Hybrid threader implementation.
void
hybrid_jt_state::register_equivs_stmt (gimple *, basic_block, jt_simplifier *)
{
// Ranger has no need to simplify anything to improve equivalences.
}
hybrid_jt_simplifier::hybrid_jt_simplifier (gimple_ranger *r,
path_range_query *q)
{
@ -1466,5 +1460,5 @@ hybrid_jt_simplifier::compute_ranges_from_state (gimple *stmt, jt_state *state)
bitmap_set_bit (imports, SSA_NAME_VERSION (op));
}
}
m_query->precompute_ranges (m_path, imports);
m_query->compute_ranges (m_path, imports);
}

View File

@ -56,16 +56,19 @@ public:
class hybrid_jt_state : public jt_state
{
private:
void register_equivs_stmt (gimple *, basic_block, jt_simplifier *) override;
void register_equivs_stmt (gimple *, basic_block, jt_simplifier *) override
{
// Ranger has no need to simplify anything.
}
};
class hybrid_jt_simplifier : public jt_simplifier
{
public:
hybrid_jt_simplifier (class gimple_ranger *r, class path_range_query *q);
tree simplify (gimple *stmt, gimple *, basic_block, jt_state *) override;
private:
tree simplify (gimple *stmt, gimple *, basic_block, jt_state *) override;
void compute_ranges_from_state (gimple *stmt, jt_state *);
gimple_ranger *m_ranger;