diff options
author | Jeff Law <law@redhat.com> | 2017-11-01 16:49:08 -0600 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 2017-11-01 16:49:08 -0600 |
commit | d9a3704a0bc83286afc179bc5e638ad6f7460bb3 (patch) | |
tree | 1c17c33dc292c5cbbffe76f1b5fe6839e210688b /gcc/tree-ssa-propagate.c | |
parent | efc04f78d8a0efb66d9f767ce26aa7d01d19cb0c (diff) | |
download | gcc-d9a3704a0bc83286afc179bc5e638ad6f7460bb3.tar.gz |
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-ssa-propagate.c')
-rw-r--r-- | gcc/tree-ssa-propagate.c | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c index 00ab3d72564..90df285aa35 100644 --- a/gcc/tree-ssa-propagate.c +++ b/gcc/tree-ssa-propagate.c @@ -108,10 +108,6 @@ [3] Advanced Compiler Design and Implementation, Steven Muchnick, Morgan Kaufmann, 1997, Section 12.6 */ -/* Function pointers used to parameterize the propagation engine. */ -static ssa_prop_visit_stmt_fn ssa_prop_visit_stmt; -static ssa_prop_visit_phi_fn ssa_prop_visit_phi; - /* Worklist of control flow edge destinations. This contains the CFG order number of the blocks so we can iterate in CFG order by visiting in bit-order. */ @@ -217,8 +213,8 @@ add_control_edge (edge e) /* Simulate the execution of STMT and update the work lists accordingly. */ -static void -simulate_stmt (gimple *stmt) +void +ssa_propagation_engine::simulate_stmt (gimple *stmt) { enum ssa_prop_result val = SSA_PROP_NOT_INTERESTING; edge taken_edge = NULL; @@ -234,11 +230,11 @@ simulate_stmt (gimple *stmt) if (gimple_code (stmt) == GIMPLE_PHI) { - val = ssa_prop_visit_phi (as_a <gphi *> (stmt)); + val = visit_phi (as_a <gphi *> (stmt)); output_name = gimple_phi_result (stmt); } else - val = ssa_prop_visit_stmt (stmt, &taken_edge, &output_name); + val = visit_stmt (stmt, &taken_edge, &output_name); if (val == SSA_PROP_VARYING) { @@ -321,8 +317,8 @@ simulate_stmt (gimple *stmt) when an SSA edge is added to it in simulate_stmt. Return true if a stmt was simulated. */ -static void -process_ssa_edge_worklist () +void +ssa_propagation_engine::process_ssa_edge_worklist (void) { /* Process the next entry from the worklist. */ unsigned stmt_uid = bitmap_first_set_bit (ssa_edge_worklist); @@ -345,8 +341,8 @@ process_ssa_edge_worklist () /* Simulate the execution of BLOCK. Evaluate the statement associated with each variable reference inside the block. */ -static void -simulate_block (basic_block block) +void +ssa_propagation_engine::simulate_block (basic_block block) { gimple_stmt_iterator gsi; @@ -781,19 +777,15 @@ update_call_from_tree (gimple_stmt_iterator *si_p, tree expr) return false; } - /* Entry point to the propagation engine. - VISIT_STMT is called for every statement visited. - VISIT_PHI is called for every PHI node visited. */ + The VISIT_STMT virtual function is called for every statement + visited and the VISIT_PHI virtual function is called for every PHI + node visited. */ void -ssa_propagate (ssa_prop_visit_stmt_fn visit_stmt, - ssa_prop_visit_phi_fn visit_phi) +ssa_propagation_engine::ssa_propagate (void) { - ssa_prop_visit_stmt = visit_stmt; - ssa_prop_visit_phi = visit_phi; - ssa_prop_init (); /* Iterate until the worklists are empty. */ |