Commit 2162bfe1 by Tom de Vries Committed by Tom de Vries

Remove first_pass_instance from pass_reassoc

2015-11-16  Tom de Vries  <tom@codesourcery.com>

	* passes.def: Add arg to pass_reassoc pass instantiation.
	* tree-ssa-reassoc.c (reassoc_insert_powi_p): New static variable.
	(acceptable_pow_call, reassociate_bb): Use reassoc_insert_powi_p instead
	of first_pass_instance.
	(execute_reassoc): Add and handle insert_powi_p parameter.
	(pass_reassoc::insert_powi_p): New private member.
	(pass_reassoc::pass_reassoc): Initialize insert_powi_p.
	(pass_reassoc::set_pass_param): New member function.  Set insert_powi_p.
	(pass_reassoc::execute): Call execute_reassoc with extra arg.

From-SVN: r230416
parent b0c77505
2015-11-16 Tom de Vries <tom@codesourcery.com> 2015-11-16 Tom de Vries <tom@codesourcery.com>
* passes.def: Add arg to pass_reassoc pass instantiation.
* tree-ssa-reassoc.c (reassoc_insert_powi_p): New static variable.
(acceptable_pow_call, reassociate_bb): Use reassoc_insert_powi_p instead
of first_pass_instance.
(execute_reassoc): Add and handle insert_powi_p parameter.
(pass_reassoc::insert_powi_p): New private member.
(pass_reassoc::pass_reassoc): Initialize insert_powi_p.
(pass_reassoc::set_pass_param): New member function. Set insert_powi_p.
(pass_reassoc::execute): Call execute_reassoc with extra arg.
2015-11-16 Tom de Vries <tom@codesourcery.com>
* gdbhooks.py (class PassNames): Handle extra arg NEXT_PASS argument. * gdbhooks.py (class PassNames): Handle extra arg NEXT_PASS argument.
* gen-pass-instances.awk (handle_line): Same. * gen-pass-instances.awk (handle_line): Same.
* pass_manager.h (class pass_manager): Define and undefine * pass_manager.h (class pass_manager): Define and undefine
...@@ -205,7 +205,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -205,7 +205,7 @@ along with GCC; see the file COPYING3. If not see
opportunities. */ opportunities. */
NEXT_PASS (pass_phi_only_cprop); NEXT_PASS (pass_phi_only_cprop);
NEXT_PASS (pass_dse); NEXT_PASS (pass_dse);
NEXT_PASS (pass_reassoc); NEXT_PASS (pass_reassoc, true /* insert_powi_p */);
NEXT_PASS (pass_dce); NEXT_PASS (pass_dce);
NEXT_PASS (pass_forwprop); NEXT_PASS (pass_forwprop);
NEXT_PASS (pass_phiopt); NEXT_PASS (pass_phiopt);
...@@ -276,7 +276,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -276,7 +276,7 @@ along with GCC; see the file COPYING3. If not see
NEXT_PASS (pass_lower_vector_ssa); NEXT_PASS (pass_lower_vector_ssa);
NEXT_PASS (pass_split_paths); NEXT_PASS (pass_split_paths);
NEXT_PASS (pass_cse_reciprocals); NEXT_PASS (pass_cse_reciprocals);
NEXT_PASS (pass_reassoc); NEXT_PASS (pass_reassoc, false /* insert_powi_p */);
NEXT_PASS (pass_strength_reduction); NEXT_PASS (pass_strength_reduction);
NEXT_PASS (pass_tracer); NEXT_PASS (pass_tracer);
NEXT_PASS (pass_dominator); NEXT_PASS (pass_dominator);
......
...@@ -172,6 +172,9 @@ along with GCC; see the file COPYING3. If not see ...@@ -172,6 +172,9 @@ along with GCC; see the file COPYING3. If not see
destructive update for the associating op, and keep the destructive destructive update for the associating op, and keep the destructive
update together for vector sum reduction recognition. */ update together for vector sum reduction recognition. */
/* Enable insertion of __builtin_powi calls during execute_reassoc. See
point 3a in the pass header comment. */
static bool reassoc_insert_powi_p;
/* Statistics */ /* Statistics */
static struct static struct
...@@ -3940,7 +3943,7 @@ acceptable_pow_call (gimple *stmt, tree *base, HOST_WIDE_INT *exponent) ...@@ -3940,7 +3943,7 @@ acceptable_pow_call (gimple *stmt, tree *base, HOST_WIDE_INT *exponent)
tree fndecl, arg1; tree fndecl, arg1;
REAL_VALUE_TYPE c, cint; REAL_VALUE_TYPE c, cint;
if (!first_pass_instance if (!reassoc_insert_powi_p
|| !flag_unsafe_math_optimizations || !flag_unsafe_math_optimizations
|| !is_gimple_call (stmt) || !is_gimple_call (stmt)
|| !has_single_use (gimple_call_lhs (stmt))) || !has_single_use (gimple_call_lhs (stmt)))
...@@ -4856,7 +4859,7 @@ reassociate_bb (basic_block bb) ...@@ -4856,7 +4859,7 @@ reassociate_bb (basic_block bb)
if (rhs_code == MULT_EXPR) if (rhs_code == MULT_EXPR)
attempt_builtin_copysign (&ops); attempt_builtin_copysign (&ops);
if (first_pass_instance if (reassoc_insert_powi_p
&& rhs_code == MULT_EXPR && rhs_code == MULT_EXPR
&& flag_unsafe_math_optimizations) && flag_unsafe_math_optimizations)
powi_result = attempt_builtin_powi (stmt, &ops); powi_result = attempt_builtin_powi (stmt, &ops);
...@@ -5111,11 +5114,14 @@ fini_reassoc (void) ...@@ -5111,11 +5114,14 @@ fini_reassoc (void)
loop_optimizer_finalize (); loop_optimizer_finalize ();
} }
/* Gate and execute functions for Reassociation. */ /* Gate and execute functions for Reassociation. If INSERT_POWI_P, enable
insertion of __builtin_powi calls. */
static unsigned int static unsigned int
execute_reassoc (void) execute_reassoc (bool insert_powi_p)
{ {
reassoc_insert_powi_p = insert_powi_p;
init_reassoc (); init_reassoc ();
do_reassoc (); do_reassoc ();
...@@ -5145,14 +5151,24 @@ class pass_reassoc : public gimple_opt_pass ...@@ -5145,14 +5151,24 @@ class pass_reassoc : public gimple_opt_pass
{ {
public: public:
pass_reassoc (gcc::context *ctxt) pass_reassoc (gcc::context *ctxt)
: gimple_opt_pass (pass_data_reassoc, ctxt) : gimple_opt_pass (pass_data_reassoc, ctxt), insert_powi_p (false)
{} {}
/* opt_pass methods: */ /* opt_pass methods: */
opt_pass * clone () { return new pass_reassoc (m_ctxt); } opt_pass * clone () { return new pass_reassoc (m_ctxt); }
void set_pass_param (unsigned int n, bool param)
{
gcc_assert (n == 0);
insert_powi_p = param;
}
virtual bool gate (function *) { return flag_tree_reassoc != 0; } virtual bool gate (function *) { return flag_tree_reassoc != 0; }
virtual unsigned int execute (function *) { return execute_reassoc (); } virtual unsigned int execute (function *)
{ return execute_reassoc (insert_powi_p); }
private:
/* Enable insertion of __builtin_powi calls during execute_reassoc. See
point 3a in the pass header comment. */
bool insert_powi_p;
}; // class pass_reassoc }; // class pass_reassoc
} // anon namespace } // anon namespace
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment