Commit e91cacae by Thomas Schwinge Committed by Thomas Schwinge

[PR target/70860] [nvptx] Handle NULL cfun in nvptx_libcall_value

	gcc/
	PR target/70860
	* config/nvptx/nvptx.c (nvptx_libcall_value): Handle NULL cfun.
	(nvptx_function_value): Assert non-NULL cfun.

From-SVN: r235748
parent c408fb34
2016-05-02 Thomas Schwinge <thomas@codesourcery.com>
PR target/70860
* config/nvptx/nvptx.c (nvptx_libcall_value): Handle NULL cfun.
(nvptx_function_value): Assert non-NULL cfun.
2016-05-02 Eric Botcazou <ebotcazou@adacore.com> 2016-05-02 Eric Botcazou <ebotcazou@adacore.com>
PR rtl-optimization/70886 PR rtl-optimization/70886
......
...@@ -483,7 +483,7 @@ nvptx_strict_argument_naming (cumulative_args_t cum_v) ...@@ -483,7 +483,7 @@ nvptx_strict_argument_naming (cumulative_args_t cum_v)
static rtx static rtx
nvptx_libcall_value (machine_mode mode, const_rtx) nvptx_libcall_value (machine_mode mode, const_rtx)
{ {
if (!cfun->machine->doing_call) if (!cfun || !cfun->machine->doing_call)
/* Pretend to return in a hard reg for early uses before pseudos can be /* Pretend to return in a hard reg for early uses before pseudos can be
generated. */ generated. */
return gen_rtx_REG (mode, NVPTX_RETURN_REGNUM); return gen_rtx_REG (mode, NVPTX_RETURN_REGNUM);
...@@ -502,6 +502,7 @@ nvptx_function_value (const_tree type, const_tree ARG_UNUSED (func), ...@@ -502,6 +502,7 @@ nvptx_function_value (const_tree type, const_tree ARG_UNUSED (func),
if (outgoing) if (outgoing)
{ {
gcc_assert (cfun);
cfun->machine->return_mode = mode; cfun->machine->return_mode = mode;
return gen_rtx_REG (mode, NVPTX_RETURN_REGNUM); return gen_rtx_REG (mode, NVPTX_RETURN_REGNUM);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment