RISC-V: Add naked function support.
authorKito Cheng <kito.cheng@gmail.com>
Wed, 10 Jan 2018 23:00:38 +0000 (23:00 +0000)
committerJim Wilson <wilson@gcc.gnu.org>
Wed, 10 Jan 2018 23:00:38 +0000 (15:00 -0800)
commit8cad5b143e23668e4b59596972b2249ce2d2d637
tree25f9cc56191853d6733003431c1a581d6d5f80fa
parent3ec62f54062b50d0c9e0ed55f4d83147df56fc92
RISC-V: Add naked function support.

2018-01-10  Kito Cheng  <kito.cheng@gmail.com>

gcc/
* config/riscv/riscv-protos.h (riscv_output_return): New.
* config/riscv/riscv.c (struct machine_function): New naked_p field.
(riscv_attribute_table, riscv_output_return),
(riscv_handle_fndecl_attribute, riscv_naked_function_p),
(riscv_allocate_stack_slots_for_args, riscv_warn_func_return): New.
(riscv_compute_frame_info): Only compute frame->mask if not a naked
function.
(riscv_expand_prologue): Add early return for naked function.
(riscv_expand_epilogue): Likewise.
(riscv_function_ok_for_sibcall): Return false for naked function.
(riscv_set_current_function): New.
(TARGET_SET_CURRENT_FUNCTION, TARGET_ALLOCATE_STACK_SLOTS_FOR_ARGS),
(TARGET_ATTRIBUTE_TABLE, TARGET_WARN_FUNC_RETURN): New.
* config/riscv/riscv.md (simple_return): Call riscv_output_return.
* doc/extend.texi (RISC-V Function Attributes): New.

Co-Authored-By: Jim Wilson <jimw@sifive.com>
From-SVN: r256462
gcc/ChangeLog
gcc/config/riscv/riscv-protos.h
gcc/config/riscv/riscv.c
gcc/config/riscv/riscv.md
gcc/doc/extend.texi