aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIain Sandoe <iain@sandoe.co.uk>2019-12-01 09:49:57 +0000
committerIain Sandoe <iain@sandoe.co.uk>2019-12-01 09:49:57 +0000
commitbf31886696cb7906760c6d7d24fab82d5bb646ba (patch)
tree89b610b61d1381b5137686df19c47a2eeab14f12
parent553825f81a575917132d4e1f7f93447a5338be7a (diff)
c++-coroutines - Address review comments, remove separate co_frame expand pass.
Since we have no optimisation at this time that could alter the frame size, we can set it in the same pass as the other coroutine IFNs. 2019-12-01 Iain Sandoe <iain@sandoe.co.uk> gcc/ * coroutine-passes.cc (lower_coro_builtin): Amend comments. (execute_early_expand_coro_ifns): Expand CO_FRAME. (execute_finalize_frame): Remove. (class pass_coroutine_finalize_frame): Remove. (make_pass_coroutine_finalize_frame): Remove. * passes.def: Remove finalize frame pass. * tree-pass.h (make_pass_coroutine_finalize_frame): Remove. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/c++-coroutines@278884 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--ChangeLog.coroutines11
-rw-r--r--gcc/REVISION2
-rw-r--r--gcc/coroutine-passes.cc116
-rw-r--r--gcc/passes.def1
-rw-r--r--gcc/tree-pass.h1
5 files changed, 29 insertions, 102 deletions
diff --git a/ChangeLog.coroutines b/ChangeLog.coroutines
index 7af7560e60a..4bc887a5224 100644
--- a/ChangeLog.coroutines
+++ b/ChangeLog.coroutines
@@ -1,3 +1,14 @@
+2019-12-01 Iain Sandoe <iain@sandoe.co.uk>
+
+ gcc/
+ * coroutine-passes.cc (lower_coro_builtin): Amend comments.
+ (execute_early_expand_coro_ifns): Expand CO_FRAME.
+ (execute_finalize_frame): Remove.
+ (class pass_coroutine_finalize_frame): Remove.
+ (make_pass_coroutine_finalize_frame): Remove.
+ * passes.def: Remove finalize frame pass.
+ * tree-pass.h (make_pass_coroutine_finalize_frame): Remove.
+
2019-11-30 Iain Sandoe <iain@sandoe.co.uk>
gcc/cp/
diff --git a/gcc/REVISION b/gcc/REVISION
index d3b79a5a342..bca44c88115 100644
--- a/gcc/REVISION
+++ b/gcc/REVISION
@@ -1 +1 @@
-[c++-coroutines revision 278657]
+[c++-coroutines revision 278875]
diff --git a/gcc/coroutine-passes.cc b/gcc/coroutine-passes.cc
index 6d01e27c212..c995d676384 100644
--- a/gcc/coroutine-passes.cc
+++ b/gcc/coroutine-passes.cc
@@ -62,13 +62,13 @@ lower_coro_builtin (gimple_stmt_iterator *gsi, bool *handled_ops_p,
return NULL_TREE;
/* This internal function implements an exit from scope without
- performing any cleanups; it jumpt directly to the label provided. */
+ performing any cleanups; it jumps directly to the label provided. */
if (gimple_call_internal_p (stmt)
&& gimple_call_internal_fn (stmt) == IFN_CO_SUSPN)
{
tree dest = TREE_OPERAND (gimple_call_arg (stmt, 0), 0);
ggoto *g = gimple_build_goto (dest);
- gsi_replace (gsi, g, false /* don't re-do EH. */);
+ gsi_replace (gsi, g, /* do EH */ false);
*handled_ops_p = true;
return NULL_TREE;
}
@@ -310,6 +310,21 @@ execute_early_expand_coro_ifns (void)
}
switch (gimple_call_internal_fn (stmt))
{
+ case IFN_CO_FRAME:
+ {
+ /* This internal function is a placeholder for the frame
+ size. In principle, we might lower it later (after some
+ optimisation had reduced the frame size). At present,
+ without any such optimisation, we just set it here. */
+ tree lhs = gimple_call_lhs (stmt);
+ tree size = gimple_call_arg (stmt, 0);
+ /* Right now, this is a trivial operation - copy through
+ the size computed during initial layout. */
+ gassign *grpl = gimple_build_assign (lhs, size);
+ gsi_replace (&gsi, grpl, true);
+ gsi_next (&gsi);
+ }
+ break;
case IFN_CO_ACTOR:
changed = true;
gsi_next (&gsi);
@@ -521,100 +536,3 @@ make_pass_coroutine_early_expand_ifns (gcc::context *ctxt)
{
return new pass_coroutine_early_expand_ifns (ctxt);
}
-
-/* Optimize (not yet) and lower frame allocation.
-
- This is a place-holder for an optimisation to remove unused frame
- entries and re-size the frame to minimum. */
-
-static unsigned int
-execute_finalize_frame (void)
-{
- /* Don't rebuild stuff unless we have to. */
- unsigned int todoflags = 0;
- bool changed = false;
-
- basic_block bb;
-
- gimple_stmt_iterator gsi;
- FOR_EACH_BB_FN (bb, cfun)
- for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi);)
- {
- gimple *stmt = gsi_stmt (gsi);
- if (!is_gimple_call (stmt) || !gimple_call_internal_p (stmt))
- {
- gsi_next (&gsi);
- continue;
- }
- switch (gimple_call_internal_fn (stmt))
- {
- case IFN_CO_FRAME:
- {
- tree lhs = gimple_call_lhs (stmt);
- tree size = gimple_call_arg (stmt, 0);
- /* Right now, this is a trivial operation - copy through
- the size computed during initial layout. */
- gassign *grpl = gimple_build_assign (lhs, size);
- gsi_replace (&gsi, grpl, true);
- changed = true;
- }
- break;
- default:
- gsi_next (&gsi);
- break;
- }
- }
-
- if (!changed)
- {
- if (dump_file)
- fprintf (dump_file, "coro: nothing to do\n");
- return todoflags;
- }
- else if (dump_file)
- fprintf (dump_file, "called frame expansion for %s\n",
- IDENTIFIER_POINTER (DECL_NAME (current_function_decl)));
- return 0;
-}
-
-namespace {
-
-const pass_data pass_data_coroutine_finalize_frame = {
- GIMPLE_PASS, /* type */
- "coro-finalize-frame", /* name */
- OPTGROUP_NONE, /* optinfo_flags */
- TV_NONE, /* tv_id */
- (PROP_cfg | PROP_ssa), /* properties_required */
- 0, /* properties_provided */
- 0, /* properties_destroyed */
- 0, /* todo_flags_start */
- 0 /* todo_flags_finish, set this in the fn. */
-};
-
-class pass_coroutine_finalize_frame : public gimple_opt_pass
-{
-public:
- pass_coroutine_finalize_frame (gcc::context *ctxt)
- : gimple_opt_pass (pass_data_coroutine_finalize_frame, ctxt)
- {}
-
- /* opt_pass methods:
- FIXME: we should not execute this for every function, even when
- coroutines are enabled, it should be only for the ramp - or any
- function into which the ramp is inlined. */
- virtual bool gate (function *) { return flag_coroutines; };
-
- virtual unsigned int execute (function *f ATTRIBUTE_UNUSED)
- {
- return execute_finalize_frame ();
- }
-
-}; // class pass_coroutine_finalize_frame
-
-} // namespace
-
-gimple_opt_pass *
-make_pass_coroutine_finalize_frame (gcc::context *ctxt)
-{
- return new pass_coroutine_finalize_frame (ctxt);
-}
diff --git a/gcc/passes.def b/gcc/passes.def
index 4353364f566..6fee41df526 100644
--- a/gcc/passes.def
+++ b/gcc/passes.def
@@ -396,7 +396,6 @@ along with GCC; see the file COPYING3. If not see
NEXT_PASS (pass_cleanup_eh);
NEXT_PASS (pass_lower_resx);
NEXT_PASS (pass_nrv);
- NEXT_PASS (pass_coroutine_finalize_frame);
NEXT_PASS (pass_cleanup_cfg_post_optimizing);
NEXT_PASS (pass_warn_function_noreturn);
NEXT_PASS (pass_gen_hsail);
diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h
index e14abb18a41..f8508cf06a9 100644
--- a/gcc/tree-pass.h
+++ b/gcc/tree-pass.h
@@ -480,7 +480,6 @@ extern gimple_opt_pass *make_pass_sprintf_length (gcc::context *ctxt);
extern gimple_opt_pass *make_pass_walloca (gcc::context *ctxt);
extern gimple_opt_pass *make_pass_coroutine_lower_builtins (gcc::context *ctxt);
extern gimple_opt_pass *make_pass_coroutine_early_expand_ifns (gcc::context *ctxt);
-extern gimple_opt_pass *make_pass_coroutine_finalize_frame (gcc::context *ctxt);
/* IPA Passes */
extern simple_ipa_opt_pass *make_pass_ipa_lower_emutls (gcc::context *ctxt);