From d9a3704a0bc83286afc179bc5e638ad6f7460bb3 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Wed, 1 Nov 2017 16:49:08 -0600 Subject: 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 --- gcc/tree-ssa-ccp.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'gcc/tree-ssa-ccp.c') diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index 569b057..d4b3623 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -171,6 +171,13 @@ struct ccp_prop_value_t { widest_int mask; }; +class ccp_propagate : 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; +}; + /* Array of propagated constant values. After propagation, CONST_VAL[I].VALUE holds the constant value for SSA_NAME(I). If the constant is held in an SSA name representing a memory store @@ -1064,8 +1071,8 @@ ccp_lattice_meet (ccp_prop_value_t *val1, ccp_prop_value_t *val2) PHI node is determined calling ccp_lattice_meet with all the arguments of the PHI node that are incoming via executable edges. */ -static enum ssa_prop_result -ccp_visit_phi_node (gphi *phi) +enum ssa_prop_result +ccp_propagate::visit_phi (gphi *phi) { unsigned i; ccp_prop_value_t new_val; @@ -2378,8 +2385,8 @@ visit_cond_stmt (gimple *stmt, edge *taken_edge_p) value, set *TAKEN_EDGE_P accordingly. If STMT produces a varying value, return SSA_PROP_VARYING. */ -static enum ssa_prop_result -ccp_visit_stmt (gimple *stmt, edge *taken_edge_p, tree *output_p) +enum ssa_prop_result +ccp_propagate::visit_stmt (gimple *stmt, edge *taken_edge_p, tree *output_p) { tree def; ssa_op_iter iter; @@ -2441,7 +2448,8 @@ do_ssa_ccp (bool nonzero_p) calculate_dominance_info (CDI_DOMINATORS); ccp_initialize (); - ssa_propagate (ccp_visit_stmt, ccp_visit_phi_node); + class ccp_propagate ccp_propagate; + ccp_propagate.ssa_propagate (); if (ccp_finalize (nonzero_p || flag_ipa_bit_cp)) { todo = (TODO_cleanup_cfg | TODO_update_ssa); -- cgit v1.1