This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ coroutines 4/6] Middle end expanders and transforms.


Bin.Cheng <amker.cheng@gmail.com> wrote:

>>> +           gassign *get_res = gimple_build_assign (lhs, done);
>>> +           gsi_replace (gsi, get_res, true);
>>> +           *handled_ops_p = true;
>>> +         }
>>> +         break;
>>> +       }
>>> +    }
>>> +  return NULL_TREE;
>>> +}
>>> +
>>> +/* Main entry point for lowering coroutine FE builtins.  */
>>> +
>>> +static unsigned int
>>> +execute_lower_coro_builtins (void)
>>> +{
>>> +  struct walk_stmt_info wi;
>>> +  gimple_seq body;
>>> +
>>> +  body = gimple_body (current_function_decl);
>>> +  memset (&wi, 0, sizeof (wi));
>>> +  walk_gimple_seq_mod (&body, lower_coro_builtin, NULL, &wi);
>>> +  gimple_set_body (current_function_decl, body);
>> 
>> it would be nice to elide the function walk for functions not
>> containing any CO* stuff (you noted that below for other parts).
>> We can spend a bit in struct function noting functions with
>> coroutine code inside and set the bit from frontends or from
>> the gimplifier for example.  Since it's behind the flag_coroutines
>> paywall this can be addressed as followup.
> 
> Yes, this bit flag is necessary for following optimization passes, I
> wonder which bit you would suggest?

it’s implemented in the patches (that should be merged soon, just retesing
after the git transition).
Uses a flag bit in the function struct. 

see:

https://gcc.gnu.org/ml/gcc-patches/2020-01/msg00435.html

diff --git a/gcc/function.h b/gcc/function.h
index 496d3f728c..1ee8ed3de5 100644
--- a/gcc/function.h
+++ b/gcc/function.h
@@ -418,6 +418,9 @@ struct GTY(()) function {
   /* Set when the function was compiled with generation of debug
      (begin stmt, inline entry, ...) markers enabled.  */
   unsigned int debug_nonbind_markers : 1;
+
+  /* Set if this is a coroutine-related function.  */
+  unsigned int coroutine_component : 1;
 };






Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]