]> git.ipfire.org Git - thirdparty/gcc.git/commit
coroutines: Use DECL_VALUE_EXPR instead of rewriting vars.
authorIain Sandoe <iain@sandoe.co.uk>
Wed, 23 Jun 2021 07:19:13 +0000 (08:19 +0100)
committerIain Sandoe <iain@sandoe.co.uk>
Sun, 3 Oct 2021 19:20:02 +0000 (20:20 +0100)
commitb0be263236d6ab1931f0d71bc8905b653b528df2
treeda39e50c7eb31802a4be9d61e6c69e327356f3c9
parentcb6101a4eea1881457261b09aa1e00fc6806d145
coroutines: Use DECL_VALUE_EXPR instead of rewriting vars.

Variables that need to persist over suspension expressions
must be preserved by being copied into the coroutine frame.

The initial implementations do this manually in the transform
code.  However, that has various disadvantages - including
that the debug connections are lost between the original var
and the frame copy.

The revised implementation makes use of DECL_VALUE_EXPRs to
contain the frame offset expressions, so that the original
var names are preserved in the code.

This process is also applied to the function parms which are
always copied to the frame.  In this case the decls need to be
copied since they are used in two different contexts during
the re-write (in the building of the ramp function, and in
the actor function itself).

This will assist in improvement of debugging (PR 99215).

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/cp/ChangeLog:

* coroutines.cc (transform_local_var_uses): Record
frame offset expressions as DECL_VALUE_EXPRs instead of
rewriting them.

(cherry picked from commit 88974974d8188cf12e87e4ad3d23a8cbdd557f0e)
gcc/cp/coroutines.cc