maybe_complain_about_tail_call (tree call_expr, const char *reason)
{
gcc_assert (TREE_CODE (call_expr) == CALL_EXPR);
- if (!CALL_EXPR_MUST_TAIL_CALL (call_expr))
- return;
-
- error_at (EXPR_LOCATION (call_expr), "cannot tail-call: %s", reason);
- CALL_EXPR_MUST_TAIL_CALL (call_expr) = 0;
+ if (CALL_EXPR_MUST_TAIL_CALL (call_expr))
+ {
+ error_at (EXPR_LOCATION (call_expr), "cannot tail-call: %s", reason);
+ CALL_EXPR_MUST_TAIL_CALL (call_expr) = 0;
+ }
+ if (CALL_EXPR_TAILCALL (call_expr)
+ && dump_file
+ && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, ";; ");
+ print_generic_expr (dump_file, call_expr, TDF_SLIM);
+ fprintf (dump_file, "\n;; Cannot tail-call: %s\n", reason);
+ }
}
/* Fill in ARGS_SIZE and ARGS array based on the parameters found in
if (!call_from_thunk_p && DECL_P (base) && !TREE_STATIC (base))
{
*may_tailcall = false;
- maybe_complain_about_tail_call (exp,
- _("a callee-copied argument is"
- " stored in the current"
- " function's frame"));
+ maybe_complain_about_tail_call (exp, _("a callee-copied "
+ "argument is stored "
+ "in the current "
+ "function's frame"));
}
args[i].tree_value = build_fold_addr_expr_loc (loc,
if (!targetm.have_sibcall_epilogue ()
&& !targetm.emit_epilogue_for_sibcall)
{
- maybe_complain_about_tail_call
- (exp,
- _("machine description does not have"
- " a sibcall_epilogue instruction pattern"));
+ maybe_complain_about_tail_call (exp, _("machine description does not "
+ "have a sibcall_epilogue "
+ "instruction pattern"));
return false;
}
into a sibcall. */
if (!targetm.function_ok_for_sibcall (fndecl, exp))
{
- maybe_complain_about_tail_call (exp,
- _("target is not able to optimize the"
- " call into a sibling call"));
+ maybe_complain_about_tail_call (exp, _("target is not able to optimize "
+ "the call into a sibling call"));
return false;
}
if (maybe_gt (args_size.constant,
crtl->args.size - crtl->args.pretend_args_size))
{
- maybe_complain_about_tail_call (exp,
- _("callee required more stack slots"
- " than the caller"));
+ maybe_complain_about_tail_call (exp, _("callee required more stack "
+ "slots than the caller"));
return false;
}
(current_function_decl),
crtl->args.size)))
{
- maybe_complain_about_tail_call (exp,
- _("inconsistent number of"
- " popped arguments"));
+ maybe_complain_about_tail_call (exp, _("inconsistent number of"
+ " popped arguments"));
return false;
}
so this shouldn't really happen unless the
the musttail pass gave up walking before finding the call. */
if (!try_tail_call)
- maybe_complain_about_tail_call (exp, _("other reasons"));
+ maybe_complain_about_tail_call (exp, _("other reasons"));
int pass;
/* Register in which non-BLKmode value will be returned,
if (MEM_P (*iter))
{
try_tail_call = 0;
- maybe_complain_about_tail_call (exp,
- _("hidden string length argument passed on stack"));
+ maybe_complain_about_tail_call (exp, _("hidden string length "
+ "argument passed on "
+ "stack"));
break;
}
}
|| partial_subreg_p (caller_mode, callee_mode)))))
{
try_tail_call = 0;
- maybe_complain_about_tail_call (exp,
- _("caller and callee disagree in"
- " promotion of function"
- " return value"));
+ maybe_complain_about_tail_call (exp, _("caller and callee disagree "
+ "in promotion of function "
+ "return value"));
}
}
gimple_call_set_must_tail (call, false); /* Avoid another error. */
gimple_call_set_tail (call, false);
}
- if (dump_file)
+ if (dump_file && (dump_flags & TDF_DETAILS))
{
print_gimple_stmt (dump_file, call, 0, TDF_SLIM);
- fprintf (dump_file, "Cannot convert: %s\n", err);
+ fprintf (dump_file, "Cannot tail-call: %s\n", err);
}
}
return;
if (bad_stmt)
{
- maybe_error_musttail (call,
- _("memory reference or volatile after "
- "call"), diag_musttail);
+ maybe_error_musttail (call, _("memory reference or volatile "
+ "after call"), diag_musttail);
return;
}
ass_var = gimple_call_lhs (call);
if (!e)
{
- maybe_error_musttail (call,
- _("call may throw exception that does not "
- "propagate"), diag_musttail);
+ maybe_error_musttail (call, _("call may throw exception that does not "
+ "propagate"), diag_musttail);
return;
}
|| !empty_eh_cleanup (e->dest, 20)
|| EDGE_COUNT (bb->succs) > 2)
{
- maybe_error_musttail (call,
- _("call may throw exception caught locally "
- "or perform cleanups"), diag_musttail);
+ maybe_error_musttail (call, _("call may throw exception caught "
+ "locally or perform cleanups"),
+ diag_musttail);
return;
}
}
}
if (local_live_vars)
BITMAP_FREE (local_live_vars);
- maybe_error_musttail (call,
- _("call invocation refers to locals"),
- diag_musttail);
+ maybe_error_musttail (call, _("call invocation refers to "
+ "locals"), diag_musttail);
return;
}
else
continue;
}
BITMAP_FREE (local_live_vars);
- maybe_error_musttail (call,
- _("call invocation refers to locals"),
- diag_musttail);
+ maybe_error_musttail (call, _("call invocation refers to "
+ "locals"), diag_musttail);
return;
}
}
if (!VOID_TYPE_P (rettype)
&& !useless_type_conversion_p (rettype, calltype))
{
- maybe_error_musttail (call,
- _("call and return value are different"),
+ maybe_error_musttail (call, _("call and return value are different"),
diag_musttail);
return;
}
}
if (!ok)
{
- maybe_error_musttail (call,
- _("call and return value are different"),
+ maybe_error_musttail (call, _("call and return value are different"),
diag_musttail);
return;
}
multiplicands. */
if (!tail_recursion && (m || a))
{
- maybe_error_musttail (call,
- _("operations after non tail recursive call"),
- diag_musttail);
+ maybe_error_musttail (call, _("operations after non tail recursive "
+ "call"), diag_musttail);
return;
}
/* For pointers only allow additions. */
if (m && POINTER_TYPE_P (TREE_TYPE (DECL_RESULT (current_function_decl))))
{
- maybe_error_musttail (call,
- _("tail recursion with pointers can only use "
- "additions"), diag_musttail);
+ maybe_error_musttail (call, _("tail recursion with pointers can only "
+ "use additions"), diag_musttail);
return;
}
struct tailcall *a = *p;
*p = (*p)->next;
gcall *call = as_a <gcall *> (gsi_stmt (a->call_gsi));
- maybe_error_musttail (call,
- _("tail recursion with accumulation "
- "mixed with musttail "
- "non-recursive call"), diag_musttail);
+ maybe_error_musttail (call, _("tail recursion with "
+ "accumulation mixed with "
+ "musttail non-recursive call"),
+ diag_musttail);
free (a);
}
else