Aldy Hernandez wrote:
I'm in the process of converting the C++ FE to tuples.  In doing so I
have noticed that the C++ FE will frequently gimplify bits of a tree,
and then expect gimplify_expr() to gimplify the rest.  This seems
redundant, as gimplify_expr() more often than not will gimplify the
entire tree structure, without regard to what parts the C++ FE already
gimplified.

Yes, the gimplifier often makes several passes over the same trees to get them completely lowered. cp_gimplify_expr is a subroutine of the gimplifier.

This behavior is common throughout C++.  The C++ FE calls gimplify_stmt
on bits of trees, but then gimplify_expr() has to gimplify again.

It seems to me that a better approach would be to pass the
tree structure as generic as we can (without calls to gimplify_stmt in
the C++ FE), and then let gimplify_expr do its job.

Sure. Another alternative would be to leave the calls to gimplify_stmt (or probably change them to gimplify_to_stmt_list) and return GS_ALL_DONE from cp_gimplify_expr.

Jason

Reply via email to