Commit 813ccd83 by Tom de Vries Committed by Tom de Vries

Remove first_pass_instance from pass_object_sizes

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

	* passes.def: Add arg to pass_object_sizes pass instantiation.
	* tree-object-size.c (pass_object_sizes::pass_object_sizes): Initialize
	insert_min_max_p.
	(pass_object_sizes::set_pass_param): New member function.  Set
	insert_min_max_p.
	(pass_object_sizes::insert_min_max_p): New private member.
	(pass_object_sizes::execute): Use insert_min_max_p instead of
	first_pass_instance.

From-SVN: r230418
parent 5ce8d99a
2015-11-16 Tom de Vries <tom@codesourcery.com> 2015-11-16 Tom de Vries <tom@codesourcery.com>
* passes.def: Add arg to pass_object_sizes pass instantiation.
* tree-object-size.c (pass_object_sizes::pass_object_sizes): Initialize
insert_min_max_p.
(pass_object_sizes::set_pass_param): New member function. Set
insert_min_max_p.
(pass_object_sizes::insert_min_max_p): New private member.
(pass_object_sizes::execute): Use insert_min_max_p instead of
first_pass_instance.
2015-11-16 Tom de Vries <tom@codesourcery.com>
* passes.def: Add arg to pass_dominator pass instantiation. * passes.def: Add arg to pass_dominator pass instantiation.
* tree-pass.h (first_pass_instance): Remove pass_dominator-related bit * tree-pass.h (first_pass_instance): Remove pass_dominator-related bit
of comment. of comment.
...@@ -77,7 +77,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -77,7 +77,7 @@ along with GCC; see the file COPYING3. If not see
NEXT_PASS (pass_all_early_optimizations); NEXT_PASS (pass_all_early_optimizations);
PUSH_INSERT_PASSES_WITHIN (pass_all_early_optimizations) PUSH_INSERT_PASSES_WITHIN (pass_all_early_optimizations)
NEXT_PASS (pass_remove_cgraph_callee_edges); NEXT_PASS (pass_remove_cgraph_callee_edges);
NEXT_PASS (pass_object_sizes); NEXT_PASS (pass_object_sizes, true /* insert_min_max_p */);
NEXT_PASS (pass_ccp); NEXT_PASS (pass_ccp);
/* After CCP we rewrite no longer addressed locals into SSA /* After CCP we rewrite no longer addressed locals into SSA
form if possible. */ form if possible. */
...@@ -164,7 +164,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -164,7 +164,7 @@ along with GCC; see the file COPYING3. If not see
NEXT_PASS (pass_backprop); NEXT_PASS (pass_backprop);
NEXT_PASS (pass_phiprop); NEXT_PASS (pass_phiprop);
NEXT_PASS (pass_forwprop); NEXT_PASS (pass_forwprop);
NEXT_PASS (pass_object_sizes); NEXT_PASS (pass_object_sizes, false /* insert_min_max_p */);
/* pass_build_alias is a dummy pass that ensures that we /* pass_build_alias is a dummy pass that ensures that we
execute TODO_rebuild_alias at this point. */ execute TODO_rebuild_alias at this point. */
NEXT_PASS (pass_build_alias); NEXT_PASS (pass_build_alias);
......
...@@ -1217,13 +1217,21 @@ class pass_object_sizes : public gimple_opt_pass ...@@ -1217,13 +1217,21 @@ class pass_object_sizes : public gimple_opt_pass
{ {
public: public:
pass_object_sizes (gcc::context *ctxt) pass_object_sizes (gcc::context *ctxt)
: gimple_opt_pass (pass_data_object_sizes, ctxt) : gimple_opt_pass (pass_data_object_sizes, ctxt), insert_min_max_p (false)
{} {}
/* opt_pass methods: */ /* opt_pass methods: */
opt_pass * clone () { return new pass_object_sizes (m_ctxt); } opt_pass * clone () { return new pass_object_sizes (m_ctxt); }
void set_pass_param (unsigned int n, bool param)
{
gcc_assert (n == 0);
insert_min_max_p = param;
}
virtual unsigned int execute (function *); virtual unsigned int execute (function *);
private:
/* Determines whether the pass instance creates MIN/MAX_EXPRs. */
bool insert_min_max_p;
}; // class pass_object_sizes }; // class pass_object_sizes
/* Dummy valueize function. */ /* Dummy valueize function. */
...@@ -1250,12 +1258,12 @@ pass_object_sizes::execute (function *fun) ...@@ -1250,12 +1258,12 @@ pass_object_sizes::execute (function *fun)
init_object_sizes (); init_object_sizes ();
/* In the first pass instance, only attempt to fold /* If insert_min_max_p, only attempt to fold
__builtin_object_size (x, 1) and __builtin_object_size (x, 3), __builtin_object_size (x, 1) and __builtin_object_size (x, 3),
and rather than folding the builtin to the constant if any, and rather than folding the builtin to the constant if any,
create a MIN_EXPR or MAX_EXPR of the __builtin_object_size create a MIN_EXPR or MAX_EXPR of the __builtin_object_size
call result and the computed constant. */ call result and the computed constant. */
if (first_pass_instance) if (insert_min_max_p)
{ {
tree ost = gimple_call_arg (call, 1); tree ost = gimple_call_arg (call, 1);
if (tree_fits_uhwi_p (ost)) if (tree_fits_uhwi_p (ost))
......
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