aboutsummaryrefslogtreecommitdiff
path: root/gcc/calls.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/calls.cc')
-rw-r--r--gcc/calls.cc62
1 files changed, 33 insertions, 29 deletions
diff --git a/gcc/calls.cc b/gcc/calls.cc
index b3dccd8..372fab3 100644
--- a/gcc/calls.cc
+++ b/gcc/calls.cc
@@ -1273,11 +1273,19 @@ void
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, ";; Cannot tail-call: %s: ", reason);
+ print_generic_expr (dump_file, call_expr, TDF_SLIM);
+ fprintf (dump_file, "\n");
+ }
}
/* Fill in ARGS_SIZE and ARGS array based on the parameters found in
@@ -1447,10 +1455,10 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED,
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,
@@ -2534,10 +2542,9 @@ can_implement_as_sibling_call_p (tree exp,
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;
}
@@ -2555,9 +2562,8 @@ can_implement_as_sibling_call_p (tree exp,
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;
}
@@ -2606,9 +2612,8 @@ can_implement_as_sibling_call_p (tree exp,
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;
}
@@ -2621,9 +2626,8 @@ can_implement_as_sibling_call_p (tree exp,
(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;
}
@@ -2685,7 +2689,7 @@ expand_call (tree exp, rtx target, int ignore)
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,
@@ -3092,8 +3096,9 @@ expand_call (tree exp, rtx target, int ignore)
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;
}
}
@@ -3140,10 +3145,9 @@ expand_call (tree exp, rtx target, int ignore)
|| 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"));
}
}