RISC-V: Add naked function support.
commitccd1609fb2353e872eb4aa91e24d609b2917f84e
authorwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 10 Jan 2018 23:00:38 +0000 (10 23:00 +0000)
committerwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 10 Jan 2018 23:00:38 +0000 (10 23:00 +0000)
tree25f9cc56191853d6733003431c1a581d6d5f80fa
parent825d41b781a095a32d603b672394702382a06cbc
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@256462 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/config/riscv/riscv-protos.h
gcc/config/riscv/riscv.c
gcc/config/riscv/riscv.md
gcc/doc/extend.texi