aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vrp.c
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2017-11-01 16:49:08 -0600
committerJeff Law <law@gcc.gnu.org>2017-11-01 16:49:08 -0600
commitd9a3704a0bc83286afc179bc5e638ad6f7460bb3 (patch)
tree1c17c33dc292c5cbbffe76f1b5fe6839e210688b /gcc/tree-vrp.c
parentefc04f78d8a0efb66d9f767ce26aa7d01d19cb0c (diff)
downloadgcc-d9a3704a0bc83286afc179bc5e638ad6f7460bb3.zip
gcc-d9a3704a0bc83286afc179bc5e638ad6f7460bb3.tar.gz
gcc-d9a3704a0bc83286afc179bc5e638ad6f7460bb3.tar.bz2
tree-ssa-propagate.h (ssa_prop_visit_stmt_fn): Remove typedef.
* tree-ssa-propagate.h (ssa_prop_visit_stmt_fn): Remove typedef. (ssa_prop_visit_phi_fn): Likewise. (class ssa_propagation_engine): New class to provide an interface into ssa_propagate. * tree-ssa-propagate.c (ssa_prop_visit_stmt): Remove file scoped variable. (ssa_prop_visit_phi): Likewise. (ssa_propagation_engine::simulate_stmt): Moved into class. Call visit_phi/visit_stmt from the class rather than via file scoped static variables. (ssa_propagation_engine::simulate_block): Moved into class. (ssa_propagation_engine::process_ssa_edge_worklist): Similarly. (ssa_propagation_engine::ssa_propagate): Similarly. No longer set file scoped statics for the visit_stmt/visit_phi callbacks. * tree-complex.c (complex_propagate): New class derived from ssa_propagation_engine. (complex_propagate::visit_stmt): Renamed from complex_visit_stmt. (complex_propagate::visit_phi): Renamed from complex_visit_phi. (tree_lower_complex): Call ssa_propagate via the complex_propagate class. * tree-ssa-ccp.c: (ccp_propagate): New class derived from ssa_propagation_engine. (ccp_propagate::visit_phi): Renamed from ccp_visit_phi_node. (ccp_propagate::visit_stmt): Renamed from ccp_visit_stmt. (do_ssa_ccp): Call ssa_propagate from the ccp_propagate class. * tree-ssa-copy.c (copy_prop): New class derived from ssa_propagation_engine. (copy_prop::visit_stmt): Renamed from copy_prop_visit_stmt. (copy_prop::visit_phi): Renamed from copy_prop_visit_phi_node. (execute_copy_prop): Call ssa_propagate from the copy_prop class. * tree-vrp.c (vrp_prop): New class derived from ssa_propagation_engine. (vrp_prop::visit_stmt): Renamed from vrp_visit_stmt. (vrp_prop::visit_phi): Renamed from vrp_visit_phi_node. (execute_vrp): Call ssa_propagate from the vrp_prop class. From-SVN: r254329
Diffstat (limited to 'gcc/tree-vrp.c')
-rw-r--r--gcc/tree-vrp.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 98be684..ca5e969 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -8086,6 +8086,13 @@ extract_range_from_stmt (gimple *stmt, edge *taken_edge_p,
vrp_visit_switch_stmt (as_a <gswitch *> (stmt), taken_edge_p);
}
+class vrp_prop : public ssa_propagation_engine
+{
+ public:
+ enum ssa_prop_result visit_stmt (gimple *, edge *, tree *) FINAL OVERRIDE;
+ enum ssa_prop_result visit_phi (gphi *) FINAL OVERRIDE;
+};
+
/* Evaluate statement STMT. If the statement produces a useful range,
return SSA_PROP_INTERESTING and record the SSA name with the
interesting range into *OUTPUT_P.
@@ -8095,8 +8102,8 @@ extract_range_from_stmt (gimple *stmt, edge *taken_edge_p,
If STMT produces a varying value, return SSA_PROP_VARYING. */
-static enum ssa_prop_result
-vrp_visit_stmt (gimple *stmt, edge *taken_edge_p, tree *output_p)
+enum ssa_prop_result
+vrp_prop::visit_stmt (gimple *stmt, edge *taken_edge_p, tree *output_p)
{
value_range vr = VR_INITIALIZER;
tree lhs = gimple_get_lhs (stmt);
@@ -9187,8 +9194,8 @@ update_range:
edges. If a valid value range can be derived from all the incoming
value ranges, set a new range for the LHS of PHI. */
-static enum ssa_prop_result
-vrp_visit_phi_node (gphi *phi)
+enum ssa_prop_result
+vrp_prop::visit_phi (gphi *phi)
{
tree lhs = PHI_RESULT (phi);
value_range vr_result = VR_INITIALIZER;
@@ -11463,7 +11470,8 @@ execute_vrp (bool warn_array_bounds_p)
vrp_initialize_lattice ();
vrp_initialize ();
- ssa_propagate (vrp_visit_stmt, vrp_visit_phi_node);
+ class vrp_prop vrp_prop;
+ vrp_prop.ssa_propagate ();
vrp_finalize (warn_array_bounds_p);
/* We must identify jump threading opportunities before we release