Nathan Sidwell <nat...@acm.org> wrote:
On 3/24/20 2:08 PM, Iain Sandoe wrote:
Hi Nathan,
Thanks for the review,
comments embedded and a new version attached.
@David, you added the CALL_EXPR_MUST_TAIL_CALL which I’ve made use of
here (but with an observation). Perhaps you would be able to comment on
whether
I’ve (ab-)used it correctly?
OK for master now?
thanks
Iain
Nathan Sidwell <nat...@acm.org> wrote:
On 3/20/20 11:40 AM, Iain Sandoe via Gcc-patches wrote:
tree suspend = TREE_VEC_ELT (awaiter_calls, 1); /* await_suspend(). */
+ tree susp_type;
+ if (TREE_CODE (suspend) == CALL_EXPR)
+ {
+ susp_type = CALL_EXPR_FN (suspend);
+ if (TREE_CODE (susp_type) == ADDR_EXPR)
+ susp_type = TREE_OPERAND (susp_type, 0);
+ susp_type = TREE_TYPE (TREE_TYPE (susp_type));
+ }
+ else
+ susp_type = TREE_TYPE (suspend);
I think:
if (tree fndec = get_callee_fndecl_nofold (suspend))
susp_type = TREE_TYPE (TREE_TYPE (fndecl));
else
susp_type = TREE_TYPE (suspend);
would do? But how can TREE_TYPE (suspend) be different from the return
type of the function decl? It seems funky that the behaviour could
depend on the form of the suspend. What am I missing?
Your proposed change is much neater, thanks.
The reason for the alternate is that the expression can also be a
target_expr.
That's not clarifying it for me. Why is a CALL_EXPR's type different to
they return type of the function being called? And why in that case do
you want the former, not the latter?
it isn’t (and therefore I don’t), and the type of the call expr is fine viz:
tree susp_type = TREE_TYPE (suspend);
(changed locally)
Iain