+2015-01-19 Ilya Enkovich <ilya.enkovich@intel.com>
+
+ * ipa-chkp.c (chkp_produce_thunks): Add early param
+ to split thunks production into two passes. Keep
+ 'always_inline' function bodies after the first pass.
+ (pass_data_ipa_chkp_early_produce_thunks): New.
+ (pass_ipa_chkp_early_produce_thunks): New.
+ (pass_ipa_chkp_produce_thunks::execute): Adjust to new
+ chkp_produce_thunks signature.
+ (make_pass_ipa_chkp_early_produce_thunks): New.
+ * passes.def (pass_ipa_chkp_early_produce_thunks): New.
+ (pass_ipa_chkp_produce_thunks): Move after local optimizations.
+ * tree-pass.h (make_pass_ipa_chkp_early_produce_thunks): New.
+
2015-01-18 Jan Hubicka <hubicka@ucw.cz>
* cgraph.c (cgraph_node::dump): Dump profile flags.
function. */
static unsigned int
-chkp_produce_thunks (void)
+chkp_produce_thunks (bool early)
{
struct cgraph_node *node;
if (!node->instrumentation_clone
&& node->instrumented_version
&& gimple_has_body_p (node->decl)
- && gimple_has_body_p (node->instrumented_version->decl))
+ && gimple_has_body_p (node->instrumented_version->decl)
+ && (!lookup_attribute ("always_inline", DECL_ATTRIBUTES (node->decl))
+ || !early))
{
node->release_body ();
node->remove_callees ();
/* Mark instrumentation clones created for aliases and thunks
as insttrumented so they could be removed as unreachable
now. */
- FOR_EACH_DEFINED_FUNCTION (node)
+ if (!early)
{
- if (node->instrumentation_clone
- && (node->alias || node->thunk.thunk_p)
- && !chkp_function_instrumented_p (node->decl))
- chkp_function_mark_instrumented (node->decl);
+ FOR_EACH_DEFINED_FUNCTION (node)
+ {
+ if (node->instrumentation_clone
+ && (node->alias || node->thunk.thunk_p)
+ && !chkp_function_instrumented_p (node->decl))
+ chkp_function_mark_instrumented (node->decl);
+ }
}
return TODO_remove_functions;
0 /* todo_flags_finish */
};
+const pass_data pass_data_ipa_chkp_early_produce_thunks =
+{
+ SIMPLE_IPA_PASS, /* type */
+ "chkp_ecleanup", /* name */
+ OPTGROUP_NONE, /* optinfo_flags */
+ TV_NONE, /* tv_id */
+ 0, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ 0 /* todo_flags_finish */
+};
+
const pass_data pass_data_ipa_chkp_produce_thunks =
{
SIMPLE_IPA_PASS, /* type */
}; // class pass_ipa_chkp_versioning
+class pass_ipa_chkp_early_produce_thunks : public simple_ipa_opt_pass
+{
+public:
+ pass_ipa_chkp_early_produce_thunks (gcc::context *ctxt)
+ : simple_ipa_opt_pass (pass_data_ipa_chkp_early_produce_thunks, ctxt)
+ {}
+
+ /* opt_pass methods: */
+ virtual opt_pass * clone ()
+ {
+ return new pass_ipa_chkp_early_produce_thunks (m_ctxt);
+ }
+
+ virtual bool gate (function *)
+ {
+ return flag_check_pointer_bounds;
+ }
+
+ virtual unsigned int execute (function *)
+ {
+ return chkp_produce_thunks (true);
+ }
+
+}; // class pass_chkp_produce_thunks
+
class pass_ipa_chkp_produce_thunks : public simple_ipa_opt_pass
{
public:
virtual unsigned int execute (function *)
{
- return chkp_produce_thunks ();
+ return chkp_produce_thunks (false);
}
}; // class pass_chkp_produce_thunks
return new pass_ipa_chkp_versioning (ctxt);
}
+simple_ipa_opt_pass *
+make_pass_ipa_chkp_early_produce_thunks (gcc::context *ctxt)
+{
+ return new pass_ipa_chkp_early_produce_thunks (ctxt);
+}
+
simple_ipa_opt_pass *
make_pass_ipa_chkp_produce_thunks (gcc::context *ctxt)
{
NEXT_PASS (pass_ipa_free_lang_data);
NEXT_PASS (pass_ipa_function_and_variable_visibility);
NEXT_PASS (pass_ipa_chkp_versioning);
+ NEXT_PASS (pass_ipa_chkp_early_produce_thunks);
NEXT_PASS (pass_build_ssa_passes);
PUSH_INSERT_PASSES_WITHIN (pass_build_ssa_passes)
NEXT_PASS (pass_fixup_cfg);
NEXT_PASS (pass_chkp);
NEXT_PASS (pass_rebuild_cgraph_edges);
POP_INSERT_PASSES ()
- NEXT_PASS (pass_ipa_chkp_produce_thunks);
NEXT_PASS (pass_local_optimization_passes);
PUSH_INSERT_PASSES_WITHIN (pass_local_optimization_passes)
NEXT_PASS (pass_rebuild_cgraph_edges);
NEXT_PASS (pass_inline_parameters);
POP_INSERT_PASSES ()
+ NEXT_PASS (pass_ipa_chkp_produce_thunks);
NEXT_PASS (pass_ipa_auto_profile);
NEXT_PASS (pass_ipa_free_inline_summary);
NEXT_PASS (pass_ipa_tree_profile);